Skip to content
Open
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
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.20.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]
Expand All @@ -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
Expand All @@ -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.11
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
2 changes: 1 addition & 1 deletion src/moscot/base/problems/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down
2 changes: 1 addition & 1 deletion src/moscot/base/problems/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions src/moscot/problems/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)}`.")

Expand All @@ -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


Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/moscot/problems/time/_lineage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading