Skip to content

Commit

Permalink
Fix DataArray.to_netcdf type annotation (#3325)
Browse files Browse the repository at this point in the history
It calls DataSet.to_netcdf, which returns Union[bytes, "Delayed", None].  So this should as well.
  • Loading branch information
Tony Tung authored and shoyer committed Sep 27, 2019
1 parent 16fdac9 commit 6ece6a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@ def to_masked_array(self, copy: bool = True) -> np.ma.MaskedArray:
isnull = pd.isnull(values)
return np.ma.MaskedArray(data=values, mask=isnull, copy=copy)

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

0 comments on commit 6ece6a1

Please sign in to comment.