diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47ba8a26..44b73189 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,20 +3,20 @@ ci: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: ["--py39-plus"] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.1.9' + rev: 'v0.3.5' hooks: - id: ruff args: ["--show-fixes", "--fix"] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 + rev: 24.3.0 hooks: - id: black @@ -36,7 +36,7 @@ repos: - mdformat-myst - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.1 + rev: 1.8.5 hooks: - id: nbqa-black - id: nbqa-ruff @@ -67,7 +67,7 @@ repos: - id: validate-cff - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.15 + rev: v0.16 hooks: - id: validate-pyproject diff --git a/cf_xarray/accessor.py b/cf_xarray/accessor.py index a10c4886..5dd71a52 100644 --- a/cf_xarray/accessor.py +++ b/cf_xarray/accessor.py @@ -721,8 +721,7 @@ def _getitem( accessor: CFAccessor, key: Hashable, skip: list[Literal["coords", "measures"]] | None = None, -) -> DataArray: - ... +) -> DataArray: ... @overload @@ -730,8 +729,7 @@ def _getitem( accessor: CFAccessor, key: Iterable[Hashable], skip: list[Literal["coords", "measures"]] | None = None, -) -> Dataset: - ... +) -> Dataset: ... def _getitem( diff --git a/cf_xarray/coding.py b/cf_xarray/coding.py index 529db1f2..282eaf8f 100644 --- a/cf_xarray/coding.py +++ b/cf_xarray/coding.py @@ -1,6 +1,7 @@ """ Encoders and decoders for CF conventions not implemented by Xarray. """ + import numpy as np import pandas as pd import xarray as xr diff --git a/cf_xarray/formatting.py b/cf_xarray/formatting.py index bd5430e4..f99e95bc 100644 --- a/cf_xarray/formatting.py +++ b/cf_xarray/formatting.py @@ -110,9 +110,11 @@ def _print_rows(subtitle: str, rows: list[str], rich: bool): # Add subtitle to the first row, align other rows rows = [ - _format_subtitle(subtitle, rich=rich) + row - if i == 0 - else len(subtitle) * " " + row + ( + _format_subtitle(subtitle, rich=rich) + row + if i == 0 + else len(subtitle) * " " + row + ) for i, row in enumerate(rows) ] diff --git a/cf_xarray/tests/test_accessor.py b/cf_xarray/tests/test_accessor.py index 60a68114..147e9686 100644 --- a/cf_xarray/tests/test_accessor.py +++ b/cf_xarray/tests/test_accessor.py @@ -1454,9 +1454,9 @@ def test_rename(obj): "air_temperature" if isinstance(obj, Dataset) else "longitude": "renamed" } xr_dict = { - "air" - if isinstance(obj, Dataset) and "air" in obj.data_vars - else "lon": "renamed" + ( + "air" if isinstance(obj, Dataset) and "air" in obj.data_vars else "lon" + ): "renamed" } assert_identical(obj.rename(xr_dict), obj.cf.rename(cf_dict)) assert_identical(obj.rename(**xr_dict), obj.cf.rename(**cf_dict)) diff --git a/cf_xarray/units.py b/cf_xarray/units.py index dea7d6b5..1ec75cbb 100644 --- a/cf_xarray/units.py +++ b/cf_xarray/units.py @@ -1,4 +1,5 @@ """Module to provide unit support via pint approximating UDUNITS/CF.""" + import functools import re