Skip to content

Commit

Permalink
more corrections to multior
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Aug 29, 2018
1 parent 84e789e commit e771e2a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions glue/core/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,8 @@ class MultiOrState(SubsetState):
A state for many states to be or'd together.
"""

op = operator.or_

def __init__(self, states):
super(CompositeSubsetState, self).__init__()
super(MultiOrState, self).__init__()
assert len(states) > 1
self.states = states

Expand All @@ -1149,16 +1147,14 @@ def attributes(self):
@memoize
@contract(data='isinstance(Data)', view='array_view')
def to_mask(self, data, view=None):
result = self.op(self.states[0],
self.states[1])
result = operator.or_(self.states[0], self.states[1])
if len(self.states) > 2:
for state in self.states[2:]:
result = self.op(result, state)
return result
result = operator.or_(result, state)
return result.to_mask(data, view=view)

def __str__(self):
sym = OPSYM.get(self.op, self.op)
return "(%s of many states)" % (sym)
return "('or' combination of many states)"


class OrState(CompositeSubsetState):
Expand Down

0 comments on commit e771e2a

Please sign in to comment.