2020:func:`neo.core.container.filter()` to perform specific filtering operations on data.
2121"""
2222from abc import ABC , abstractmethod
23+ from numbers import Number
2324
2425class FilterCondition (ABC ):
2526 """
@@ -131,6 +132,10 @@ def __init__(self, z):
131132 def evaluate (self , x ):
132133 if isinstance (self .control , list ):
133134 return x in self .control
135+ if isinstance (self .control , tuple ):
136+ return x in self .control
137+ if isinstance (self .control , set ):
138+ return x in self .control
134139 if isinstance (self .control , int ):
135140 return x == self .control
136141
@@ -151,8 +156,8 @@ class InRange(FilterCondition):
151156 right_closed: bool - If True, the range includes the upper bound (x <= upper_bound).
152157 """
153158 def __init__ (self , lower_bound , upper_bound , left_closed = False , right_closed = False ):
154- if not isinstance (lower_bound , int ) or not isinstance (upper_bound , int ):
155- raise SyntaxError ( "parameters not of type int " )
159+ if not isinstance (lower_bound , Number ) or not isinstance (upper_bound , Number ):
160+ raise ValueError ( "parameter is not a number " )
156161
157162 self .lower_bound = lower_bound
158163 self .upper_bound = upper_bound
0 commit comments