17
17
18
18
from anndata import AnnData
19
19
20
- C = TypeVar ("C" , bound = Callable )
20
+ C = TypeVar ("C" , bound = Callable ) # type: ignore[type-arg]
21
21
22
22
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]
24
24
25
25
Dataset = Literal ["imc" ]
26
26
KeyX = Literal [None , "off-axis" ]
27
27
28
28
29
29
@cache
30
30
def _imc () -> AnnData :
31
- adata = sq .datasets .imc ()
31
+ adata = sq .datasets .imc () # type: ignore[attr-defined]
32
32
assert isinstance (adata .X , np .ndarray )
33
33
assert not np .isfortran (adata .X )
34
34
@@ -39,7 +39,7 @@ def imc() -> AnnData:
39
39
return _imc ().copy ()
40
40
41
41
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]
43
43
if isinstance (x , csr_matrix ):
44
44
return x .tocsc ()
45
45
if isinstance (x , np .ndarray ):
@@ -87,13 +87,13 @@ def param_skipper(param_names: Sequence[str], params: tuple[Sequence[object], ..
87
87
88
88
"""
89
89
90
- def skip (** skipped : AbstractSet ) -> Callable [[C ], C ]:
90
+ def skip (** skipped : AbstractSet ) -> Callable [[C ], C ]: # type: ignore[type-arg]
91
91
skipped_combs = [
92
92
tuple (record .values ())
93
93
for record in (dict (zip (param_names , vals , strict = True )) for vals in itertools .product (* params ))
94
94
if any (v in skipped .get (n , set ()) for n , v in record .items ())
95
95
]
96
96
# 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]
98
98
99
99
return skip
0 commit comments