mirror of
https://github.com/evennia/evennia.git
synced 2025-10-29 19:35:56 +00:00
Update alerts reported by LGTM
This commit is contained in:
parent
ce73bf1a93
commit
b3c6e9d2cc
@ -173,7 +173,6 @@ def rename_in_tree(path, in_list, out_list, excl_list, fileend_list, is_interact
|
||||
if new_root != root:
|
||||
inp = raw_input(_green("Dir Rename %s\n -> %s\n Y/[N]? > " % (root, new_root)))
|
||||
if inp.upper() == 'Y':
|
||||
new_full_path = os.path.join(root, new_file)
|
||||
try:
|
||||
os.rename(root, new_root)
|
||||
except OSError as err:
|
||||
|
||||
@ -649,8 +649,8 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
|
||||
args = raw_string
|
||||
unformatted_raw_string = "%s%s" % (cmdname, args)
|
||||
cmdset = None
|
||||
session = session
|
||||
account = account
|
||||
# session = session
|
||||
# account = account
|
||||
|
||||
else:
|
||||
# no explicit cmdobject given, figure it out
|
||||
@ -687,7 +687,7 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
|
||||
sysarg = yield _SEARCH_AT_RESULT([match[2] for match in matches], caller, query=matches[0][0])
|
||||
raise ExecSystemCommand(syscmd, sysarg)
|
||||
|
||||
cmdname, args, cmd = "", "", None
|
||||
cmdname, args, cmd, raw_cmdname = "", "", None, ""
|
||||
if len(matches) == 1:
|
||||
# We have a unique command match. But it may still be invalid.
|
||||
match = matches[0]
|
||||
|
||||
@ -108,7 +108,7 @@ def to_object(inp, objtype='account'):
|
||||
return _AccountDB.objects.get(user_username__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _AccountDB.objects.get(id=obj)
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s" % (objtype, inp, obj, typ, type(inp)))
|
||||
raise CommError()
|
||||
elif objtype == 'object':
|
||||
if typ == 'account':
|
||||
@ -117,14 +117,14 @@ def to_object(inp, objtype='account'):
|
||||
return _ObjectDB.objects.get(db_key__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _ObjectDB.objects.get(id=obj)
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s" % (objtype, inp, obj, typ, type(inp)))
|
||||
raise CommError()
|
||||
elif objtype == 'channel':
|
||||
if typ == 'string':
|
||||
return _ChannelDB.objects.get(db_key__iexact=obj)
|
||||
if typ == 'dbref':
|
||||
return _ChannelDB.objects.get(id=obj)
|
||||
logger.log_err("%s %s %s %s %s", objtype, inp, obj, typ, type(inp))
|
||||
logger.log_err("%s %s %s %s %s" % (objtype, inp, obj, typ, type(inp)))
|
||||
raise CommError()
|
||||
# an unknown
|
||||
return None
|
||||
|
||||
@ -116,7 +116,6 @@ class Msg(SharedMemoryModel):
|
||||
|
||||
# these can be used to filter/hide a given message from supplied objects/accounts/channels
|
||||
db_hide_from_accounts = models.ManyToManyField("accounts.AccountDB", related_name='hide_from_accounts_set', blank=True)
|
||||
db_hide_from_accounts = models.ManyToManyField("accounts.AccountDB", related_name='hide_from_accounts_set', blank=True)
|
||||
|
||||
db_hide_from_objects = models.ManyToManyField("objects.ObjectDB", related_name='hide_from_objects_set', blank=True)
|
||||
db_hide_from_channels = models.ManyToManyField("ChannelDB", related_name='hide_from_channels_set', blank=True)
|
||||
|
||||
@ -433,6 +433,12 @@ class ServerSession(Session):
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
try:
|
||||
return self.address != other.address
|
||||
except AttributeError:
|
||||
return True
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
String representation of the user session class. We use
|
||||
|
||||
@ -494,7 +494,7 @@ class TypeclassManager(TypedObjectManager):
|
||||
|
||||
"""
|
||||
# shlex splits by spaces unless escaped by quotes
|
||||
querysplit = shlex.split(to_unicode(query, force=True))
|
||||
querysplit = shlex.split(to_unicode(query, force_string=True))
|
||||
queries, plustags, plusattrs, negtags, negattrs = [], [], [], [], []
|
||||
for ipart, part in enumerate(querysplit):
|
||||
key, rest = part, ""
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user