Skip to content

Commit 03b0b77

Browse files
VTR Robotjgoeders
VTR Robot
authored andcommitted
🤖 - Automated code reformat.
I'm an auto code reformatting bot. Beep boop...
1 parent b5e448e commit 03b0b77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5263
-4089
lines changed

ODIN_II/regression_test/parse_result/conf/hooks.py

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@
77

88
PRE_HOOKS = [
99
# nothing
10-
]
10+
]
11+
12+
POST_HOOKS = ["drop_entries_on_failure", "patch_logs", "inverse_result_from_expectation"]
1113

12-
POST_HOOKS = [
13-
'drop_entries_on_failure',
14-
'patch_logs',
15-
'inverse_result_from_expectation'
16-
]
1714

1815
def do_something_on_the_raw_log(line: str):
1916
"""
2017
this is an example preprocessing hook.
2118
"""
2219
return line
2320

21+
2422
def do_something_on_the_parsed_log(values: OrderedDict):
2523
"""
2624
this is an example post-processing hook.
@@ -36,33 +34,34 @@ def drop_entries_on_failure(values):
3634
if we failed we drop the folowing sections
3735
Failure may happen late in the log, so we may still end up parsing them
3836
"""
39-
if 'exit' in values:
40-
if values['exit'] != 0:
37+
if "exit" in values:
38+
if values["exit"] != 0:
4139
for sections in [
4240
# all the statistical values are not relevant if we failed
43-
'max_rss(MiB)',
44-
'exec_time(ms)',
45-
'synthesis_time(ms)',
46-
'simulation_time(ms)',
47-
'Latch Drivers',
48-
'Pi',
49-
'Po',
50-
'logic element',
51-
'latch',
52-
'Adder',
53-
'Multiplier',
54-
'Memory',
55-
'Hard Ip',
56-
'generic logic size',
57-
'Longest Path',
58-
'Average Path',
59-
'Estimated LUTs',
60-
'Total Node',
41+
"max_rss(MiB)",
42+
"exec_time(ms)",
43+
"synthesis_time(ms)",
44+
"simulation_time(ms)",
45+
"Latch Drivers",
46+
"Pi",
47+
"Po",
48+
"logic element",
49+
"latch",
50+
"Adder",
51+
"Multiplier",
52+
"Memory",
53+
"Hard Ip",
54+
"generic logic size",
55+
"Longest Path",
56+
"Average Path",
57+
"Estimated LUTs",
58+
"Total Node",
6159
]:
6260
if sections in values:
6361
del values[sections]
6462
return values
6563

64+
6665
def patch_logs(values):
6766
"""
6867
patch the string logs
@@ -72,35 +71,38 @@ def patch_logs(values):
7271
r"(" + pwd.getpwuid(os.getuid()).pw_name + r")": "",
7372
# strip path from known file extensions
7473
r"([\/]?[a-zA-Z_.\-0-9]*\/)(?=[^\/\s]*(_input|_output|\.xml|\.v|\.vh|\.blif|\.log|\.do|\.dot|_vectors|_activity)[\s\n]+)": "",
75-
# bison used to call EOF $end, but switched to end of file since
76-
r"syntax error, unexpected \$end": r"syntax error, unexpected end of file"
74+
# bison used to call EOF $end, but switched to end of file since
75+
r"syntax error, unexpected \$end": r"syntax error, unexpected end of file",
7776
}
7877

7978
if isinstance(values, str):
8079
for old_str, new_string in sub_re.items():
8180
values = re.sub(old_str, new_string, values)
8281
elif isinstance(values, list):
83-
values = [ patch_logs(log_entry) for log_entry in values ]
84-
elif isinstance(values, ( OrderedDict, dict )):
82+
values = [patch_logs(log_entry) for log_entry in values]
83+
elif isinstance(values, (OrderedDict, dict)):
8584
for section in values:
8685
values[section] = patch_logs(values[section])
8786

8887
return values
8988

89+
9090
def inverse_result_from_expectation(values):
9191

9292
should_fail = False
93-
if 'expectation' in values:
94-
for log in values['expectation']:
93+
if "expectation" in values:
94+
for log in values["expectation"]:
9595
if log == "failure":
9696
should_fail = True
9797
break
98-
99-
if 'exit' in values:
100-
if values['exit'] == 0 and should_fail:
101-
values['exit'] = 51
102-
elif values['exit'] != 0 and should_fail:
103-
values['exit'] = 0
104-
values['expectation'].append("Failure caught and flipped to success by the post processor")
105-
98+
99+
if "exit" in values:
100+
if values["exit"] == 0 and should_fail:
101+
values["exit"] = 51
102+
elif values["exit"] != 0 and should_fail:
103+
values["exit"] = 0
104+
values["expectation"].append(
105+
"Failure caught and flipped to success by the post processor"
106+
)
107+
106108
return values

0 commit comments

Comments
 (0)