Jason R. Coombs avatar Jason R. Coombs committed e30cbee

Renamed cmp_ to cmp

Comments (0)

Files changed (3)

 modern PEP-8 naming recommendations.
 
 * Renamed `jaraco.util.iter_` to `jaraco.util.itertools`
+* Renamed `jaraco.util.cmp_` to `jaraco.util.cmp`
 * Moved PasswordGenerator to jaraco.util.auth
 * Updated callable() to use technique that's good for all late Python versions
 * Removed jaraco.util.odict (use py26compat.collections.OrderedDict for

jaraco/util/cmp.py

+"""
+Utility functions to facilitate object comparison without __cmp__
+
+Based on recipe found at http://code.activestate.com/recipes/510403/
+"""
+
+class RichComparisonMixin(object):
+	"""
+	Define __cmp__, and inherit from this class to provide full rich
+	comparisons.
+	"""
+
+	def __eq__(self, other):
+		return self.__cmp__(other)==0
+
+	def __ne__(self, other):
+		return self.__cmp__(other)!=0
+
+	def __lt__(self, other):
+		return self.__cmp__(other)<0
+
+	def __le__(self, other):
+		return self.__cmp__(other)<=0
+
+	def __gt__(self, other):
+		return self.__cmp__(other)>0
+
+	def __ge__(self, other):
+		return self.__cmp__(other)>=0
+
+class KeyedEqualityMixin(object):
+	
+	def __eq__(self, other):
+		return self.__key__() == other.__key__()
+	def __ne__(self, other):
+		return self.__key__() != other.__key__()
+
+class KeyedComparisonMixin(KeyedEqualityMixin):
+	def __lt__(self, other):
+		return self.__key__() < other.__key__()
+	def __le__(self, other):
+		return self.__key__() <= other.__key__()
+	def __gt__(self, other):
+		return self.__key__() > other.__key__()
+	def __ge__(self, other):
+		return self.__key__() >= other.__key__()
+
+class KeyedHashingMixin(KeyedEqualityMixin):
+	def __hash__(self):
+		return hash(self.__key__())

jaraco/util/cmp_.py

-"""
-Utility functions to facilitate object comparison without __cmp__
-
-Based on recipe found at http://code.activestate.com/recipes/510403/
-"""
-
-class RichComparisonMixin(object):
-	"""
-	Define __cmp__, and inherit from this class to provide full rich
-	comparisons.
-	"""
-
-	def __eq__(self, other):
-		return self.__cmp__(other)==0
-
-	def __ne__(self, other):
-		return self.__cmp__(other)!=0
-
-	def __lt__(self, other):
-		return self.__cmp__(other)<0
-
-	def __le__(self, other):
-		return self.__cmp__(other)<=0
-
-	def __gt__(self, other):
-		return self.__cmp__(other)>0
-
-	def __ge__(self, other):
-		return self.__cmp__(other)>=0
-
-class KeyedEqualityMixin(object):
-	
-	def __eq__(self, other):
-		return self.__key__() == other.__key__()
-	def __ne__(self, other):
-		return self.__key__() != other.__key__()
-
-class KeyedComparisonMixin(KeyedEqualityMixin):
-	def __lt__(self, other):
-		return self.__key__() < other.__key__()
-	def __le__(self, other):
-		return self.__key__() <= other.__key__()
-	def __gt__(self, other):
-		return self.__key__() > other.__key__()
-	def __ge__(self, other):
-		return self.__key__() >= other.__key__()
-
-class KeyedHashingMixin(KeyedEqualityMixin):
-	def __hash__(self):
-		return hash(self.__key__())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.