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:
parent
3cc5f01d9b
commit
eb422e476f
|
@ -391,9 +391,6 @@ class AnonymousUser(object):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return isinstance(other, self.__class__)
|
return isinstance(other, self.__class__)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return 1 # instances always return the same hash value
|
return 1 # instances always return the same hash value
|
||||||
|
|
||||||
|
|
|
@ -179,10 +179,6 @@ class OGRGeometry(GDALBase):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
"Tests for inequality."
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"WKT is used for the string representation."
|
"WKT is used for the string representation."
|
||||||
return self.wkt
|
return self.wkt
|
||||||
|
|
|
@ -68,9 +68,6 @@ class OGRGeomType(object):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"Returns a short-hand string form of the OGR Geometry type."
|
"Returns a short-hand string form of the OGR Geometry type."
|
||||||
|
|
|
@ -177,10 +177,6 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
"The not equals operator."
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
# ### Geometry set-like operations ###
|
# ### Geometry set-like operations ###
|
||||||
# Thanks to Sean Gillies for inspiration:
|
# Thanks to Sean Gillies for inspiration:
|
||||||
# http://lists.gispython.org/pipermail/community/2007-July/001034.html
|
# http://lists.gispython.org/pipermail/community/2007-July/001034.html
|
||||||
|
|
|
@ -66,9 +66,6 @@ class KeysValidator(object):
|
||||||
self.strict == other.strict
|
self.strict == other.strict
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
|
|
||||||
class RangeMaxValueValidator(MaxValueValidator):
|
class RangeMaxValueValidator(MaxValueValidator):
|
||||||
def compare(self, a, b):
|
def compare(self, a, b):
|
||||||
|
|
|
@ -110,9 +110,6 @@ class DefaultCacheProxy(object):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return caches[DEFAULT_CACHE_ALIAS] == other
|
return caches[DEFAULT_CACHE_ALIAS] == other
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return caches[DEFAULT_CACHE_ALIAS] != other
|
|
||||||
|
|
||||||
|
|
||||||
cache = DefaultCacheProxy()
|
cache = DefaultCacheProxy()
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,6 @@ class CheckMessage(object):
|
||||||
for attr in ['level', 'msg', 'hint', 'obj', 'id'])
|
for attr in ['level', 'msg', 'hint', 'obj', 'id'])
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ class RegexValidator(object):
|
||||||
(self.inverse_match == other.inverse_match)
|
(self.inverse_match == other.inverse_match)
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class URLValidator(RegexValidator):
|
class URLValidator(RegexValidator):
|
||||||
|
|
|
@ -41,9 +41,6 @@ class DefaultConnectionProxy(object):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return connections[DEFAULT_DB_ALIAS] == other
|
return connections[DEFAULT_DB_ALIAS] == other
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return connections[DEFAULT_DB_ALIAS] != other
|
|
||||||
|
|
||||||
|
|
||||||
connection = DefaultConnectionProxy()
|
connection = DefaultConnectionProxy()
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,6 @@ class Migration(object):
|
||||||
return False
|
return False
|
||||||
return (self.name == other.name) and (self.app_label == other.app_label)
|
return (self.name == other.name) and (self.app_label == other.app_label)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Migration %s.%s>" % (self.app_label, self.name)
|
return "<Migration %s.%s>" % (self.app_label, self.name)
|
||||||
|
|
||||||
|
|
|
@ -233,9 +233,6 @@ class ProjectState(object):
|
||||||
return False
|
return False
|
||||||
return all(model == other.models[key] for key, model in self.models.items())
|
return all(model == other.models[key] for key, model in self.models.items())
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
|
|
||||||
class AppConfigStub(AppConfig):
|
class AppConfigStub(AppConfig):
|
||||||
"""
|
"""
|
||||||
|
@ -626,6 +623,3 @@ class ModelState(object):
|
||||||
(self.bases == other.bases) and
|
(self.bases == other.bases) and
|
||||||
(self.managers == other.managers)
|
(self.managers == other.managers)
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
|
@ -520,9 +520,6 @@ class Model(metaclass=ModelBase):
|
||||||
return self is other
|
return self is other
|
||||||
return my_pk == other._get_pk_val()
|
return my_pk == other._get_pk_val()
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
if self._get_pk_val() is None:
|
if self._get_pk_val() is None:
|
||||||
raise TypeError("Model instances without primary key value are unhashable")
|
raise TypeError("Model instances without primary key value are unhashable")
|
||||||
|
|
|
@ -28,9 +28,6 @@ class FieldFile(File):
|
||||||
return self.name == other.name
|
return self.name == other.name
|
||||||
return self.name == other
|
return self.name == other
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(self.name)
|
return hash(self.name)
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,3 @@ class Index(object):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (self.__class__ == other.__class__) and (self.deconstruct() == other.deconstruct())
|
return (self.__class__ == other.__class__) and (self.deconstruct() == other.deconstruct())
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
|
@ -160,9 +160,6 @@ class BaseManager(object):
|
||||||
self._constructor_args == other._constructor_args
|
self._constructor_args == other._constructor_args
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not (self == other)
|
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return id(self)
|
return id(self)
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,6 @@ class ErrorList(UserList, list):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return list(self) == other
|
return list(self) == other
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return list(self) != other
|
|
||||||
|
|
||||||
def __getitem__(self, i):
|
def __getitem__(self, i):
|
||||||
error = self.data[i]
|
error = self.data[i]
|
||||||
if isinstance(error, ValidationError):
|
if isinstance(error, ValidationError):
|
||||||
|
|
|
@ -140,9 +140,6 @@ class Origin(object):
|
||||||
self.loader == other.loader
|
self.loader == other.loader
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def loader_name(self):
|
def loader_name(self):
|
||||||
if self.loader:
|
if self.loader:
|
||||||
|
|
|
@ -81,9 +81,6 @@ class Element(object):
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.name,) + tuple(a for a in self.attributes))
|
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):
|
def _count(self, element, count=True):
|
||||||
if not isinstance(element, str):
|
if not isinstance(element, str):
|
||||||
if self == element:
|
if self == element:
|
||||||
|
|
|
@ -126,11 +126,6 @@ def lazy(func, *resultclasses):
|
||||||
# a __str__() method from the proxied class.
|
# a __str__() method from the proxied class.
|
||||||
return str(self.__cast())
|
return str(self.__cast())
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
if isinstance(other, Promise):
|
|
||||||
other = other.__cast()
|
|
||||||
return self.__cast() != other
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if isinstance(other, Promise):
|
if isinstance(other, Promise):
|
||||||
other = other.__cast()
|
other = other.__cast()
|
||||||
|
|
Loading…
Reference in New Issue