|
6 | 6 | import re |
7 | 7 | import warnings |
8 | 8 | from collections import ChainMap, namedtuple |
| 9 | +from collections.abc import Hashable, Iterable, Mapping, MutableMapping, Sequence |
9 | 10 | from datetime import datetime |
10 | 11 | from typing import ( |
11 | 12 | Any, |
12 | 13 | Callable, |
13 | | - Hashable, |
14 | | - Iterable, |
15 | | - List, |
16 | | - Mapping, |
17 | | - MutableMapping, |
18 | | - Sequence, |
19 | 14 | TypeVar, |
20 | 15 | Union, |
21 | 16 | cast, |
|
84 | 79 | ATTRS["vertical"] = ATTRS["Z"] |
85 | 80 |
|
86 | 81 | # Type for Mapper functions |
87 | | -Mapper = Callable[[Union[DataArray, Dataset], Hashable], List[Hashable]] |
| 82 | +Mapper = Callable[[Union[DataArray, Dataset], Hashable], list[Hashable]] |
88 | 83 |
|
89 | 84 | # Type for decorators |
90 | 85 | F = TypeVar("F", bound=Callable[..., Any]) |
@@ -496,7 +491,7 @@ def _get_coords(obj: DataArray | Dataset, key: Hashable) -> list[Hashable]: |
496 | 491 | def _variables(func: F) -> F: |
497 | 492 | @functools.wraps(func) |
498 | 493 | def wrapper(obj: DataArray | Dataset, key: Hashable) -> list[DataArray]: |
499 | | - return [obj[k] for k in func(obj, key)] # type: ignore |
| 494 | + return [obj[k] for k in func(obj, key)] # type: ignore[misc] |
500 | 495 |
|
501 | 496 | return cast(F, wrapper) |
502 | 497 |
|
@@ -1293,7 +1288,7 @@ def _process_signature( |
1293 | 1288 | This uses ``key_mappers`` |
1294 | 1289 | 3. Unpacks arguments if necessary before returning them. |
1295 | 1290 | """ |
1296 | | - sig = inspect.signature(func, follow_wrapped=False) |
| 1291 | + sig = inspect.signature(func, follow_wrapped=True) |
1297 | 1292 |
|
1298 | 1293 | # Catch things like .isel(T=5). |
1299 | 1294 | # This assigns indexers_kwargs=dict(T=5). |
|
0 commit comments