diff --git a/xarray/core/common.py b/xarray/core/common.py index ecf2946a636..eab28f2c6d1 100644 --- a/xarray/core/common.py +++ b/xarray/core/common.py @@ -3,7 +3,7 @@ from .pycompat import basestring, iteritems, suppress, dask_array_type from . import formatting -from .utils import SortedKeysDict +from .utils import SortedKeysDict, not_implemented class ImplementsArrayReduce(object): @@ -477,6 +477,12 @@ def where(self, cond): """ return self._where(cond) + # this has no runtime function - these are listed so IDEs know these methods + # are defined and don't warn on these operations + __lt__ = __le__ =__ge__ = __gt__ = __add__ = __sub__ = __mul__ = \ + __truediv__ = __floordiv__ = __mod__ = __pow__ = __and__ = __xor__ = \ + __or__ = __div__ = __eq__ = __ne__ = not_implemented + def squeeze(xarray_obj, dims, dim=None): """Squeeze the dims of an xarray object.""" diff --git a/xarray/core/utils.py b/xarray/core/utils.py index b27ae947e6b..76f1dc22577 100644 --- a/xarray/core/utils.py +++ b/xarray/core/utils.py @@ -431,3 +431,7 @@ def hashable(v): except TypeError: return False return True + + +def not_implemented(*args, **kwargs): + return NotImplemented