Update alerts reported by LGTM
This commit is contained in:
parent
ce73bf1a93
commit
b3c6e9d2cc
10 changed files with 42 additions and 10 deletions
|
|
@ -215,6 +215,9 @@ class _SaverMutable(object):
|
|||
def __eq__(self, other):
|
||||
return self._data == other
|
||||
|
||||
def __ne__(self, other):
|
||||
return self._data != other
|
||||
|
||||
@_save
|
||||
def __setitem__(self, key, value):
|
||||
self._data.__setitem__(key, self._convert_mutables(value))
|
||||
|
|
@ -248,6 +251,13 @@ class _SaverList(_SaverMutable, MutableSequence):
|
|||
except TypeError:
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
try:
|
||||
return list(self._data) != list(other)
|
||||
except TypeError:
|
||||
return True
|
||||
|
||||
|
||||
def index(self, value, *args):
|
||||
return self._data.index(value, *args)
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class EvMore(object):
|
|||
else:
|
||||
self._pos += 1
|
||||
self.display()
|
||||
if self.exit_on_lastpage and self._pos == self._pos >= self._npages - 1:
|
||||
if self.exit_on_lastpage and self._pos >= self._npages - 1:
|
||||
self.page_quit()
|
||||
|
||||
def page_back(self):
|
||||
|
|
|
|||
|
|
@ -230,6 +230,13 @@ class ParseStack(list):
|
|||
# indicates if the top of the stack is a string or not
|
||||
self._string_last = True
|
||||
|
||||
def __eq__(self, other):
|
||||
return (super(ParseStack).__eq__(other) and
|
||||
hasattr(other, "_string_last") and self._string_last == other._string_last)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def append(self, item):
|
||||
"""
|
||||
The stack will merge strings, add other things as normal
|
||||
|
|
|
|||
|
|
@ -1831,6 +1831,17 @@ class LimitedSizeOrderedDict(OrderedDict):
|
|||
self.filo = not kwargs.get("fifo", True) # FIFO inverse of FILO
|
||||
self._check_size()
|
||||
|
||||
def __eq__(self, other):
|
||||
ret = super(LimitedSizeOrderedDict, self).__eq__(other)
|
||||
if ret:
|
||||
return (ret and
|
||||
hasattr(other, 'size_limit') and self.size_limit == other.size_limit and
|
||||
hasattr(other, 'fifo') and self.fifo == other.fifo)
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def _check_size(self):
|
||||
filo = self.filo
|
||||
if self.size_limit is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue