Loading django/contrib/auth/context_processors.py +3 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ class PermLookupDict(object): def __bool__(self): return self.user.has_module_perms(self.module_name) __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) class PermWrapper(object): Loading django/contrib/gis/measure.py +12 −4 Original line number Diff line number Diff line Loading @@ -151,7 +151,9 @@ class MeasureBase(object): **{self.STANDARD_UNIT: (self.standard / other)}) else: raise TypeError('%(class)s must be divided with number or %(class)s' % {"class":pretty_name(self)}) __div__ = __truediv__ # Python 2 compatibility def __div__(self, other): # Python 2 compatibility return type(self).__truediv__(self, other) def __itruediv__(self, other): if isinstance(other, NUMERIC_TYPES): Loading @@ -159,11 +161,15 @@ class MeasureBase(object): return self else: raise TypeError('%(class)s must be divided with number' % {"class":pretty_name(self)}) __idiv__ = __itruediv__ # Python 2 compatibility def __idiv__(self, other): # Python 2 compatibility return type(self).__itruediv__(self, other) def __bool__(self): return bool(self.standard) __nonzero__ = __bool__ # Python 2 compatibility def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def default_units(self, kwargs): """ Loading Loading @@ -314,7 +320,9 @@ class Area(MeasureBase): **{self.STANDARD_UNIT: (self.standard / other)}) else: raise TypeError('%(class)s must be divided by a number' % {"class":pretty_name(self)}) __div__ = __truediv__ # Python 2 compatibility def __div__(self, other): # Python 2 compatibility return type(self).__truediv__(self, other) # Shortcuts Loading django/core/files/base.py +6 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,9 @@ class File(FileProxyMixin): def __bool__(self): return bool(self.name) __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def __len__(self): return self.size Loading Loading @@ -142,7 +144,9 @@ class ContentFile(File): def __bool__(self): return True __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def open(self, mode=None): self.seek(0) Loading django/core/serializers/base.py +1 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class Serializer(object): if callable(getattr(self.stream, 'getvalue', None)): return self.stream.getvalue() class Deserializer(object): class Deserializer(six.Iterator): """ Abstract base deserializer class. """ Loading @@ -138,8 +138,6 @@ class Deserializer(object): """Iteration iterface -- return the next item in the stream""" raise NotImplementedError next = __next__ # Python 2 compatibility class DeserializedObject(object): """ A deserialized model. Loading django/core/serializers/xml_serializer.py +0 −2 Original line number Diff line number Diff line Loading @@ -161,8 +161,6 @@ class Deserializer(base.Deserializer): return self._handle_object(node) raise StopIteration next = __next__ # Python 2 compatibility def _handle_object(self, node): """ Convert an <object> node to a DeserializedObject. Loading Loading
django/contrib/auth/context_processors.py +3 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ class PermLookupDict(object): def __bool__(self): return self.user.has_module_perms(self.module_name) __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) class PermWrapper(object): Loading
django/contrib/gis/measure.py +12 −4 Original line number Diff line number Diff line Loading @@ -151,7 +151,9 @@ class MeasureBase(object): **{self.STANDARD_UNIT: (self.standard / other)}) else: raise TypeError('%(class)s must be divided with number or %(class)s' % {"class":pretty_name(self)}) __div__ = __truediv__ # Python 2 compatibility def __div__(self, other): # Python 2 compatibility return type(self).__truediv__(self, other) def __itruediv__(self, other): if isinstance(other, NUMERIC_TYPES): Loading @@ -159,11 +161,15 @@ class MeasureBase(object): return self else: raise TypeError('%(class)s must be divided with number' % {"class":pretty_name(self)}) __idiv__ = __itruediv__ # Python 2 compatibility def __idiv__(self, other): # Python 2 compatibility return type(self).__itruediv__(self, other) def __bool__(self): return bool(self.standard) __nonzero__ = __bool__ # Python 2 compatibility def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def default_units(self, kwargs): """ Loading Loading @@ -314,7 +320,9 @@ class Area(MeasureBase): **{self.STANDARD_UNIT: (self.standard / other)}) else: raise TypeError('%(class)s must be divided by a number' % {"class":pretty_name(self)}) __div__ = __truediv__ # Python 2 compatibility def __div__(self, other): # Python 2 compatibility return type(self).__truediv__(self, other) # Shortcuts Loading
django/core/files/base.py +6 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,9 @@ class File(FileProxyMixin): def __bool__(self): return bool(self.name) __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def __len__(self): return self.size Loading Loading @@ -142,7 +144,9 @@ class ContentFile(File): def __bool__(self): return True __nonzero__ = __bool__ # Python 2 def __nonzero__(self): # Python 2 compatibility return type(self).__bool__(self) def open(self, mode=None): self.seek(0) Loading
django/core/serializers/base.py +1 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class Serializer(object): if callable(getattr(self.stream, 'getvalue', None)): return self.stream.getvalue() class Deserializer(object): class Deserializer(six.Iterator): """ Abstract base deserializer class. """ Loading @@ -138,8 +138,6 @@ class Deserializer(object): """Iteration iterface -- return the next item in the stream""" raise NotImplementedError next = __next__ # Python 2 compatibility class DeserializedObject(object): """ A deserialized model. Loading
django/core/serializers/xml_serializer.py +0 −2 Original line number Diff line number Diff line Loading @@ -161,8 +161,6 @@ class Deserializer(base.Deserializer): return self._handle_object(node) raise StopIteration next = __next__ # Python 2 compatibility def _handle_object(self, node): """ Convert an <object> node to a DeserializedObject. Loading