Override equality operator
This commit is contained in:
parent
51c3a31bb5
commit
096a6426db
@ -14,14 +14,19 @@ class TimeRange():
|
|||||||
if *type is None, don't use corresponding startvalue.
|
if *type is None, don't use corresponding startvalue.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, starttype: Optional[str], stoptype: Optional[str],
|
def __init__(self, starttype: Optional[str] = None, stoptype: Optional[str] = None,
|
||||||
startts: int, stopts: int):
|
startts: int = 0, stopts: int = 0):
|
||||||
|
|
||||||
self.starttype: Optional[str] = starttype
|
self.starttype: Optional[str] = starttype
|
||||||
self.stoptype: Optional[str] = stoptype
|
self.stoptype: Optional[str] = stoptype
|
||||||
self.startts: int = startts
|
self.startts: int = startts
|
||||||
self.stopts: int = stopts
|
self.stopts: int = stopts
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
"""Override the default Equals behavior"""
|
||||||
|
return (self.starttype == other.starttype and self.stoptype == other.stoptype
|
||||||
|
and self.startts == other.startts and self.stopts == other.stopts)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_timerange(text: Optional[str]):
|
def parse_timerange(text: Optional[str]):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user