Skip to content

Commit 0df4dba

Browse files
committed
linting
1 parent 13b0440 commit 0df4dba

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

benchmarks/benchmarks/_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717

1818
from anndata import AnnData
1919

20-
C = TypeVar("C", bound=Callable)
20+
C = TypeVar("C", bound=Callable) # type: ignore[type-arg]
2121

2222
class ParamSkipper(Protocol):
23-
def __call__(self, **skipped: AbstractSet) -> Callable[[C], C]: ...
23+
def __call__(self, **skipped: AbstractSet) -> Callable[[C], C]: ... # type: ignore[type-arg]
2424

2525
Dataset = Literal["imc"]
2626
KeyX = Literal[None, "off-axis"]
2727

2828

2929
@cache
3030
def _imc() -> AnnData:
31-
adata = sq.datasets.imc()
31+
adata = sq.datasets.imc() # type: ignore[attr-defined]
3232
assert isinstance(adata.X, np.ndarray)
3333
assert not np.isfortran(adata.X)
3434

@@ -39,7 +39,7 @@ def imc() -> AnnData:
3939
return _imc().copy()
4040

4141

42-
def to_off_axis(x: np.ndarray | csr_matrix | csc_matrix) -> np.ndarray | csc_matrix:
42+
def to_off_axis(x: np.ndarray | csr_matrix | csc_matrix) -> np.ndarray | csc_matrix: # type: ignore[type-arg]
4343
if isinstance(x, csr_matrix):
4444
return x.tocsc()
4545
if isinstance(x, np.ndarray):
@@ -87,13 +87,13 @@ def param_skipper(param_names: Sequence[str], params: tuple[Sequence[object], ..
8787
8888
"""
8989

90-
def skip(**skipped: AbstractSet) -> Callable[[C], C]:
90+
def skip(**skipped: AbstractSet) -> Callable[[C], C]: # type: ignore[type-arg]
9191
skipped_combs = [
9292
tuple(record.values())
9393
for record in (dict(zip(param_names, vals, strict=True)) for vals in itertools.product(*params))
9494
if any(v in skipped.get(n, set()) for n, v in record.items())
9595
]
9696
# print(skipped_combs, file=sys.stderr)
97-
return skip_for_params(skipped_combs)
97+
return skip_for_params(skipped_combs) # type: ignore[no-any-return]
9898

9999
return skip

benchmarks/benchmarks/preprocessing_co_occurence.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77

88
from typing import TYPE_CHECKING
99

10-
import squidpy as sq
11-
1210
from ._utils import get_dataset, param_skipper
1311

1412
if TYPE_CHECKING:
1513
from anndata import AnnData
1614

1715
from ._utils import Dataset, KeyX
1816

17+
from squidpy.gr import co_occurrence # type: ignore[attr-defined]
18+
1919
# setup variables
2020

2121

2222
adata: AnnData
2323
cluster_key: str | None
2424

2525

26-
def setup(dataset: Dataset, layer: KeyX, *_):
26+
def setup(dataset: Dataset, layer: KeyX, *_) -> None: # type: ignore[no-untyped-def]
2727
"""Set up global variables before each benchmark."""
2828
global adata, cluster_key
2929
adata, cluster_key = get_dataset(dataset, layer=layer)
@@ -42,9 +42,9 @@ def setup(dataset: Dataset, layer: KeyX, *_):
4242
skip_when = param_skipper(param_names, params)
4343

4444

45-
def time_co_occurrence(*_):
46-
sq.gr.co_occurrence(adata, cluster_key=cluster_key)
45+
def time_co_occurrence(*_) -> None: # type: ignore[no-untyped-def]
46+
co_occurrence(adata, cluster_key=cluster_key)
4747

4848

49-
def peakmem_co_occurrence(*_):
50-
sq.gr.co_occurrence(adata, cluster_key=cluster_key)
49+
def peakmem_co_occurrence(*_) -> None: # type: ignore[no-untyped-def]
50+
co_occurrence(adata, cluster_key=cluster_key)

0 commit comments

Comments
 (0)