Remove use of cmp in Hook class as __lt__ is sufficient on supported Python versions.
@@ -51,13 +51,12 @@ class Hook(object):
self.kwargs = kwargs
def __lt__(self, other):
- # Python 3
+ """
+ Hooks sort by priority, ascending, such that
+ hooks of lower priority are run first.
+ """
return self.priority < other.priority
- def __cmp__(self, other):
- # Python 2
- return cmp(self.priority, other.priority) # noqa: F821
-
def __call__(self):
"""Run self.callback(**self.kwargs)."""
return self.callback(**self.kwargs)
