mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
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:
committed by
Tim Graham
parent
3cc5f01d9b
commit
eb422e476f
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user