Skip to content

Commit 6ece6a1

Browse files
Tony Tungshoyer
Tony Tung
authored andcommitted
Fix DataArray.to_netcdf type annotation (#3325)
It calls DataSet.to_netcdf, which returns Union[bytes, "Delayed", None]. So this should as well.
1 parent 16fdac9 commit 6ece6a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xarray/core/dataarray.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ def to_masked_array(self, copy: bool = True) -> np.ma.MaskedArray:
22442244
isnull = pd.isnull(values)
22452245
return np.ma.MaskedArray(data=values, mask=isnull, copy=copy)
22462246

2247-
def to_netcdf(self, *args, **kwargs) -> Optional["Delayed"]:
2247+
def to_netcdf(self, *args, **kwargs) -> Union[bytes, "Delayed", None]:
22482248
"""Write DataArray contents to a netCDF file.
22492249
22502250
All parameters are passed directly to `xarray.Dataset.to_netcdf`.

0 commit comments

Comments
 (0)