Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -16,7 +16,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/sirosen/texthooks
rev: "0.6.8"
rev: "0.7.1"
hooks:
- id: fix-ligatures
- id: fix-smartquotes
Expand All @@ -30,18 +30,18 @@ repos:
additional_dependencies: [pyyaml]

- repo: https://github.com/psf/black
rev: "24.10.0"
rev: "25.1.0"
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.13.0"
rev: "v1.17.1"
hooks:
- id: mypy
exclude: snaphu/io/__init__\.py$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.3"
rev: "v0.12.11"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ select = [
"YTT", # flake8-2020
]
ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"PLR", # Pylint Refactor
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"PLR", # Pylint Refactor
"PLC0415", # `import` should be at the top-level of a file
]
typing-extensions = false

[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["F401"]
Expand Down
4 changes: 3 additions & 1 deletion src/snaphu/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ def read_from_file(
n = dataset.shape[0]
for slice_ in slices(0, n, batchsize):
# Infer the shape and size of the corresponding slice of the dataset.
shape = (slice_.stop - slice_.start,) + dataset.shape[1:]
first_dim = slice_.stop - slice_.start
other_dims = dataset.shape[1:]
shape = (first_dim, *other_dims)
size = np.prod(shape)

# Read a batch of data from the file.
Expand Down
4 changes: 2 additions & 2 deletions src/snaphu/io/_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def nodata(self) -> float | None:
float or None : The raster's nodata value (may be unset).

The raster's nodata value, or None if no nodata value was set.
"""
""" # noqa: D403
return self.dataset.nodatavals[self.band - 1] # type: ignore[no-any-return]

@property
Expand All @@ -268,7 +268,7 @@ def __exit__(self, exc_type, exc_value, traceback): # type: ignore[no-untyped-d
self.close()

def __array__(
self, dtype: DTypeLike | None = None, copy: bool | None = None
self, dtype: DTypeLike | None = None, *, copy: bool | None = None
) -> np.ndarray:
if not copy and (copy is not None):
errmsg = "unable to avoid copy while creating an array as requested"
Expand Down
Loading