rc10house commented on code in PR #53: URL: https://github.com/apache/flagon-distill/pull/53#discussion_r1679603806
########## distill/core/log.py: ########## @@ -57,4 +58,37 @@ def to_json(self) -> str: def to_dict(self) -> JsonDict: return self.data.model_dump(by_alias=True) - + + def __lt__(self, other): + if isinstance(other, Log): + return self.id < other.id + if isinstance(other, datetime): + return self.id.get_datetime() < other.now() Review Comment: `other.now()` will get the current datetime, I think instead we should just be able to compare `self.id.get_datetime() < other` if `other` is a datetime object. ########## distill/core/log.py: ########## @@ -57,4 +58,37 @@ def to_json(self) -> str: def to_dict(self) -> JsonDict: return self.data.model_dump(by_alias=True) - + + def __lt__(self, other): + if isinstance(other, Log): + return self.id < other.id + if isinstance(other, datetime): + return self.id.get_datetime() < other.now() + + def __le__(self, other): + if isinstance(other, Log): + return self.id <= other.id + if isinstance(other, datetime): + return self.id.get_datetime() <= other.now() Review Comment: Same as above for every method -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For additional commands, e-mail: notifications-h...@flagon.apache.org