diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 838e0e6d..8051bfac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,13 +7,13 @@ default_stages: minimum_pre_commit_version: 3.0.0 repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.19.1 hooks: - id: mypy additional_dependencies: [numpy>=1.25.0] files: ^src - - repo: https://github.com/psf/black - rev: 25.1.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.3.1 hooks: - id: black additional_dependencies: [toml] @@ -23,13 +23,13 @@ repos: - id: prettier language_version: system - repo: https://github.com/PyCQA/isort - rev: 6.0.1 + rev: 8.0.1 hooks: - id: isort additional_dependencies: [toml] args: [--order-by-type] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-merge-conflict - id: check-ast @@ -42,28 +42,28 @@ repos: - id: check-yaml - id: check-toml - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v3.21.2 hooks: - id: pyupgrade args: [--py3-plus, --py38-plus, --keep-runtime-typing] - repo: https://github.com/asottile/blacken-docs - rev: 1.19.1 + rev: 1.20.0 hooks: - id: blacken-docs additional_dependencies: [black==23.1.0] - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.4 + rev: v6.2.5 hooks: - id: rstcheck additional_dependencies: [toml, sphinx] args: [--config=pyproject.toml] - repo: https://github.com/PyCQA/doc8 - rev: v1.1.2 + rev: v2.0.0 hooks: - id: doc8 - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.11.7 + rev: v0.15.7 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/src/moscot/base/problems/_utils.py b/src/moscot/base/problems/_utils.py index 482f79b7..e395cced 100644 --- a/src/moscot/base/problems/_utils.py +++ b/src/moscot/base/problems/_utils.py @@ -695,7 +695,7 @@ def wrapper(*args, **kwargs): ixs = [np.arange(i * step, min((i + 1) * step, collection.shape[0])) for i in range(n_split)] # type: ignore # noqa: E501 ixs[-1] = np.append(ixs[-1], np.arange(ixs[-1][-1] + 1, collection.shape[0])) # type: ignore - collections = [collection[ix, :] for ix in filter(len, ixs)] # type:ignore[call-overload] + collections = [collection[ix, :] for ix in filter(len, ixs)] # type: ignore[call-overload] else: collections = list(filter(len, np.array_split(collection, n_split))) diff --git a/src/moscot/base/problems/problem.py b/src/moscot/base/problems/problem.py index 811ac158..897bc813 100644 --- a/src/moscot/base/problems/problem.py +++ b/src/moscot/base/problems/problem.py @@ -181,7 +181,7 @@ def _split_mass(arr: ArrayLike) -> ArrayLike: else np.ones((adata.n_obs,), dtype=float) ) else: - sset = subset if isinstance(subset, list) else [subset] # type:ignore[list-item] + sset = subset if isinstance(subset, list) else [subset] # type: ignore[list-item] data = np.asarray(adata.obs[data].isin(sset), dtype=float) else: data = np.asarray(data, dtype=float) diff --git a/src/moscot/problems/_utils.py b/src/moscot/problems/_utils.py index a405a3da..8a0380d2 100644 --- a/src/moscot/problems/_utils.py +++ b/src/moscot/problems/_utils.py @@ -53,7 +53,7 @@ def _handle_mapping_joint_attr( } return xy, xy_callback, xy_callback_kwargs # type: ignore[return-value] - if joint_attr.get("tag", None) == "cost_matrix" and (len(joint_attr) == 2 or joint_attr.get("attr") == "obsp"): + if joint_attr.get("tag") == "cost_matrix" and (len(joint_attr) == 2 or joint_attr.get("attr") == "obsp"): joint_attr.setdefault("cost", "custom") joint_attr.setdefault("attr", "obsp") xy_callback = "cost-matrix" @@ -100,9 +100,9 @@ def handle_cost( "y": (y or y_callback) and "cost" not in y, } if isinstance(cost, Mapping): - cost_candidates = {k: cost[k] for k, v in cost_candidates.items() if v} # type:ignore[index,misc] + cost_candidates = {k: cost[k] for k, v in cost_candidates.items() if v} # type: ignore[index,misc] elif isinstance(cost, str): - cost_candidates = {k: cost for k, v in cost_candidates.items() if v} # type:ignore[misc] + cost_candidates = {k: cost for k, v in cost_candidates.items() if v} # type: ignore[misc] else: raise TypeError(f"Expected `cost` to be either `str` or `dict`, found `{type(cost)}`.") @@ -120,9 +120,9 @@ def handle_cost( for k, v in items: xy[f"x_{k}"] = xy[f"y_{k}"] = v if "x" in cost_candidates: - x.update(cost_kwargs.get("x", cost_kwargs)) # type:ignore[call-overload] + x.update(cost_kwargs.get("x", cost_kwargs)) # type: ignore[call-overload] if "y" in cost_candidates: - y.update(cost_kwargs.get("y", cost_kwargs)) # type:ignore[call-overload] + y.update(cost_kwargs.get("y", cost_kwargs)) # type: ignore[call-overload] return xy, x, y @@ -199,5 +199,5 @@ def handle_cost_tmp( for k, v in items: xy[f"xy_{k}"] = xy[f"xy_{k}"] = v if xx and cost_kwargs: # extract cost_kwargs explicit to x-term if possible - xx.update(cost_kwargs.get("xx", cost_kwargs)) # type:ignore[call-overload] + xx.update(cost_kwargs.get("xx", cost_kwargs)) # type: ignore[call-overload] return xy, xx diff --git a/src/moscot/problems/time/_lineage.py b/src/moscot/problems/time/_lineage.py index a7d701ab..c3fdec55 100644 --- a/src/moscot/problems/time/_lineage.py +++ b/src/moscot/problems/time/_lineage.py @@ -252,7 +252,7 @@ def solve( """ if self.problem_kind == "linear": kwargs["lse_mode"] = lse_mode - return super().solve( # type:ignore[return-value] + return super().solve( # type: ignore[return-value] epsilon=epsilon, tau_a=tau_a, tau_b=tau_b,