From 61a56cd3d96579d4882faebf427f3f7bb27c9db7 Mon Sep 17 00:00:00 2001 From: Huba Tuba <57007485+floxay@users.noreply.github.com> Date: Tue, 28 May 2024 08:16:33 +0200 Subject: [PATCH] Implement `__lt__()` for `BaseNode` (#115) --- elastic_transport/_node/_base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elastic_transport/_node/_base.py b/elastic_transport/_node/_base.py index e912e7a..b4e19a1 100644 --- a/elastic_transport/_node/_base.py +++ b/elastic_transport/_node/_base.py @@ -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