Skip to content

Commit f8c3e38

Browse files
committed
Handle string comparisons
1 parent e5a868c commit f8c3e38

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libtmux/_compat.py

+13
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ def __init__(self, version: str) -> None:
9999
def __str__(self) -> str:
100100
return self._version
101101

102+
def __lt__(self, other):
103+
if isinstance(other, str):
104+
other = LegacyVersion(other)
105+
return super().__lt__(other)
106+
107+
def __eq__(self, other) -> bool:
108+
if isinstance(other, str):
109+
other = LegacyVersion(other)
110+
if not isinstance(other, LegacyVersion):
111+
return NotImplemented
112+
113+
return self._key == other._key
114+
102115
def __repr__(self) -> str:
103116
return "<LegacyVersion({0})>".format(repr(str(self)))
104117

0 commit comments

Comments
 (0)