From 373b0dd93064ede5b5149c532c6e706ac7e84c43 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Thu, 11 Jan 2024 23:53:51 -0800 Subject: [PATCH] Remove *args Display-specific arguments should all be passed as kwargs. --- python/lsst/afw/display/interface.py | 37 +++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/python/lsst/afw/display/interface.py b/python/lsst/afw/display/interface.py index 480056756..fd9a85b83 100644 --- a/python/lsst/afw/display/interface.py +++ b/python/lsst/afw/display/interface.py @@ -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 """ @@ -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() @@ -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 @@ -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 ---------- @@ -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 """ @@ -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] @@ -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 ---------- @@ -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 """ @@ -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 ---------- @@ -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 """ @@ -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 @@ -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 ---------- @@ -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 @@ -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():