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
18 changes: 13 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
name: Modernize python code
args: ["--py38-plus"]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 6.0.1
hooks:
- id: isort
name: Reorder python imports with isort

- repo: https://github.com/psf/black
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black
name: Format python code with black
Expand All @@ -47,14 +47,14 @@ repos:
additional_dependencies: [flake8-bugbear, Flake8-pyproject]

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
rev: 7.2.0
hooks:
- id: flake8
name: Lint python code with flake8
additional_dependencies: [flake8-bugbear, Flake8-pyproject]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.15.0
hooks:
- id: mypy
name: Check Python types
Expand All @@ -67,6 +67,14 @@ repos:
name: Validate reStructuredText syntax
additional_dependencies: [sphinx, toml]

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: Check spelling with codespell
additional_dependencies:
- tomli # Python < 3.11

- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
4 changes: 2 additions & 2 deletions openslide/deepzoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def _z_from_t(self, t: int) -> int:

@staticmethod
def _pairs_from_n_tuples(
tuples: tuple[tuple[int, ...], ...]
tuples: tuple[tuple[int, ...], ...],
) -> tuple[tuple[int, int], ...]:
def all_pairs(
tuples: tuple[tuple[int, ...], ...]
tuples: tuple[tuple[int, ...], ...],
) -> TypeGuard[tuple[tuple[int, int], ...]]:
return all(len(t) == 2 for t in tuples)

Expand Down
4 changes: 2 additions & 2 deletions openslide/lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __call__(self, *_args: Any) -> Any:
class _Func(Protocol[_P, _T]):
available: bool

def __call__(self, *args: _P.args) -> _T: ...
def __call__(self, *args: _P.args) -> _T: ... # type: ignore[valid-type]

class _CTypesFunc(_Func[_P, _T]):
restype: type | None
Expand Down Expand Up @@ -358,7 +358,7 @@ def _func(


def _wraps_funcs(
wrapped: list[_Func[..., Any]]
wrapped: list[_Func[..., Any]],
) -> Callable[[Callable[_P, _T]], _Func[_P, _T]]:
def decorator(fn: Callable[_P, _T]) -> _Func[_P, _T]:
if TYPE_CHECKING:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ openslide = ["py.typed", "*.pyi"]
skip-string-normalization = true
target-version = ["py38", "py39", "py310", "py311", "py312", "py313"]

# Ref: https://github.com/codespell-project/codespell#using-a-config-file
[tool.codespell]
check-hidden = true
# ignore-regex = ""
# ignore-words-list = ""

# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
# also ignore:
# - E741 ambiguous variable name
Expand Down
Loading