Skip to content

Commit

Permalink
Enable unsafe pre-commit fixes
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <lukas.heumos@posteo.net>
  • Loading branch information
Zethson committed Dec 14, 2023
1 parent 983a282 commit 3dcc9ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
rev: v0.1.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
23 changes: 13 additions & 10 deletions ehrapy/tools/feature_ranking/_rank_features_groups.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from __future__ import annotations

from collections.abc import Iterable
from typing import Literal, Optional, Union
from typing import TYPE_CHECKING, Literal, Optional, Union

import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData

from ehrapy.anndata import move_to_x
from ehrapy.preprocessing import encode
from ehrapy.tools import _method_options

if TYPE_CHECKING:
from anndata import AnnData

from ehrapy.tools import _method_options


def _merge_arrays(arrays: Iterable[Iterable], groups_order) -> np.recarray:
Expand Down Expand Up @@ -148,7 +151,7 @@ def _evaluate_categorical_features(
adata,
groupby,
group_names,
groups: Union[Literal["all"], Iterable[str]] = "all",
groups: Literal["all"] | Iterable[str] = "all",
reference: str = "rest",
categorical_method: _method_options._rank_features_groups_cat_method = "g-test",
pts=False,
Expand Down Expand Up @@ -296,20 +299,20 @@ def _check_columns_to_rank_dict(columns_to_rank):
def rank_features_groups(
adata: AnnData,
groupby: str,
groups: Union[Literal["all"], Iterable[str]] = "all",
groups: Literal["all"] | Iterable[str] = "all",
reference: str = "rest",
n_features: Optional[int] = None,
n_features: int | None = None,
rankby_abs: bool = False,
pts: bool = False,
key_added: Optional[str] = "rank_features_groups",
key_added: str | None = "rank_features_groups",
copy: bool = False,
num_cols_method: _method_options._rank_features_groups_method = None,
cat_cols_method: _method_options._rank_features_groups_cat_method = "g-test",
correction_method: _method_options._correction_method = "benjamini-hochberg",
tie_correct: bool = False,
layer: Optional[str] = None,
field_to_rank: Union[Literal["layer"], Literal["obs"], Literal["layer_and_obs"]] = "layer",
columns_to_rank: Union[dict[str, Iterable[str]], Literal["all"]] = "all",
layer: str | None = None,
field_to_rank: Literal["layer"] | Literal["obs"] | Literal["layer_and_obs"] = "layer",
columns_to_rank: dict[str, Iterable[str]] | Literal["all"] = "all",
**kwds,
) -> None: # pragma: no cover
"""Rank features for characterizing groups.
Expand Down

0 comments on commit 3dcc9ed

Please sign in to comment.