Skip to content

IDEs resolves ops #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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__ = \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can't add tests, let's at least add a comment noting why we added this (otherwise it's likely to do away when someone refactors)

__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."""
Expand Down
4 changes: 4 additions & 0 deletions xarray/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,7 @@ def hashable(v):
except TypeError:
return False
return True
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW all tests pass if this function is replaced with isinstance(v, Hashable) (but I don't think worth changing given the risks, even if it seems to work)



def not_implemented(*args, **kwargs):
return NotImplemented