Skip to content
Snippets Groups Projects
Commit 9e657eff authored by B13nch3n's avatar B13nch3n
Browse files

Starting walrus operator

parent 480f596f
No related branches found
No related tags found
No related merge requests found
...@@ -820,19 +820,21 @@ class _CifCheck: ...@@ -820,19 +820,21 @@ class _CifCheck:
) )
continue continue
# Invalid value # Invalid value
match = re.match( for pttrn in [
r"^ERROR - In block \"(?P<dblock>.*)\", mandatory item " r"^ERROR - In block \"(?P<dblock>.*)\", mandatory item "
+ r"\"(?P<itm>.*)\" has invalid value (?P<vle>.*) in row: " + r"\"(?P<itm>.*)\" has invalid value (?P<vle>.*) in row: "
+ r"\".*\" == \"\d+\"$", + r"\".*\" == \"\d+\"$",
line, ]:
) if (match := re.match(pttrn, line)) is not None:
# ToDo: use the walrus operator := everywhere here
rprt["Invalid values"].add(
f'{match.group("itm")}={match.group("vle")}'
)
if "dblock" in match.groupdict():
_check_dblock_name(match.group("dblock"), rprt)
break
if match is not None: if match is not None:
rprt["Invalid values"].add(
f'{match.group("itm")}={match.group("vle")}'
)
_check_dblock_name(match.group("dblock"), rprt)
continue continue
# Unmatched lines need to be added to above evaluation # Unmatched lines need to be added to above evaluation
raise RuntimeError( raise RuntimeError(
f'Unmatched diagnosis line found:\n"""{line}"""' f'Unmatched diagnosis line found:\n"""{line}"""'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment