File tree 4 files changed +123
-9
lines changed
4 files changed +123
-9
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ Bug fixes
87
87
- Fix a regression in :py:meth: `Dataset.drop `: allow passing any
88
88
iterable when dropping variables (:issue: `3552 `, :pull: `3693 `)
89
89
By `Justus Magin <https://github.com/keewis >`_.
90
+ - Fixed errors emitted by ``mypy --strict `` in modules that import xarray.
91
+ (:issue: `3695 `) by `Guido Imperiale <https://github.com/crusaderky >`_.
90
92
91
93
Documentation
92
94
~~~~~~~~~~~~~
Original file line number Diff line number Diff line change 1
1
""" isort:skip_file """
2
- # flake8: noqa
3
2
4
3
from ._version import get_versions
5
4
42
41
from . import testing
43
42
44
43
from .core .common import ALL_DIMS
44
+
45
+ # A hardcoded __all__ variable is necessary to appease
46
+ # `mypy --strict` running in projects that import xarray.
47
+ __all__ = (
48
+ # Sub-packages
49
+ "ufuncs" ,
50
+ "testing" ,
51
+ "tutorial" ,
52
+ # Top-level functions
53
+ "align" ,
54
+ "apply_ufunc" ,
55
+ "as_variable" ,
56
+ "auto_combine" ,
57
+ "broadcast" ,
58
+ "cftime_range" ,
59
+ "combine_by_coords" ,
60
+ "combine_nested" ,
61
+ "concat" ,
62
+ "decode_cf" ,
63
+ "dot" ,
64
+ "full_like" ,
65
+ "load_dataarray" ,
66
+ "load_dataset" ,
67
+ "map_blocks" ,
68
+ "merge" ,
69
+ "ones_like" ,
70
+ "open_dataarray" ,
71
+ "open_dataset" ,
72
+ "open_mfdataset" ,
73
+ "open_rasterio" ,
74
+ "open_zarr" ,
75
+ "register_dataarray_accessor" ,
76
+ "register_dataset_accessor" ,
77
+ "save_mfdataset" ,
78
+ "set_options" ,
79
+ "show_versions" ,
80
+ "where" ,
81
+ "zeros_like" ,
82
+ # Classes
83
+ "CFTimeIndex" ,
84
+ "Coordinate" ,
85
+ "DataArray" ,
86
+ "Dataset" ,
87
+ "IndexVariable" ,
88
+ "Variable" ,
89
+ # Exceptions
90
+ "MergeError" ,
91
+ "SerializationWarning" ,
92
+ # Constants
93
+ "__version__" ,
94
+ "ALL_DIMS" ,
95
+ )
Original file line number Diff line number Diff line change 10
10
from xarray .core .indexes import default_indexes
11
11
from xarray .core .variable import IndexVariable , Variable
12
12
13
+ __all__ = (
14
+ "assert_allclose" ,
15
+ "assert_chunks_equal" ,
16
+ "assert_equal" ,
17
+ "assert_identical" ,
18
+ )
19
+
13
20
14
21
def _decode_string_data (data ):
15
22
if data .dtype .kind == "S" :
Original file line number Diff line number Diff line change @@ -132,14 +132,68 @@ def _create_op(name):
132
132
return func
133
133
134
134
135
- __all__ = """logaddexp logaddexp2 conj exp log log2 log10 log1p expm1 sqrt
136
- square sin cos tan arcsin arccos arctan arctan2 hypot sinh cosh
137
- tanh arcsinh arccosh arctanh deg2rad rad2deg logical_and
138
- logical_or logical_xor logical_not maximum minimum fmax fmin
139
- isreal iscomplex isfinite isinf isnan signbit copysign nextafter
140
- ldexp fmod floor ceil trunc degrees radians rint fix angle real
141
- imag fabs sign frexp fmod
142
- """ .split ()
135
+ __all__ = ( # noqa: F822
136
+ "angle" ,
137
+ "arccos" ,
138
+ "arccosh" ,
139
+ "arcsin" ,
140
+ "arcsinh" ,
141
+ "arctan" ,
142
+ "arctan2" ,
143
+ "arctanh" ,
144
+ "ceil" ,
145
+ "conj" ,
146
+ "copysign" ,
147
+ "cos" ,
148
+ "cosh" ,
149
+ "deg2rad" ,
150
+ "degrees" ,
151
+ "exp" ,
152
+ "expm1" ,
153
+ "fabs" ,
154
+ "fix" ,
155
+ "floor" ,
156
+ "fmax" ,
157
+ "fmin" ,
158
+ "fmod" ,
159
+ "fmod" ,
160
+ "frexp" ,
161
+ "hypot" ,
162
+ "imag" ,
163
+ "iscomplex" ,
164
+ "isfinite" ,
165
+ "isinf" ,
166
+ "isnan" ,
167
+ "isreal" ,
168
+ "ldexp" ,
169
+ "log" ,
170
+ "log10" ,
171
+ "log1p" ,
172
+ "log2" ,
173
+ "logaddexp" ,
174
+ "logaddexp2" ,
175
+ "logical_and" ,
176
+ "logical_not" ,
177
+ "logical_or" ,
178
+ "logical_xor" ,
179
+ "maximum" ,
180
+ "minimum" ,
181
+ "nextafter" ,
182
+ "rad2deg" ,
183
+ "radians" ,
184
+ "real" ,
185
+ "rint" ,
186
+ "sign" ,
187
+ "signbit" ,
188
+ "sin" ,
189
+ "sinh" ,
190
+ "sqrt" ,
191
+ "square" ,
192
+ "tan" ,
193
+ "tanh" ,
194
+ "trunc" ,
195
+ )
196
+
143
197
144
198
for name in __all__ :
145
199
globals ()[name ] = _create_op (name )
You can’t perform that action at this time.
0 commit comments