Skip to content

Commit

Permalink
Merge pull request #56 from hanjinliu/deprecate
Browse files Browse the repository at this point in the history
remove deprecated methods
  • Loading branch information
hanjinliu authored Aug 10, 2024
2 parents 7626aa5 + 0ab6d6c commit 535c9cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 86 deletions.
19 changes: 0 additions & 19 deletions whitecanvas/canvas/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from cmap import Color
from numpy.typing import ArrayLike
from psygnal import Signal, SignalGroup
from typing_extensions import deprecated

from whitecanvas import layers as _l
from whitecanvas import protocols, theme
Expand Down Expand Up @@ -49,7 +48,6 @@
OrientationLike,
Rect,
Symbol,
_Void,
)
from whitecanvas.utils.normalize import as_array_1d, normalize_xy
from whitecanvas.utils.type_check import is_real_number
Expand All @@ -62,7 +60,6 @@

_L = TypeVar("_L", bound=_l.Layer)
_L0 = TypeVar("_L0", _l.Bars, _l.Band)
_void = _Void()


class CanvasEvents(SignalGroup):
Expand Down Expand Up @@ -734,22 +731,6 @@ def stack_over(self, layer: _L0) -> StackOverPlotter[Self, _L0]:
def between(self, l0, l1) -> BetweenPlotter[Self]:
return BetweenPlotter(self, l0, l1)

@deprecated(
"ImageRef is deprecated and will be removed in the future. "
"Please use the Image methods `with_text`, `with_colorbar` instead.",
)
def imref(self, layer: _l.Image):
"""The Image reference namespace."""
from whitecanvas.canvas._imageref import ImageRef

while isinstance(layer, _l.LayerWrapper):
layer = layer._base_layer
if not isinstance(layer, _l.Image):
raise TypeError(
f"Expected an Image layer or its wrapper, got {type(layer)}."
)
return ImageRef(self, layer)

def fit(self, layer: _l.DataBoundLayer[_P]) -> FitPlotter[Self, _P]:
"""The fit plotter namespace."""
return FitPlotter(self, layer)
Expand Down
56 changes: 0 additions & 56 deletions whitecanvas/canvas/_imageref.py

This file was deleted.

15 changes: 4 additions & 11 deletions whitecanvas/layers/group/labeled.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
from cmap import Colormap
from numpy.typing import NDArray
from typing_extensions import deprecated

from whitecanvas.backend import Backend
from whitecanvas.layers import _legend, _mixin, _text_utils
Expand All @@ -28,14 +27,12 @@
Origin,
Rect,
XYData,
_Void,
)
from whitecanvas.utils.normalize import as_any_1d_array, as_color_array

if TYPE_CHECKING:
from typing_extensions import Self

_void = _Void()
_NFace = TypeVar("_NFace", bound="_mixin.FaceNamespace")
_NEdge = TypeVar("_NEdge", bound="_mixin.EdgeNamespace")
_Size = TypeVar("_Size")
Expand Down Expand Up @@ -131,10 +128,6 @@ def with_text_offset(self, dx: Any, dy: Any):
self.texts.set_pos(px + xoff, py + yoff)
self._text_offset = _offset

@deprecated("add_text_offset is deprecated. Please use with_text_offset instead.")
def add_text_offset(self, *args, **kwargs):
return self.with_text_offset(*args, **kwargs)

def with_xerr(
self,
len_lower: float,
Expand Down Expand Up @@ -736,12 +729,12 @@ def origin(self, origin: Origin | str):
self.image.origin = origin

@overload
def fit_to(self, bbox: Rect | tuple[float, float, float, float], /) -> Image:
...
def fit_to(self, bbox: Rect | tuple[float, float, float, float], /) -> Image: ...

@overload
def fit_to(self, left: float, right: float, bottom: float, top: float, /) -> Image:
...
def fit_to(
self, left: float, right: float, bottom: float, top: float, /
) -> Image: ...

def fit_to(self, *args) -> Image:
"""Fit the image to the given bounding box."""
Expand Down

0 comments on commit 535c9cc

Please sign in to comment.