Skip to content

Commit 3407d29

Browse files
Update and fix linters (rstcheck,mypy,pre-commit) (#387)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/PyCQA/isort: 5.10.1 → 5.11.4](PyCQA/isort@5.10.1...5.11.4) - [github.com/psf/black: 22.8.0 → 22.12.0](psf/black@22.8.0...22.12.0) - [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](PyCQA/flake8@5.0.4...6.0.0) - [github.com/pre-commit/mirrors-mypy: v0.981 → v0.991](pre-commit/mirrors-mypy@v0.981...v0.991) - [github.com/rstcheck/rstcheck: v5.0.0 → v6.1.1](rstcheck/rstcheck@v5.0.0...v6.1.1) - [github.com/nbQA-dev/nbQA: 1.5.2 → 1.6.0](nbQA-dev/nbQA@1.5.2...1.6.0) - [github.com/asottile/pyupgrade: v2.38.2 → v3.3.1](asottile/pyupgrade@v2.38.2...v3.3.1) - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](pre-commit/pre-commit-hooks@v4.3.0...v4.4.0) - [github.com/keewis/blackdoc: v0.3.7 → v0.3.8](keewis/blackdoc@v0.3.7...v0.3.8) * Explicit None typing * Fix rstcheck * Update typnig Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Deepak Cherian <[email protected]> Co-authored-by: dcherian <[email protected]>
1 parent 1b373a2 commit 3407d29

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ ci:
33

44
repos:
55
- repo: https://github.com/PyCQA/isort
6-
rev: 5.10.1
6+
rev: 5.11.4
77
hooks:
88
- id: isort
99
files: .+\.py$
1010

1111
- repo: https://github.com/psf/black
12-
rev: 22.8.0
12+
rev: 22.12.0
1313
hooks:
1414
- id: black
1515

1616
- repo: https://github.com/PyCQA/flake8
17-
rev: 5.0.4
17+
rev: 6.0.0
1818
hooks:
1919
- id: flake8
2020

2121
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v0.981
22+
rev: v0.991
2323
hooks:
2424
- id: mypy
2525
additional_dependencies: [types-all]
2626

2727
- repo: https://github.com/rstcheck/rstcheck
28-
rev: v5.0.0
28+
rev: v6.1.1
2929
hooks:
3030
- id: rstcheck
3131
additional_dependencies: [sphinx]
@@ -39,7 +39,7 @@ repos:
3939
- mdformat-myst
4040

4141
- repo: https://github.com/nbQA-dev/nbQA
42-
rev: 1.5.2
42+
rev: 1.6.0
4343
hooks:
4444
- id: nbqa-black
4545
- id: nbqa-pyupgrade
@@ -52,22 +52,22 @@ repos:
5252
additional_dependencies: [mdformat==0.7.14]
5353

5454
- repo: https://github.com/asottile/pyupgrade
55-
rev: v2.38.2
55+
rev: v3.3.1
5656
hooks:
5757
- id: pyupgrade
5858
args:
5959
- "--py37-plus"
6060

6161
- repo: https://github.com/pre-commit/pre-commit-hooks
62-
rev: v4.3.0
62+
rev: v4.4.0
6363
hooks:
6464
- id: trailing-whitespace
6565
- id: end-of-file-fixer
6666
- id: check-toml
6767
- id: check-yaml
6868

6969
- repo: https://github.com/keewis/blackdoc
70-
rev: v0.3.7
70+
rev: v0.3.8
7171
hooks:
7272
- id: blackdoc
7373
files: .+\.py$

cf_xarray/accessor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def _getattr(
522522
accessor: CFAccessor,
523523
key_mappers: Mapping[str, Mapper],
524524
wrap_classes: bool = False,
525-
extra_decorator: Callable = None,
525+
extra_decorator: Callable | None = None,
526526
):
527527
"""
528528
Common getattr functionality.
@@ -613,7 +613,7 @@ def wrapper(*args, **kwargs):
613613

614614

615615
def _getitem(
616-
accessor: CFAccessor, key: str | list[str], skip: list[str] = None
616+
accessor: CFAccessor, key: str | list[str], skip: list[str] | None = None
617617
) -> DataArray | Dataset:
618618
"""
619619
Index into obj using key. Attaches CF associated variables.
@@ -1081,12 +1081,12 @@ def curvefit(
10811081
self,
10821082
coords: str | DataArray | Iterable[str | DataArray],
10831083
func: Callable[..., Any],
1084-
reduce_dims: Hashable | Iterable[Hashable] = None,
1084+
reduce_dims: Hashable | Iterable[Hashable] | None = None,
10851085
skipna: bool = True,
1086-
p0: dict[str, Any] = None,
1087-
bounds: dict[str, Any] = None,
1088-
param_names: Sequence[str] = None,
1089-
kwargs: dict[str, Any] = None,
1086+
p0: dict[str, Any] | None = None,
1087+
bounds: dict[str, Any] | None = None,
1088+
param_names: Sequence[str] | None = None,
1089+
kwargs: dict[str, Any] | None = None,
10901090
):
10911091

10921092
if coords is not None:

cf_xarray/geometry.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from typing import Sequence, Union
1+
from __future__ import annotations
2+
3+
from typing import Sequence
24

35
import numpy as np
46
import pandas as pd
@@ -69,7 +71,7 @@ def reshape_unique_geometries(
6971
return out
7072

7173

72-
def shapely_to_cf(geometries: Union[xr.DataArray, Sequence], grid_mapping: str = None):
74+
def shapely_to_cf(geometries: xr.DataArray | Sequence, grid_mapping: str | None = None):
7375
"""Convert a DataArray with shapely geometry objects into a CF-compliant dataset.
7476
7577
.. warning::
@@ -171,7 +173,7 @@ def cf_to_shapely(ds: xr.Dataset):
171173
return geometries.rename("geometry")
172174

173175

174-
def points_to_cf(pts: Union[xr.DataArray, Sequence]):
176+
def points_to_cf(pts: xr.DataArray | Sequence):
175177
"""Get a list of points (shapely.geometry.[Multi]Point) and return a CF-compliant geometry dataset.
176178
177179
Parameters

doc/whats-new.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ v0.1.3
194194
.. _`Julia Kent`: https://github.com/jukent
195195
.. _`Kristen Thyng`: https://github.com/kthyng
196196
.. _`Julius Busecke`: https://github.com/jbusecke
197-
.. _`Filipe Fernandes`: https://github.com/ocefpaf
198197
.. _`Tom Vo`: https://github.com/tomvothecoder
199198
.. _`Romain Caneill`: https://github.com/rcaneill
200199
.. _`Lars Buntemeyer`: https://github.com/larsbuntemeyer

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test = pytest
117117
nobeep = True
118118

119119
[rstcheck]
120-
report=warning
120+
report_level=warning
121121
ignore_roles=pr,issue,py:meth,py:attr
122-
ignore_directives=ipython,autodata,csv-table
122+
ignore_directives=ipython,autodata,csv-table,autosummary
123123
ignore_messages=(is not referenced\.$)

0 commit comments

Comments
 (0)