Skip to content

Commit 790a444

Browse files
authored
Add type hint Self (#6923)
1 parent ba83f65 commit 790a444

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

xarray/core/types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@
1818
except ImportError:
1919
DaskArray = np.ndarray # type: ignore
2020

21+
# TODO: Turn on when https://github.com/python/mypy/issues/11871 is fixed.
22+
# Can be uncommented if using pyright though.
23+
# import sys
24+
25+
# try:
26+
# if sys.version_info >= (3, 11):
27+
# from typing import Self
28+
# else:
29+
# from typing_extensions import Self
30+
# except ImportError:
31+
# Self: Any = None
32+
Self: Any = None
33+
else:
34+
Self: Any = None
2135

2236
T_Dataset = TypeVar("T_Dataset", bound="Dataset")
2337
T_DataArray = TypeVar("T_DataArray", bound="DataArray")

0 commit comments

Comments
 (0)