Ran black on branc

This commit is contained in:
Griatch 2019-12-16 20:31:42 +01:00
parent 6effb6f456
commit 4ea6209123
230 changed files with 7108 additions and 2395 deletions

View file

@ -71,13 +71,18 @@ def build_matches(raw_string, cmdset, include_prefixes=False):
for cmdname in [cmd.key] + cmd.aliases
if cmdname
and l_raw_string.startswith(cmdname.lower())
and (not cmd.arg_regex or cmd.arg_regex.match(l_raw_string[len(cmdname) :]))
and (
not cmd.arg_regex
or cmd.arg_regex.match(l_raw_string[len(cmdname) :])
)
]
)
else:
# strip prefixes set in settings
raw_string = (
raw_string.lstrip(_CMD_IGNORE_PREFIXES) if len(raw_string) > 1 else raw_string
raw_string.lstrip(_CMD_IGNORE_PREFIXES)
if len(raw_string) > 1
else raw_string
)
l_raw_string = raw_string.lower()
for cmd in cmdset:
@ -90,9 +95,14 @@ def build_matches(raw_string, cmdset, include_prefixes=False):
if (
cmdname
and l_raw_string.startswith(cmdname.lower())
and (not cmd.arg_regex or cmd.arg_regex.match(l_raw_string[len(cmdname) :]))
and (
not cmd.arg_regex
or cmd.arg_regex.match(l_raw_string[len(cmdname) :])
)
):
matches.append(create_match(cmdname, raw_string, cmd, raw_cmdname))
matches.append(
create_match(cmdname, raw_string, cmd, raw_cmdname)
)
except Exception:
log_trace("cmdhandler error. raw_input:%s" % raw_string)
return matches
@ -125,7 +135,10 @@ def try_num_prefixes(raw_string):
# the user might be trying to identify the command
# with a #num-command style syntax. We expect the regex to
# contain the groups "number" and "name".
mindex, new_raw_string = num_ref_match.group("number"), num_ref_match.group("name")
mindex, new_raw_string = (
num_ref_match.group("number"),
num_ref_match.group("name"),
)
return mindex, new_raw_string
else:
return None, None
@ -180,7 +193,9 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
if _CMD_IGNORE_PREFIXES:
# still no match. Try to strip prefixes
raw_string = (
raw_string.lstrip(_CMD_IGNORE_PREFIXES) if len(raw_string) > 1 else raw_string
raw_string.lstrip(_CMD_IGNORE_PREFIXES)
if len(raw_string) > 1
else raw_string
)
matches = build_matches(raw_string, cmdset, include_prefixes=False)