Skip to content

Commit 7182c1a

Browse files
committed
Added an exception handling.
Signed-off-by: Jaehyun Kim <[email protected]>
1 parent 75f177c commit 7182c1a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

flow/util/genRuleFile.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,17 @@ def gen_rule_file(
177177
"!=": operator.ne,
178178
}
179179

180-
period_list = metrics["constraints__clocks__details"]
181-
182-
period = float(sub(r"^.*: ", "", period_list[0]))
183-
if len(period_list) != 1:
184-
print(
185-
f"[WARNING] Multiple clocks not supported. Will use first clock: {period_list[0]}."
186-
)
180+
period_list = metrics.get("constraints__clocks__details")
181+
182+
period = 0.0
183+
if period_list:
184+
period = float(sub(r"^.*: ", "", period_list[0]))
185+
if len(period_list) != 1:
186+
print(
187+
f"[WARNING] Multiple clocks not supported. Will use first clock: {period_list[0]}."
188+
)
189+
else:
190+
print("[WARNING] 'constraints__clocks__details' not found or is empty in metrics. Clock-related rules might be affected.")
187191

188192
format_str = "| {:45} | {:8} | {:8} | {:8} |\n"
189193
change_str = ""

0 commit comments

Comments
 (0)