Skip to content

Commit

Permalink
Implement __lt__() for BaseNode (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
floxay committed May 28, 2024
1 parent d89e9f0 commit 61a56cd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elastic_transport/_node/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def path_prefix(self) -> str:
def __repr__(self) -> str:
return f"<{self.__class__.__name__}({self.base_url})>"

def __lt__(self, other: object) -> bool:
if not isinstance(other, BaseNode):
return NotImplemented
return id(self) < id(other)

def __eq__(self, other: object) -> bool:
if not isinstance(other, BaseNode):
return NotImplemented
Expand Down

0 comments on commit 61a56cd

Please sign in to comment.