Skip to content

[pre-commit.ci] pre-commit autoupdate #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions cf_xarray/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,17 +721,15 @@ def _getitem(
accessor: CFAccessor,
key: Hashable,
skip: list[Literal["coords", "measures"]] | None = None,
) -> DataArray:
...
) -> DataArray: ...


@overload
def _getitem(
accessor: CFAccessor,
key: Iterable[Hashable],
skip: list[Literal["coords", "measures"]] | None = None,
) -> Dataset:
...
) -> Dataset: ...


def _getitem(
Expand Down
1 change: 1 addition & 0 deletions cf_xarray/coding.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions cf_xarray/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]

Expand Down
6 changes: 3 additions & 3 deletions cf_xarray/tests/test_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions cf_xarray/units.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to provide unit support via pint approximating UDUNITS/CF."""

import functools
import re

Expand Down
Loading