mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs #23919 -- Removed __nonzero__() methods (for Python 2).
Thanks Tim for the review.
This commit is contained in:
		| @@ -20,9 +20,6 @@ class PermLookupDict: | ||||
|     def __bool__(self): | ||||
|         return self.user.has_module_perms(self.app_label) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|  | ||||
| class PermWrapper: | ||||
|     def __init__(self, user): | ||||
|   | ||||
| @@ -175,9 +175,6 @@ class MeasureBase: | ||||
|     def __bool__(self): | ||||
|         return bool(self.standard) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def default_units(self, kwargs): | ||||
|         """ | ||||
|         Return the unit value and the default units specified | ||||
|   | ||||
| @@ -25,9 +25,6 @@ class File(FileProxyMixin): | ||||
|     def __bool__(self): | ||||
|         return bool(self.name) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def __len__(self): | ||||
|         return self.size | ||||
|  | ||||
| @@ -149,9 +146,6 @@ class ContentFile(File): | ||||
|     def __bool__(self): | ||||
|         return True | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def open(self, mode=None): | ||||
|         self.seek(0) | ||||
|  | ||||
|   | ||||
| @@ -253,9 +253,6 @@ class QuerySet: | ||||
|         self._fetch_all() | ||||
|         return bool(self._result_cache) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def __getitem__(self, k): | ||||
|         """ | ||||
|         Retrieves an item or slice from the set of results. | ||||
|   | ||||
| @@ -78,9 +78,6 @@ class BaseFormSet: | ||||
|         """All formsets have a management form which is not included in the length""" | ||||
|         return True | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     @cached_property | ||||
|     def management_form(self): | ||||
|         """Returns the ManagementForm instance for this FormSet.""" | ||||
|   | ||||
| @@ -32,9 +32,6 @@ class OrderedSet: | ||||
|     def __bool__(self): | ||||
|         return bool(self.dict) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def __len__(self): | ||||
|         return len(self.dict) | ||||
|  | ||||
|   | ||||
| @@ -114,9 +114,6 @@ def lazy_number(func, resultclass, number=None, **kwargs): | ||||
|             def __bool__(self): | ||||
|                 return bool(kwargs['singular']) | ||||
|  | ||||
|             def __nonzero__(self):  # Python 2 compatibility | ||||
|                 return type(self).__bool__(self) | ||||
|  | ||||
|             def __mod__(self, rhs): | ||||
|                 if isinstance(rhs, dict) and number: | ||||
|                     try: | ||||
|   | ||||
| @@ -71,9 +71,6 @@ class Node: | ||||
|         """ | ||||
|         return bool(self.children) | ||||
|  | ||||
|     def __nonzero__(self):      # Python 2 compatibility | ||||
|         return type(self).__bool__(self) | ||||
|  | ||||
|     def __contains__(self, other): | ||||
|         """ | ||||
|         Returns True is 'other' is a direct child of this instance. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user