Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 8, 2023
1 parent 292dd4c commit f03a588
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
4 changes: 1 addition & 3 deletions anndata/_core/file_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def __iter__(self) -> Iterator[str]:
def __getitem__(self, key: str) -> h5py.Group | h5py.Dataset | SparseDataset:
return self._file[key]

def __setitem__(
self, key: str, value: h5py.Group | h5py.Dataset | SparseDataset
):
def __setitem__(self, key: str, value: h5py.Group | h5py.Dataset | SparseDataset):
self._file[key] = value

def __delitem__(self, key: str):
Expand Down
8 changes: 7 additions & 1 deletion anndata/_core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def _normalize_indices(


def _normalize_index(
indexer: slice | np.integer | int | str | Sequence[int | np.integer] | np.ndarray | pd.Index,
indexer: slice
| np.integer
| int
| str
| Sequence[int | np.integer]
| np.ndarray
| pd.Index,
index: pd.Index,
) -> slice | int | np.ndarray: # ndarray of int
if not isinstance(index, pd.RangeIndex):
Expand Down
2 changes: 1 addition & 1 deletion anndata/_core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def merge_only(ds: Collection[Mapping]) -> Mapping:


def resolve_merge_strategy(
strategy: str | Callable | None
strategy: str | Callable | None,
) -> Callable[[Collection[Mapping]], Mapping]:
if not isinstance(strategy, Callable):
strategy = MERGE_STRATEGIES[strategy]
Expand Down
4 changes: 1 addition & 3 deletions anndata/_io/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def read_csv(
return read_text(filename, delimiter, first_column_names, dtype)


def read_excel(
filename: PathLike, sheet: str | int, dtype: str = "float32"
) -> AnnData:
def read_excel(filename: PathLike, sheet: str | int, dtype: str = "float32") -> AnnData:
"""\
Read `.xlsx` (Excel) file.
Expand Down
21 changes: 10 additions & 11 deletions anndata/_io/specs/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ def get_spec(


class Reader:
def __init__(
self, registry: IORegistry, callback: Callable | None = None
) -> None:
def __init__(self, registry: IORegistry, callback: Callable | None = None) -> None:
self.registry = registry
self.callback = callback

Expand Down Expand Up @@ -244,14 +242,15 @@ def __init__(
self,
registry: IORegistry,
callback: Callable[
[
GroupStorageType,
str,
StorageType,
dict,
],
None,
] | None = None,
[
GroupStorageType,
str,
StorageType,
dict,
],
None,
]
| None = None,
):
self.registry = registry
self.callback = callback
Expand Down
4 changes: 3 additions & 1 deletion anndata/experimental/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ def concat_on_disk(
axis: Literal[0, 1] = 0,
join: Literal["inner", "outer"] = "inner",
merge: StrategiesLiteral | Callable[[Collection[Mapping]], Mapping] | None = None,
uns_merge: StrategiesLiteral | Callable[[Collection[Mapping]], Mapping] | None = None,
uns_merge: StrategiesLiteral
| Callable[[Collection[Mapping]], Mapping]
| None = None,
label: str | None = None,
keys: Collection[str] | None = None,
index_unique: str | None = None,
Expand Down
4 changes: 1 addition & 3 deletions anndata/tests/test_transpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ def test_transposed_contents(adata):
else:
assert adata.X is t.X is None

assert_equal(
{k: v.T for k, v in adata.layers.items()}, dict(t.layers.items())
)
assert_equal({k: v.T for k, v in adata.layers.items()}, dict(t.layers.items()))
assert_equal(adata.obs, t.var)
assert_equal(adata.var, t.obs)
assert_equal(dict(adata.obsm), dict(t.varm))
Expand Down

0 comments on commit f03a588

Please sign in to comment.