Skip to content

Commit b0fd139

Browse files
Apply and enforce ruff rules (RUF)
Apply ruff rule RUF012: RUF012 Mutable class attributes should be annotated with `typing.ClassVar` Disable ruff rule RUF001
1 parent 53e85a3 commit b0fd139

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

numcodecs/ndarray_like.py

Lines changed: 2 additions & 2 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, ClassVar, Dict, Optional, Protocol, Tuple, Type, 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: ClassVar[Dict[Tuple[Type, Type], bool]] = {}
1515

1616
def __instancecheck__(self, instance):
1717
key = (self, instance.__class__)

pyproject.toml

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

136+
[tool.ruff.lint]
137+
extend-select = [ "RUF" ]
138+
ignore = [ "RUF001" ]
139+
136140
[tool.ruff.format]
137141
quote-style = "preserve"

0 commit comments

Comments
 (0)