From 3552dd0d735158112c65a77913b8264e0448994e Mon Sep 17 00:00:00 2001 From: Dustin Black Date: Mon, 11 Nov 2024 13:20:04 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Webb Scales <7795764+webbnh@users.noreply.github.com> Signed-off-by: Dustin Black --- arcaflow_plugin_rtla/rtla_plugin.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arcaflow_plugin_rtla/rtla_plugin.py b/arcaflow_plugin_rtla/rtla_plugin.py index 451e24f..06bd8ad 100644 --- a/arcaflow_plugin_rtla/rtla_plugin.py +++ b/arcaflow_plugin_rtla/rtla_plugin.py @@ -137,7 +137,7 @@ def run_timerlat( stats_per_col = [] found_all = False - re_isunit = re.compile(r"^# Time unit is (.+) .*$") + re_isunit = re.compile(r"# Time unit is (\w+)") re_isindex = re.compile(r"^Index") re_isdigit = re.compile(r"^\d") re_isall = re.compile(r"^ALL") @@ -157,13 +157,9 @@ def run_timerlat( line.split()[0] in stats_names and not found_all ): # Capture the columnar data - line_list = [] - for element in line.split(): - try: - line_list.append(int(element)) - except ValueError: - line_list.append(element) - row_obj = dict(zip(col_headers, line_list)) + items = line.split() + row_obj = dict(zip(col_headers, map(int, items[1:]))) + row_obj[col_headers[0]] = items[0][:-1] if re_isdigit.match(line): latency_hist.append(row_obj) else: