Try to make mypy happy

This commit is contained in:
Alexandre Aubin 2021-10-04 01:16:20 +02:00
parent 4640d4577d
commit 9c4ea1ccc6

View file

@ -2424,13 +2424,16 @@ def _parse_app_instance_name(app_instance_name: str) -> Tuple[str, int]:
True True
""" """
match = re_app_instance_name.match(app_instance_name) match = re_app_instance_name.match(app_instance_name)
assert match, "Could not parse app instance name : %s" % app_instance_name assert match, f"Could not parse app instance name : {app_instance_name}"
appid = match.groupdict().get("appid") appid = match.groupdict().get("appid")
app_instance_nb = ( app_instance_nb = match.groupdict().get("appinstancenb") or "1"
int(match.groupdict().get("appinstancenb")) if not appid:
if match.groupdict().get("appinstancenb") is not None raise Exception(f"Could not parse app instance name : {app_instance_name}")
else 1 if not str(app_instance_nb).isdigit():
) raise Exception(f"Could not parse app instance name : {app_instance_name}")
else:
app_instance_nb = int(str(app_instance_nb))
return (appid, app_instance_nb) return (appid, app_instance_nb)