Skip to content

Commit 5806322

Browse files
committed
Fix colormap copy type
1 parent a344cdc commit 5806322

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/tol_colors/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from collections import namedtuple
1818
from collections.abc import Sequence
1919
from importlib import resources
20-
from typing import Literal, NamedTuple, overload
20+
from typing import Literal, NamedTuple, cast, overload
2121

2222
import matplotlib
2323
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
@@ -294,7 +294,9 @@ def __getitem__(
294294
def __getitem__(self, key: str) -> LinearSegmentedColormap | ListedColormap: ...
295295

296296
def __getitem__(self, key: str) -> LinearSegmentedColormap | ListedColormap:
297-
return super().__getitem__(key).copy()
297+
return cast(
298+
LinearSegmentedColormap | ListedColormap, super().__getitem__(key).copy()
299+
)
298300

299301

300302
colormaps = ColormapMapping()

0 commit comments

Comments
 (0)