Refs #23919 -- Removed obsolete __ne__() methods.

__ne__() defaults to the opposite of __eq__() on Python 3
when it doesn't return NotImplemented.
This commit is contained in:
Aymeric Augustin 2017-01-18 21:35:59 +01:00 committed by Tim Graham
parent 3cc5f01d9b
commit eb422e476f
19 changed files with 0 additions and 64 deletions

View File

@ -391,9 +391,6 @@ class AnonymousUser(object):
def __eq__(self, other):
return isinstance(other, self.__class__)
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return 1 # instances always return the same hash value

View File

@ -179,10 +179,6 @@ class OGRGeometry(GDALBase):
else:
return False
def __ne__(self, other):
"Tests for inequality."
return not (self == other)
def __str__(self):
"WKT is used for the string representation."
return self.wkt

View File

@ -68,9 +68,6 @@ class OGRGeomType(object):
else:
return False
def __ne__(self, other):
return not (self == other)
@property
def name(self):
"Returns a short-hand string form of the OGR Geometry type."

View File

@ -177,10 +177,6 @@ class GEOSGeometry(GEOSBase, ListMixin):
else:
return False
def __ne__(self, other):
"The not equals operator."
return not (self == other)
# ### Geometry set-like operations ###
# Thanks to Sean Gillies for inspiration:
# http://lists.gispython.org/pipermail/community/2007-July/001034.html

View File

@ -66,9 +66,6 @@ class KeysValidator(object):
self.strict == other.strict
)
def __ne__(self, other):
return not (self == other)
class RangeMaxValueValidator(MaxValueValidator):
def compare(self, a, b):

View File

@ -110,9 +110,6 @@ class DefaultCacheProxy(object):
def __eq__(self, other):
return caches[DEFAULT_CACHE_ALIAS] == other
def __ne__(self, other):
return caches[DEFAULT_CACHE_ALIAS] != other
cache = DefaultCacheProxy()

View File

@ -25,9 +25,6 @@ class CheckMessage(object):
for attr in ['level', 'msg', 'hint', 'obj', 'id'])
)
def __ne__(self, other):
return not (self == other)
def __str__(self):
from django.db import models

View File

@ -68,9 +68,6 @@ class RegexValidator(object):
(self.inverse_match == other.inverse_match)
)
def __ne__(self, other):
return not (self == other)
@deconstructible
class URLValidator(RegexValidator):

View File

@ -41,9 +41,6 @@ class DefaultConnectionProxy(object):
def __eq__(self, other):
return connections[DEFAULT_DB_ALIAS] == other
def __ne__(self, other):
return connections[DEFAULT_DB_ALIAS] != other
connection = DefaultConnectionProxy()

View File

@ -62,9 +62,6 @@ class Migration(object):
return False
return (self.name == other.name) and (self.app_label == other.app_label)
def __ne__(self, other):
return not (self == other)
def __repr__(self):
return "<Migration %s.%s>" % (self.app_label, self.name)

View File

@ -233,9 +233,6 @@ class ProjectState(object):
return False
return all(model == other.models[key] for key, model in self.models.items())
def __ne__(self, other):
return not (self == other)
class AppConfigStub(AppConfig):
"""
@ -626,6 +623,3 @@ class ModelState(object):
(self.bases == other.bases) and
(self.managers == other.managers)
)
def __ne__(self, other):
return not (self == other)

View File

@ -520,9 +520,6 @@ class Model(metaclass=ModelBase):
return self is other
return my_pk == other._get_pk_val()
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
if self._get_pk_val() is None:
raise TypeError("Model instances without primary key value are unhashable")

View File

@ -28,9 +28,6 @@ class FieldFile(File):
return self.name == other.name
return self.name == other
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self.name)

View File

@ -117,6 +117,3 @@ class Index(object):
def __eq__(self, other):
return (self.__class__ == other.__class__) and (self.deconstruct() == other.deconstruct())
def __ne__(self, other):
return not (self == other)

View File

@ -160,9 +160,6 @@ class BaseManager(object):
self._constructor_args == other._constructor_args
)
def __ne__(self, other):
return not (self == other)
def __hash__(self):
return id(self)

View File

@ -133,9 +133,6 @@ class ErrorList(UserList, list):
def __eq__(self, other):
return list(self) == other
def __ne__(self, other):
return list(self) != other
def __getitem__(self, i):
error = self.data[i]
if isinstance(error, ValidationError):

View File

@ -140,9 +140,6 @@ class Origin(object):
self.loader == other.loader
)
def __ne__(self, other):
return not self.__eq__(other)
@property
def loader_name(self):
if self.loader:

View File

@ -81,9 +81,6 @@ class Element(object):
def __hash__(self):
return hash((self.name,) + tuple(a for a in self.attributes))
def __ne__(self, element):
return not self.__eq__(element)
def _count(self, element, count=True):
if not isinstance(element, str):
if self == element:

View File

@ -126,11 +126,6 @@ def lazy(func, *resultclasses):
# a __str__() method from the proxied class.
return str(self.__cast())
def __ne__(self, other):
if isinstance(other, Promise):
other = other.__cast()
return self.__cast() != other
def __eq__(self, other):
if isinstance(other, Promise):
other = other.__cast()