From bddb1f3aedda7f6514e95715b3dd72e370cc3450 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 22:43:12 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#852) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- docs/_ext/typed_returns.py | 2 +- ehrapy/_settings.py | 4 ++-- ehrapy/anndata/_feature_specifications.py | 2 +- ehrapy/core/meta_information.py | 2 +- ehrapy/plot/_scanpy_pl_api.py | 10 ++++++++-- tests/preprocessing/test_quality_control.py | 6 +++--- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61fd4955..0d2a7f34 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: hooks: - id: prettier - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes] diff --git a/docs/_ext/typed_returns.py b/docs/_ext/typed_returns.py index 1ed85771..f625eff5 100644 --- a/docs/_ext/typed_returns.py +++ b/docs/_ext/typed_returns.py @@ -10,7 +10,7 @@ def _process_return(lines: Iterable[str]) -> Iterator[str]: m = re.fullmatch(r"(?P\w+)\s+:\s+(?P[\w.]+)", line) if m: # Once this is in scanpydoc, we can use the fancy hover stuff - yield f'**{m["param"]}** : :class:`~{m["type"]}`' + yield f"**{m['param']}** : :class:`~{m['type']}`" else: yield line diff --git a/ehrapy/_settings.py b/ehrapy/_settings.py index f733c059..e9ddfe73 100644 --- a/ehrapy/_settings.py +++ b/ehrapy/_settings.py @@ -144,7 +144,7 @@ def file_format_data(self, file_format: str): _type_check(file_format, "file_format_data", str) file_format_options = {"csv", "h5ad"} if file_format not in file_format_options: - raise ValueError(f"Cannot set file_format_data to {file_format}. " f"Must be one of {file_format_options}") + raise ValueError(f"Cannot set file_format_data to {file_format}. Must be one of {file_format_options}") self._file_format_data = file_format @property @@ -237,7 +237,7 @@ def cache_compression(self) -> str | None: @cache_compression.setter def cache_compression(self, cache_compression: str | None): if cache_compression not in {"lzf", "gzip", None}: - raise ValueError(f"`cache_compression` ({cache_compression}) " "must be in {'lzf', 'gzip', None}") + raise ValueError(f"`cache_compression` ({cache_compression}) must be in {{'lzf', 'gzip', None}}") self._cache_compression = cache_compression @property diff --git a/ehrapy/anndata/_feature_specifications.py b/ehrapy/anndata/_feature_specifications.py index fdebb9ff..e3b8c2d7 100644 --- a/ehrapy/anndata/_feature_specifications.py +++ b/ehrapy/anndata/_feature_specifications.py @@ -113,7 +113,7 @@ def infer_feature_types( if verbose: logger.warning( - f"{'Features' if len(uncertain_features) >1 else 'Feature'} {str(uncertain_features)[1:-1]} {'were' if len(uncertain_features) >1 else 'was'} detected as categorical features stored numerically." + f"{'Features' if len(uncertain_features) > 1 else 'Feature'} {str(uncertain_features)[1:-1]} {'were' if len(uncertain_features) > 1 else 'was'} detected as categorical features stored numerically." f"Please verify and correct using `ep.ad.replace_feature_types` if necessary." ) diff --git a/ehrapy/core/meta_information.py b/ehrapy/core/meta_information.py index b08ba1ea..d9f702b2 100644 --- a/ehrapy/core/meta_information.py +++ b/ehrapy/core/meta_information.py @@ -23,7 +23,7 @@ def print_version_and_date(*, file=None): # pragma: no cover if file is None: file = sys.stdout print( - f"Running ehrapy {__version__}, " f"on {datetime.now():%Y-%m-%d %H:%M}.", + f"Running ehrapy {__version__}, on {datetime.now():%Y-%m-%d %H:%M}.", file=file, ) diff --git a/ehrapy/plot/_scanpy_pl_api.py b/ehrapy/plot/_scanpy_pl_api.py index 81791036..73272fe3 100644 --- a/ehrapy/plot/_scanpy_pl_api.py +++ b/ehrapy/plot/_scanpy_pl_api.py @@ -1188,7 +1188,10 @@ def tsne(adata, **kwargs) -> Axes | list[Axes] | None: # pragma: no cover .. image:: /_static/docstring_previews/tsne_1.png >>> ep.pl.tsne( - ... adata, color=["day_icu_intime", "service_unit"], wspace=0.5, title=["Day of ICU admission", "Service unit"] + ... adata, + ... color=["day_icu_intime", "service_unit"], + ... wspace=0.5, + ... title=["Day of ICU admission", "Service unit"], ... ) .. image:: /_static/docstring_previews/tsne_2.png @@ -1233,7 +1236,10 @@ def umap(adata: AnnData, **kwargs) -> Axes | list[Axes] | None: # pragma: no co .. image:: /_static/docstring_previews/umap_1.png >>> ep.pl.umap( - ... adata, color=["day_icu_intime", "service_unit"], wspace=0.5, title=["Day of ICU admission", "Service unit"] + ... adata, + ... color=["day_icu_intime", "service_unit"], + ... wspace=0.5, + ... title=["Day of ICU admission", "Service unit"], ... ) .. image:: /_static/docstring_previews/umap_2.png diff --git a/tests/preprocessing/test_quality_control.py b/tests/preprocessing/test_quality_control.py index eeff849e..dee27b3c 100644 --- a/tests/preprocessing/test_quality_control.py +++ b/tests/preprocessing/test_quality_control.py @@ -200,9 +200,9 @@ def test_qc_lab_measurements_multiple_measurements(): def test_mcar_test_method_output_types(mar_adata, method, expected_output_type): """Tests if mcar_test returns the correct output type for different methods.""" output = mcar_test(mar_adata, method=method) - assert isinstance( - output, expected_output_type - ), f"Output type for method '{method}' should be {expected_output_type}, got {type(output)} instead." + assert isinstance(output, expected_output_type), ( + f"Output type for method '{method}' should be {expected_output_type}, got {type(output)} instead." + ) def test_mar_data_identification(mar_adata):