Skip to content

Commit eadf386

Browse files
committed
Remove Self import and replace with "Self"
Self is not available in Python 3.10
1 parent 2fd15fe commit eadf386

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

eitprocessing/datahandling/pixelmap.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from collections.abc import Callable
3030
from copy import deepcopy
3131
from dataclasses import KW_ONLY, MISSING, asdict, dataclass, field, replace
32-
from typing import Self, TypeVar, cast
32+
from typing import TypeVar, cast
3333

3434
import matplotlib as mpl
3535
import numpy as np
@@ -106,7 +106,7 @@ def __post_init__(self):
106106

107107
object.__setattr__(self, key, merged)
108108

109-
def update(self, **changes) -> Self:
109+
def update(self, **changes) -> "Self":
110110
"""Return a copy of the of the PlotParameters instance replacing attributes.
111111
112112
Similar to dataclass.replace(), but with special handling of `colorbar_kwargs`. `colorbar_kwargs` is updated
@@ -116,7 +116,7 @@ def update(self, **changes) -> Self:
116116
**changes: New values for attributes to replace.
117117
118118
Returns:
119-
Self: A new instance with the replaced attributes.
119+
"Self": A new instance with the replaced attributes.
120120
"""
121121
if "colorbar_kwargs" in changes:
122122
changes["colorbar_kwargs"] = self.colorbar_kwargs | changes["colorbar_kwargs"]
@@ -175,7 +175,7 @@ def threshold(
175175
keep_sign: bool = False,
176176
fill_value: float = np.nan,
177177
**return_attrs: dict | None,
178-
) -> Self:
178+
) -> "Self":
179179
"""Threshold the pixel map values.
180180
181181
This method applies a threshold to the pixel map values, setting values that do not meet the threshold condition
@@ -197,7 +197,7 @@ def threshold(
197197
**return_attrs (dict | None): Additional attributes to pass to the new PixelMap instance.
198198
199199
Returns:
200-
Self: A new object instance with the thresholded values.
200+
"Self": A new object instance with the thresholded values.
201201
"""
202202
compare_values = np.abs(self.values) if absolute else self.values
203203
sign = np.sign(self.values) if keep_sign else 1.0
@@ -358,7 +358,7 @@ def convert_to(self, target_type: type[T], *, keep_attrs: bool = False, **kwargs
358358

359359
return target_type(**data)
360360

361-
def update(self, **changes) -> Self:
361+
def update(self, **changes) -> "Self":
362362
"""Return a copy of the of the PixelMap instance replacing attributes.
363363
364364
Similar to dataclass.replace(), but with special handling of `plot_parameters`. When `plot_parameters` is
@@ -368,7 +368,7 @@ def update(self, **changes) -> Self:
368368
**changes: New values for attributes to replace.
369369
370370
Returns:
371-
Self: A new instance with the replaced attributes.
371+
"Self": A new instance with the replaced attributes.
372372
"""
373373
plot_parameters = self.plot_parameters
374374
if "plot_parameters" in changes and isinstance(changes["plot_parameters"], dict):

0 commit comments

Comments
 (0)