Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions-1846917ea7
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty authored Feb 6, 2024
2 parents 7fec322 + 6180152 commit b37982b
Show file tree
Hide file tree
Showing 61 changed files with 403 additions and 574 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ repos:
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.9'
rev: 'v0.2.0'
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black-jupyter
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
exclude: "generate_aggregations.py"
additional_dependencies: ["black==23.12.1"]
additional_dependencies: ["black==24.1.1"]
- id: blackdoc-autoupdate-black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
6 changes: 2 additions & 4 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ typically find tests wrapped in a class.

.. code-block:: python
class TestReallyCoolFeature:
...
class TestReallyCoolFeature: ...
Going forward, we are moving to a more *functional* style using the
`pytest <http://doc.pytest.org/en/latest/>`__ framework, which offers a richer
Expand All @@ -680,8 +679,7 @@ writing test classes, we will write test functions like this:

.. code-block:: python
def test_really_cool_feature():
...
def test_really_cool_feature(): ...
Using ``pytest``
~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion doc/gallery/plot_cartopy_facetgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
.. _this discussion: https://github.com/pydata/xarray/issues/1397#issuecomment-299190567
"""


import cartopy.crs as ccrs
import matplotlib.pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions doc/gallery/plot_control_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Use ``cbar_kwargs`` keyword to specify the number of ticks.
The ``spacing`` kwarg can be used to draw proportional ticks.
"""

import matplotlib.pyplot as plt

import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions properties/test_encode_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
These ones pass, just as you'd hope!
"""

import pytest

pytest.importorskip("hypothesis")
Expand Down
1 change: 1 addition & 0 deletions properties/test_pandas_roundtrip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Property-based tests for roundtripping between xarray and pandas objects.
"""

from functools import partial

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions xarray/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
DataStores provide a uniform interface for saving and loading data in different
formats. They should not be used directly, but rather through Dataset objects.
"""

from xarray.backends.common import AbstractDataStore, BackendArray, BackendEntrypoint
from xarray.backends.file_manager import (
CachingFileManager,
Expand Down
43 changes: 18 additions & 25 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,13 +791,15 @@ def open_dataarray(
def open_mfdataset(
paths: str | NestedSequence[str | os.PathLike],
chunks: T_Chunks | None = None,
concat_dim: str
| DataArray
| Index
| Sequence[str]
| Sequence[DataArray]
| Sequence[Index]
| None = None,
concat_dim: (
str
| DataArray
| Index
| Sequence[str]
| Sequence[DataArray]
| Sequence[Index]
| None
) = None,
compat: CompatOptions = "no_conflicts",
preprocess: Callable[[Dataset], Dataset] | None = None,
engine: T_Engine | None = None,
Expand Down Expand Up @@ -1101,8 +1103,7 @@ def to_netcdf(
*,
multifile: Literal[True],
invalid_netcdf: bool = False,
) -> tuple[ArrayWriter, AbstractDataStore]:
...
) -> tuple[ArrayWriter, AbstractDataStore]: ...


# path=None writes to bytes
Expand All @@ -1119,8 +1120,7 @@ def to_netcdf(
compute: bool = True,
multifile: Literal[False] = False,
invalid_netcdf: bool = False,
) -> bytes:
...
) -> bytes: ...


# compute=False returns dask.Delayed
Expand All @@ -1138,8 +1138,7 @@ def to_netcdf(
compute: Literal[False],
multifile: Literal[False] = False,
invalid_netcdf: bool = False,
) -> Delayed:
...
) -> Delayed: ...


# default return None
Expand All @@ -1156,8 +1155,7 @@ def to_netcdf(
compute: Literal[True] = True,
multifile: Literal[False] = False,
invalid_netcdf: bool = False,
) -> None:
...
) -> None: ...


# if compute cannot be evaluated at type check time
Expand All @@ -1175,8 +1173,7 @@ def to_netcdf(
compute: bool = False,
multifile: Literal[False] = False,
invalid_netcdf: bool = False,
) -> Delayed | None:
...
) -> Delayed | None: ...


# if multifile cannot be evaluated at type check time
Expand All @@ -1194,8 +1191,7 @@ def to_netcdf(
compute: bool = False,
multifile: bool = False,
invalid_netcdf: bool = False,
) -> tuple[ArrayWriter, AbstractDataStore] | Delayed | None:
...
) -> tuple[ArrayWriter, AbstractDataStore] | Delayed | None: ...


# Any
Expand All @@ -1212,8 +1208,7 @@ def to_netcdf(
compute: bool = False,
multifile: bool = False,
invalid_netcdf: bool = False,
) -> tuple[ArrayWriter, AbstractDataStore] | bytes | Delayed | None:
...
) -> tuple[ArrayWriter, AbstractDataStore] | bytes | Delayed | None: ...


def to_netcdf(
Expand Down Expand Up @@ -1647,8 +1642,7 @@ def to_zarr(
zarr_version: int | None = None,
write_empty_chunks: bool | None = None,
chunkmanager_store_kwargs: dict[str, Any] | None = None,
) -> backends.ZarrStore:
...
) -> backends.ZarrStore: ...


# compute=False returns dask.Delayed
Expand All @@ -1671,8 +1665,7 @@ def to_zarr(
zarr_version: int | None = None,
write_empty_chunks: bool | None = None,
chunkmanager_store_kwargs: dict[str, Any] | None = None,
) -> Delayed:
...
) -> Delayed: ...


def to_zarr(
Expand Down
6 changes: 3 additions & 3 deletions xarray/backends/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class SerializableLock:
The creation of locks is itself not threadsafe.
"""

_locks: ClassVar[
WeakValueDictionary[Hashable, threading.Lock]
] = WeakValueDictionary()
_locks: ClassVar[WeakValueDictionary[Hashable, threading.Lock]] = (
WeakValueDictionary()
)
token: Hashable
lock: threading.Lock

Expand Down
1 change: 1 addition & 0 deletions xarray/coding/cftime_offsets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Time offset classes for use with cftime.datetime objects"""

# The offset classes and mechanisms for generating time ranges defined in
# this module were copied/adapted from those defined in pandas. See in
# particular the objects and methods defined in pandas.tseries.offsets
Expand Down
1 change: 1 addition & 0 deletions xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""DatetimeIndex analog for cftime.datetime objects"""

# The pandas.Index subclass defined here was copied and adapted for
# use with cftime.datetime objects based on the source code defining
# pandas.DatetimeIndex.
Expand Down
1 change: 1 addition & 0 deletions xarray/coding/frequencies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FrequencyInferer analog for cftime.datetime objects"""

# The infer_freq method and the _CFTimeFrequencyInferer
# subclass defined here were copied and adapted for
# use with cftime.datetime objects based on the source code in
Expand Down
1 change: 1 addition & 0 deletions xarray/coding/strings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Coders for strings."""

from __future__ import annotations

from functools import partial
Expand Down
1 change: 1 addition & 0 deletions xarray/coding/variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Coders for individual Variable objects."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions xarray/convert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Functions for converting to and from xarray objects
"""

from collections import Counter

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions xarray/core/_aggregations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixin classes with reduction operations."""

# This file was generated using xarray.util.generate_aggregations. Do not edit manually.

from __future__ import annotations
Expand Down
Loading

0 comments on commit b37982b

Please sign in to comment.