mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1681096 - python3 - pylint --py3k - W1641: Implementing __eq__ without also implementing __hash__ (eq-without-hash) r=marionette-reviewers,aki,gbrown,jgraham
Differential Revision: https://phabricator.services.mozilla.com/D99092
This commit is contained in:
parent
286a2dd0d3
commit
fbefc79bcb
@ -207,6 +207,10 @@ class HTMLElement(object):
|
||||
def __eq__(self, other_element):
|
||||
return self.id == other_element.id
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(self.id)
|
||||
|
||||
def find_element(self, method, target):
|
||||
"""Returns an ``HTMLElement`` instance that matches the specified
|
||||
method and target, relative to the current element.
|
||||
|
@ -36,6 +36,10 @@ class Message(object):
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(self.id)
|
||||
|
||||
|
||||
class Command(Message):
|
||||
TYPE = 0
|
||||
|
@ -53,6 +53,10 @@ class StringVersion(six.text_type):
|
||||
if self.version > other.version:
|
||||
return 1
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(self.version)
|
||||
|
||||
# operator overloads
|
||||
def __eq__(self, other):
|
||||
return self._cmp(other) == 0
|
||||
|
@ -110,6 +110,10 @@ class Location(object):
|
||||
|
||||
__eq__ = isEqual
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(tuple(getattr(attr) for attr in self.attrs))
|
||||
|
||||
def url(self):
|
||||
return "%s://%s:%s" % (self.scheme, self.host, self.port)
|
||||
|
||||
|
@ -497,6 +497,19 @@ class FileRecord(object):
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(
|
||||
(
|
||||
self.filename,
|
||||
self.size,
|
||||
self.digest,
|
||||
self.algorithm,
|
||||
self.version,
|
||||
self.visibility,
|
||||
)
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return repr(self)
|
||||
|
||||
@ -669,6 +682,10 @@ class Manifest(object):
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __hash__(self):
|
||||
# pylint --py3k: W1641
|
||||
return hash(tuple(sorted((fr.filename, fr) for fr in self.file_records)))
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
# This is required for a deep copy
|
||||
return Manifest(self.file_records[:])
|
||||
|
Loading…
Reference in New Issue
Block a user