aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-05-10 15:50:17 -0500
committerTrygve Aaberge <trygveaa@gmail.com>2019-04-08 15:11:57 +0200
commite40cfb66a19c2bf3b8c01f3e056ea56914aea18c (patch)
tree574edc071ceb139f004b6e3d62e0143a6e368270
parente72b83b240fc37abe369f9a800718ba89ad06d87 (diff)
downloadwee-slack-e40cfb66a19c2bf3b8c01f3e056ea56914aea18c.tar.gz
Implement the new comparison methods for SlackTS
Python 3 no longer respects __cmp__, as it has more fine-grained hooks for ordering/comparison. To minimize code changes, implement them in terms of the existing __cmp__ method.
-rw-r--r--wee_slack.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 33aa919..8b659f6 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2392,6 +2392,21 @@ class SlackTS(object):
elif s == other:
return 0
+ def __lt__(self, other):
+ return self.__cmp__(other) < 0
+
+ def __le__(self, other):
+ return self.__cmp__(other) <= 0
+
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+
+ def __ge__(self, other):
+ return self.__cmp__(other) >= 0
+
+ def __gt__(self, other):
+ return self.__cmp__(other) > 0
+
def __hash__(self):
return hash("{}.{}".format(self.major, self.minor))