Skip to content

Commit 367e575

Browse files
Apply and enforce ruff/pyupgrade rules (UP)
UP006 Use `tuple` instead of `Tuple` for type annotation UP035 `typing.Dict` is deprecated, use `dict` instead UP035 `typing.Tuple` is deprecated, use `tuple` instead UP035 `typing.Type` is deprecated, use `type` instead
1 parent 7a813b5 commit 367e575

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

numcodecs/ndarray_like.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Optional, Protocol, Tuple, Type, runtime_checkable
1+
from typing import Any, Optional, Protocol, runtime_checkable
22

33

44
class _CachedProtocolMeta(Protocol.__class__):
@@ -11,7 +11,7 @@ class _CachedProtocolMeta(Protocol.__class__):
1111
isinstance checks using the object's class as the cache key.
1212
"""
1313

14-
_instancecheck_cache: Dict[Tuple[Type, Type], bool] = {}
14+
_instancecheck_cache: dict[tuple[type, type], bool] = {}
1515

1616
def __instancecheck__(self, instance):
1717
key = (self, instance.__class__)
@@ -39,8 +39,8 @@ class FlagsObj(Protocol, metaclass=_CachedProtocolMeta):
3939
@runtime_checkable
4040
class NDArrayLike(Protocol, metaclass=_CachedProtocolMeta):
4141
dtype: DType
42-
shape: Tuple[int, ...]
43-
strides: Tuple[int, ...]
42+
shape: tuple[int, ...]
43+
strides: tuple[int, ...]
4444
ndim: int
4545
size: int
4646
itemsize: int

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,9 @@ environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 }
131131
[tool.ruff]
132132
line-length = 100
133133

134+
[tool.ruff.lint]
135+
extend-select = [ "UP" ]
136+
ignore = ["UP007"]
137+
134138
[tool.ruff.format]
135139
quote-style = "preserve"

0 commit comments

Comments
 (0)