def __contains__(self, item): """ item can either be unix time or any object with 'a' and 'b' unix time attributes (e.g. a Interval) """ if is_unix_time(item): return self.a <= item <= self.b return self.a <= item.a and self.b <= item.b
def __contains__(self, item): """ item can either be unix time or any object with 'a' and 'b' unix time attributes (e.g. an Interval) """ if is_unix_time(item): return self.a <= item and self.b >= item return self.a <= item.a and self.b <= item.b
def is_time_interval(item): return hasattr(item, 'a') and hasattr( item, 'b') and is_unix_time(item.a) and is_unix_time(item.b) and item.a < item.b
def is_time_interval(item): return ( hasattr(item, "a") and hasattr(item, "b") and is_unix_time(item.a) and is_unix_time(item.b) and item.a < item.b )