Skip to content

Commit 9306d46

Browse files
committed
Handle string comparisons
1 parent 1a5daa8 commit 9306d46

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libtmux/_compat.py

+13
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ def __init__(self, version: str) -> None:
105105
def __str__(self) -> str:
106106
return self._version
107107

108+
def __lt__(self, other):
109+
if isinstance(other, str):
110+
other = LegacyVersion(other)
111+
return super().__lt__(other)
112+
113+
def __eq__(self, other) -> bool:
114+
if isinstance(other, str):
115+
other = LegacyVersion(other)
116+
if not isinstance(other, LegacyVersion):
117+
return NotImplemented
118+
119+
return self._key == other._key
120+
108121
def __repr__(self) -> str:
109122
return "<LegacyVersion({0})>".format(repr(str(self)))
110123

0 commit comments

Comments
 (0)