diff --git a/fastplotlib/graphics/_base.py b/fastplotlib/graphics/_base.py index 91ccb143e..3ee3792ae 100644 --- a/fastplotlib/graphics/_base.py +++ b/fastplotlib/graphics/_base.py @@ -408,7 +408,7 @@ class GraphicCollection(Graphic): """Graphic Collection base class""" def __init__(self, name: str = None): - super(GraphicCollection, self).__init__(name) + super().__init__(name) self._graphics: List[str] = list() self._graphics_changed: bool = True diff --git a/fastplotlib/graphics/_features/_colors.py b/fastplotlib/graphics/_features/_colors.py index ad9e673ef..48405e74c 100644 --- a/fastplotlib/graphics/_features/_colors.py +++ b/fastplotlib/graphics/_features/_colors.py @@ -124,9 +124,7 @@ def __init__( if alpha != 1.0: data[:, -1] = alpha - super(ColorFeature, self).__init__( - parent, data, collection_index=collection_index - ) + super().__init__(parent, data, collection_index=collection_index) def __setitem__(self, key, value): # parse numerical slice indices @@ -253,6 +251,7 @@ class CmapFeature(ColorFeature): """ def __init__(self, parent, colors, cmap_name: str, cmap_values: np.ndarray): + # Skip the ColorFeature's __init__ super(ColorFeature, self).__init__(parent, colors) self._cmap_name = cmap_name @@ -278,7 +277,7 @@ def __setitem__(self, key, cmap_name): ) self._cmap_name = cmap_name - super(CmapFeature, self).__setitem__(key, colors) + super().__setitem__(key, colors) @property def name(self) -> str: @@ -299,7 +298,7 @@ def values(self, values: np.ndarray): self._cmap_values = values - super(CmapFeature, self).__setitem__(slice(None), colors) + super().__setitem__(slice(None), colors) def __repr__(self) -> str: s = f"CmapFeature for {self._parent}, to get name or values: `.cmap.name`, `.cmap.values`" @@ -330,7 +329,7 @@ class ImageCmapFeature(GraphicFeature): def __init__(self, parent, cmap: str): cmap_texture_view = get_cmap_texture(cmap) - super(ImageCmapFeature, self).__init__(parent, cmap_texture_view) + super().__init__(parent, cmap_texture_view) self._name = cmap def _set(self, cmap_name: str): diff --git a/fastplotlib/graphics/_features/_data.py b/fastplotlib/graphics/_features/_data.py index 23e80b470..bcfe9446a 100644 --- a/fastplotlib/graphics/_features/_data.py +++ b/fastplotlib/graphics/_features/_data.py @@ -21,9 +21,7 @@ class PointsDataFeature(GraphicFeatureIndexable): def __init__(self, parent, data: Any, collection_index: int = None): data = self._fix_data(data, parent) - super(PointsDataFeature, self).__init__( - parent, data, collection_index=collection_index - ) + super().__init__(parent, data, collection_index=collection_index) @property def buffer(self) -> pygfx.Buffer: @@ -117,7 +115,7 @@ def __init__(self, parent, data: Any): "``[x_dim, y_dim]`` or ``[x_dim, y_dim, rgb]``" ) - super(ImageDataFeature, self).__init__(parent, data) + super().__init__(parent, data) @property def buffer(self) -> pygfx.Texture: diff --git a/fastplotlib/graphics/_features/_deleted.py b/fastplotlib/graphics/_features/_deleted.py index 2fca1c719..7900385eb 100644 --- a/fastplotlib/graphics/_features/_deleted.py +++ b/fastplotlib/graphics/_features/_deleted.py @@ -16,7 +16,7 @@ class Deleted(GraphicFeature): """ def __init__(self, parent, value: bool): - super(Deleted, self).__init__(parent, value) + super().__init__(parent, value) def _set(self, value: bool): value = self._parse_set_value(value) diff --git a/fastplotlib/graphics/_features/_present.py b/fastplotlib/graphics/_features/_present.py index 6fbf93b48..a73d66523 100644 --- a/fastplotlib/graphics/_features/_present.py +++ b/fastplotlib/graphics/_features/_present.py @@ -23,7 +23,7 @@ class PresentFeature(GraphicFeature): def __init__(self, parent, present: bool = True, collection_index: int = False): self._scene = None - super(PresentFeature, self).__init__(parent, present, collection_index) + super().__init__(parent, present, collection_index) def _set(self, present: bool): present = self._parse_set_value(present) diff --git a/fastplotlib/graphics/_features/_selection_features.py b/fastplotlib/graphics/_features/_selection_features.py index 294bb15d6..21e5d0a09 100644 --- a/fastplotlib/graphics/_features/_selection_features.py +++ b/fastplotlib/graphics/_features/_selection_features.py @@ -27,7 +27,7 @@ class LinearSelectionFeature(GraphicFeature): """ def __init__(self, parent, axis: str, value: float, limits: Tuple[int, int]): - super(LinearSelectionFeature, self).__init__(parent, data=value) + super().__init__(parent, data=value) self._axis = axis self._limits = limits @@ -99,7 +99,7 @@ class LinearRegionSelectionFeature(GraphicFeature): def __init__( self, parent, selection: Tuple[int, int], axis: str, limits: Tuple[int, int] ): - super(LinearRegionSelectionFeature, self).__init__(parent, data=selection) + super().__init__(parent, data=selection) self._axis = axis self._limits = limits diff --git a/fastplotlib/graphics/_features/_sizes.py b/fastplotlib/graphics/_features/_sizes.py index 403760508..2ceeb7862 100644 --- a/fastplotlib/graphics/_features/_sizes.py +++ b/fastplotlib/graphics/_features/_sizes.py @@ -21,9 +21,7 @@ class PointsSizesFeature(GraphicFeatureIndexable): def __init__(self, parent, sizes: Any, collection_index: int = None): sizes = self._fix_sizes(sizes, parent) - super(PointsSizesFeature, self).__init__( - parent, sizes, collection_index=collection_index - ) + super().__init__(parent, sizes, collection_index=collection_index) @property def buffer(self) -> pygfx.Buffer: diff --git a/fastplotlib/graphics/_features/_thickness.py b/fastplotlib/graphics/_features/_thickness.py index f9190f0b1..fc90ef96f 100644 --- a/fastplotlib/graphics/_features/_thickness.py +++ b/fastplotlib/graphics/_features/_thickness.py @@ -19,7 +19,7 @@ class ThicknessFeature(GraphicFeature): def __init__(self, parent, thickness: float): self._scene = None - super(ThicknessFeature, self).__init__(parent, thickness) + super().__init__(parent, thickness) def _set(self, value: float): value = self._parse_set_value(value) diff --git a/fastplotlib/graphics/histogram.py b/fastplotlib/graphics/histogram.py index 6efd83a96..b78be39d3 100644 --- a/fastplotlib/graphics/histogram.py +++ b/fastplotlib/graphics/histogram.py @@ -10,7 +10,7 @@ class _HistogramBin(pygfx.Mesh): def __int__(self, *args, **kwargs): - super(_HistogramBin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.bin_center: float = None self.frequency: Union[int, float] = None @@ -93,9 +93,7 @@ def __init__( data = np.vstack([x_positions_bins, self.hist]) - super(HistogramGraphic, self).__init__( - data=data, colors=colors, n_colors=n_bins, **kwargs - ) + super().__init__(data=data, colors=colors, n_colors=n_bins, **kwargs) self._world_object: pygfx.Group = pygfx.Group() diff --git a/fastplotlib/graphics/line.py b/fastplotlib/graphics/line.py index 9ac7568a7..d76c8e704 100644 --- a/fastplotlib/graphics/line.py +++ b/fastplotlib/graphics/line.py @@ -102,7 +102,7 @@ def __init__( self, self.colors(), cmap_name=cmap, cmap_values=cmap_values ) - super(LineGraphic, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if thickness < 1.1: material = pygfx.LineThinMaterial diff --git a/fastplotlib/graphics/line_collection.py b/fastplotlib/graphics/line_collection.py index a5c398130..bb7bb2444 100644 --- a/fastplotlib/graphics/line_collection.py +++ b/fastplotlib/graphics/line_collection.py @@ -87,7 +87,7 @@ def __init__( """ - super(LineCollection, self).__init__(name) + super().__init__(name) if not isinstance(z_position, float) and z_position is not None: if len(data) != len(z_position): @@ -544,7 +544,7 @@ def __init__( See :class:`LineGraphic` details on the features. """ - super(LineStack, self).__init__( + super().__init__( data=data, z_position=z_position, thickness=thickness, diff --git a/fastplotlib/graphics/scatter.py b/fastplotlib/graphics/scatter.py index 1c579eaa5..3f04f644e 100644 --- a/fastplotlib/graphics/scatter.py +++ b/fastplotlib/graphics/scatter.py @@ -87,7 +87,7 @@ def __init__( ) self.sizes = PointsSizesFeature(self, sizes) - super(ScatterGraphic, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) world_object = pygfx.Points( pygfx.Geometry( diff --git a/fastplotlib/graphics/selectors/_rectangle_region.py b/fastplotlib/graphics/selectors/_rectangle_region.py index 0d7dd3661..1081a49a9 100644 --- a/fastplotlib/graphics/selectors/_rectangle_region.py +++ b/fastplotlib/graphics/selectors/_rectangle_region.py @@ -28,7 +28,7 @@ class RectangleBoundsFeature(GraphicFeature): def __init__( self, parent, bounds: Tuple[int, int], axis: str, limits: Tuple[int, int] ): - super(RectangleBoundsFeature, self).__init__(parent, data=bounds) + super().__init__(parent, data=bounds) self._axis = axis self.limits = limits diff --git a/fastplotlib/graphics/text.py b/fastplotlib/graphics/text.py index a8a873287..a486b1bd2 100644 --- a/fastplotlib/graphics/text.py +++ b/fastplotlib/graphics/text.py @@ -55,7 +55,7 @@ def __init__( * Vertical values: "top", "middle", "baseline", "bottom" * Horizontal values: "left", "center", "right" """ - super(TextGraphic, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._text = text diff --git a/fastplotlib/layouts/_plot.py b/fastplotlib/layouts/_plot.py index 34027a276..77aba0adc 100644 --- a/fastplotlib/layouts/_plot.py +++ b/fastplotlib/layouts/_plot.py @@ -45,7 +45,7 @@ def __init__( passed to Subplot, for example ``name`` """ - super(Plot, self).__init__( + super().__init__( parent=None, position=(0, 0), parent_dims=(1, 1), @@ -62,7 +62,7 @@ def __init__( def render(self): """performs a single render of the plot, not for the user""" - super(Plot, self).render() + super().render() self.renderer.flush() self.canvas.request_draw() diff --git a/fastplotlib/layouts/_subplot.py b/fastplotlib/layouts/_subplot.py index e776fddb6..6fa5f890e 100644 --- a/fastplotlib/layouts/_subplot.py +++ b/fastplotlib/layouts/_subplot.py @@ -214,7 +214,7 @@ def __init__( self._size = size - super(Dock, self).__init__( + super().__init__( parent=parent, position=position, camera=pygfx.OrthographicCamera(), @@ -349,4 +349,4 @@ def render(self): if self.size == 0: return - super(Dock, self).render() + super().render()