Skip to content

Commit 177a8c2

Browse files
Enforce ruff/flake8-annotations rules (ANN) (#2264)
* Apply ruff/flake8-annotations rule ANN204 ANN204 Missing return type annotation for special method `__init__` * Apply ruff/flake8-annotations rule ANN201 ANN201 Missing return type annotation for public function `basic_indices` * Enforce ruff/flake8-annotations rules (ANN) Disable lots of rules for now, especially in tests.
1 parent b6350a1 commit 177a8c2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ extend-exclude = [
206206

207207
[tool.ruff.lint]
208208
extend-select = [
209+
"ANN", # flake8-annotations
209210
"B", # flake8-bugbear
210211
"C4", # flake8-comprehensions
211212
"FLY", # flynt
@@ -222,6 +223,10 @@ extend-select = [
222223
"UP", # pyupgrade
223224
]
224225
ignore = [
226+
"ANN003",
227+
"ANN101",
228+
"ANN102",
229+
"ANN401",
225230
"PT004", # deprecated
226231
"PT011", # TODO: apply this rule
227232
"PT012", # TODO: apply this rule
@@ -247,6 +252,9 @@ ignore = [
247252
"ISC002",
248253
]
249254

255+
[tool.ruff.lint.extend-per-file-ignores]
256+
"tests/**" = ["ANN001", "ANN201"]
257+
250258
[tool.mypy]
251259
python_version = "3.11"
252260
ignore_missing_imports = true

src/zarr/store/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(
2424
store: Store,
2525
log_level: str = "DEBUG",
2626
log_handler: logging.Handler | None = None,
27-
):
27+
) -> None:
2828
self._store = store
2929
self.counter = defaultdict(int)
3030

src/zarr/testing/strategies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def is_negative_slice(idx: Any) -> bool:
158158

159159

160160
@st.composite # type: ignore[misc]
161-
def basic_indices(draw: st.DrawFn, *, shape: tuple[int], **kwargs): # type: ignore[no-untyped-def]
161+
def basic_indices(draw: st.DrawFn, *, shape: tuple[int], **kwargs) -> Any: # type: ignore[no-untyped-def]
162162
"""Basic indices without unsupported negative slices."""
163163
return draw(
164164
npst.basic_indices(shape=shape, **kwargs).filter(

0 commit comments

Comments
 (0)