From 0dbd1561ae898f13d37d52d60df798e23b7c3724 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 14 Mar 2025 00:49:21 -0500 Subject: [PATCH] scripts: Fixed some issues with -k/--keep-open - Fixed a NameError in watch.py caused by an outdated variable name (renamed paths -> keep_open_paths). Yay for dynamic typing. - Fixed fieldnames is None issue when csv file is empty. --- scripts/plot.py | 2 +- scripts/plotmpl.py | 2 +- scripts/treemap.py | 2 +- scripts/treemapd3.py | 2 +- scripts/watch.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/plot.py b/scripts/plot.py index 3638a0cd..c775d0cb 100755 --- a/scripts/plot.py +++ b/scripts/plot.py @@ -283,7 +283,7 @@ def collect(csv_paths, defines=[]): with openio(path) as f: reader = csv.DictReader(f, restval='') fields.extend( - k for k in reader.fieldnames + k for k in reader.fieldnames or [] if k not in fields) for r in reader: # filter by matching defines diff --git a/scripts/plotmpl.py b/scripts/plotmpl.py index e16234b0..b6242e2e 100755 --- a/scripts/plotmpl.py +++ b/scripts/plotmpl.py @@ -207,7 +207,7 @@ def collect(csv_paths, defines=[]): with openio(path) as f: reader = csv.DictReader(f, restval='') fields.extend( - k for k in reader.fieldnames + k for k in reader.fieldnames or [] if k not in fields) for r in reader: # filter by matching defines diff --git a/scripts/treemap.py b/scripts/treemap.py index 57969373..2bc44565 100755 --- a/scripts/treemap.py +++ b/scripts/treemap.py @@ -83,7 +83,7 @@ def collect(csv_paths, defines=[]): with openio(path) as f: reader = csv.DictReader(f, restval='') fields.extend( - k for k in reader.fieldnames + k for k in reader.fieldnames or [] if k not in fields) for r in reader: # filter by matching defines diff --git a/scripts/treemapd3.py b/scripts/treemapd3.py index 878002e7..54dc83b3 100755 --- a/scripts/treemapd3.py +++ b/scripts/treemapd3.py @@ -100,7 +100,7 @@ def collect(csv_paths, defines=[]): with openio(path) as f: reader = csv.DictReader(f, restval='') fields.extend( - k for k in reader.fieldnames + k for k in reader.fieldnames or [] if k not in fields) for r in reader: # filter by matching defines diff --git a/scripts/watch.py b/scripts/watch.py index 3c0d66b5..59024e04 100755 --- a/scripts/watch.py +++ b/scripts/watch.py @@ -179,7 +179,7 @@ def main(command, *, re.sub('^-.', '', p), re.sub('^--[^=]+=', '', p)}: if p and os.path.exists(p): - paths.add(p) + keep_open_paths.add(p) returncode = 0 try: