From 949fc5e50e64eb40b4e40919626f42cb28b28305 Mon Sep 17 00:00:00 2001 From: Open Toontown <57279094+opentoontown@users.noreply.github.com> Date: Sun, 16 Jan 2022 23:30:45 -0500 Subject: [PATCH] __cmp__ is deprecated in python3 --- toontown/catalog/CatalogItem.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/toontown/catalog/CatalogItem.py b/toontown/catalog/CatalogItem.py index 44258d7..5f01a55 100644 --- a/toontown/catalog/CatalogItem.py +++ b/toontown/catalog/CatalogItem.py @@ -253,11 +253,23 @@ class CatalogItem: def getHashContents(self): return None - def __cmp__(self, other): - c = cmp(self.__class__, other.__class__) - if c != 0: - return c - return self.compareTo(other) + def __lt__(self, other): + c = self.__class__ == other.__class__ + if not c: + return 0 + return self.compareTo(other) < 0 + + def __gt__(self, other): + c = self.__class__ == other.__class__ + if not c: + return 0 + return self.compareTo(other) > 0 + + def __eq__(self, other): + c = self.__class__ == other.__class__ + if not c: + return 0 + return self.compareTo(other) == 0 def __hash__(self): return hash((self.__class__, self.getHashContents()))