Skip to content

Commit

Permalink
Remove *args
Browse files Browse the repository at this point in the history
Display-specific arguments should all be passed as kwargs.
  • Loading branch information
parejkoj committed Feb 2, 2024
1 parent daed4cf commit 373b0dd
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions python/lsst/afw/display/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class Display:
An identifier for the display
backend : `str`
The backend to use (defaults to value set by setDefaultBackend())
*args
Arguments to pass to the backend
**kwargs
Arguments to pass to the backend
"""
Expand All @@ -157,7 +155,7 @@ class Display:
_defaultMaskTransparency = {}
_defaultImageColormap = "gray"

def __init__(self, frame=None, backend=None, *args, **kwargs):
def __init__(self, frame=None, backend=None, **kwargs):
if frame is None:
frame = getDefaultFrame()

Expand All @@ -171,7 +169,7 @@ def __init__(self, frame=None, backend=None, *args, **kwargs):
backend = Display._defaultBackend

self.frame = frame
self._impl = _makeDisplayImpl(self, backend, *args, **kwargs)
self._impl = _makeDisplayImpl(self, backend, **kwargs)
self.name = backend

self._xy0 = None # displayed data's XY0
Expand Down Expand Up @@ -366,8 +364,8 @@ def setImageColormap(self, cmap):
self._impl._setImageColormap(cmap)

@staticmethod
def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
"""Return a specific `Display`, creating it if need be
def getDisplay(frame=None, backend=None, create=True, verbose=False, **kwargs):
"""Return a specific `Display`, creating it if need be.
Parameters
----------
Expand All @@ -381,8 +379,6 @@ def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kw
create the display if it doesn't already exist.
verbose : `bool`
Allow backend to be chatty
*args
arguments passed to `Display` constructor
**kwargs
keyword arguments passed to `Display` constructor
"""
Expand All @@ -395,7 +391,7 @@ def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kw
raise RuntimeError(f"Frame {frame} does not exist")

Display._displays[frame] = Display(
frame, backend, verbose=verbose, *args, **kwargs)
frame, backend, verbose=verbose, **kwargs)

Display._displays[frame].verbose = verbose
return Display._displays[frame]
Expand Down Expand Up @@ -658,8 +654,8 @@ def centroids(self, catalog, *, symbol="o", **kwargs):
for pt in catalog:
self.dot(symbol, pt.getX(), pt.getY(), **kwargs)

def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
"""Draw a symbol onto the specified display frame
def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, **kwargs):
"""Draw a symbol onto the specified display frame.
Parameters
----------
Expand Down Expand Up @@ -690,8 +686,6 @@ def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **k
The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
origin : `lsst.afw.image.ImageOrigin`
Coordinate system for the given positions.
*args
Extra arguments to backend
**kwargs
Extra keyword arguments to backend
"""
Expand Down Expand Up @@ -755,8 +749,9 @@ def line(self, points, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5

self._impl._drawLines(points, ctype)

def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
"""Set the range of the scaling from DN in the image to the image display
def scale(self, algorithm, min, max=None, unit=None, **kwargs):
"""Set the range of the scaling from DN in the image to the image
display.
Parameters
----------
Expand All @@ -768,8 +763,6 @@ def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
Maximum value (must be `None` for minmax|zscale)
unit
Units for min and max (e.g. Percent, Absolute, Sigma; `None` if min==minmax|zscale)
*args
Optional arguments to the backend
**kwargs
Optional keyword arguments to the backend
"""
Expand All @@ -779,7 +772,7 @@ def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
elif max is None:
raise RuntimeError("Please specify max")

self._impl._scale(algorithm, min, max, unit, *args, **kwargs)
self._impl._scale(algorithm, min, max, unit, **kwargs)

def zoom(self, zoomfac=None, colc=None, rowc=None, origin=afwImage.PARENT):
"""Zoom frame by specified amount, optionally panning also
Expand Down Expand Up @@ -964,8 +957,8 @@ def setDefaultMaskPlaneColor(name=None, color=None):
return Display.setDefaultMaskPlaneColor(name, color)


def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
"""Return a specific `Display`, creating it if need be
def getDisplay(frame=None, backend=None, create=True, verbose=False, **kwargs):
"""Return a specific `Display`, creating it if need be.
Parameters
----------
Expand All @@ -979,8 +972,6 @@ def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kw
Create the display if it doesn't already exist.
verbose : `bool`
Allow backend to be chatty
*args
arguments passed to `Display` constructor
**kwargs
keyword arguments passed to `Display` constructor
Expand All @@ -989,7 +980,7 @@ def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kw
Display.getDisplay
"""

return Display.getDisplay(frame, backend, create, verbose, *args, **kwargs)
return Display.getDisplay(frame, backend, create, verbose, **kwargs)


def delAllDisplays():
Expand Down

0 comments on commit 373b0dd

Please sign in to comment.