X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=days.py;h=42fc4c15280f616f0ee637503a4c98319e40d2c6;hb=bf0868a41a86ea5952d5fc1a8fca6621e89ad42e;hp=12328a6ed0927c5a2b970c4ef2318311156eaba7;hpb=ee7279c0884262d5b329033cf77260fd850a5b91;p=plomtask diff --git a/days.py b/days.py index 12328a6..42fc4c1 100644 --- a/days.py +++ b/days.py @@ -8,7 +8,7 @@ DATE_FORMAT = '%Y-%m-%d' class Day: """Individual days defined by their dates.""" - def __init__(self, date): + def __init__(self, date:str): self.date = date self.datetime = datetime.strptime(date, DATE_FORMAT) @@ -17,8 +17,8 @@ class Day: """Return what weekday matches self.date.""" return self.datetime.strftime('%A') - def __eq__(self, other): - return self.date == other.date + def __eq__(self, other:object): + return isinstance(other, self.__class__) and self.date == other.date - def __lt__(self, other): + def __lt__(self, other:Day): return self.date < other.date