From 0e95be7d2d11870b757f9b246a3114eda8050ce5 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Tue, 3 Nov 2020 15:56:32 +0100 Subject: [PATCH] refactor --- commands.py | 5 +++-- utils/seq.py | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 utils/seq.py diff --git a/commands.py b/commands.py index 988ef75..0824849 100644 --- a/commands.py +++ b/commands.py @@ -8,6 +8,7 @@ from utils.epics import DataGetter, DataPutter from utils.execute import parallel, serial from utils.fileio import load_config, load_csv, store_csv from utils.printing import print_good, print_bad, itemize +from utils.seq import is_empty def run(clargs): @@ -76,7 +77,7 @@ def run_goto(clargs): if not clargs.quiet: all_names = df.index ignored = all_names[~which] - if ignored.size != 0: + if not is_empty(ignored): print("ignored due to alarm state:") print(itemize(ignored)) print() @@ -88,7 +89,7 @@ def run_goto(clargs): which = df.notnull() all_names = df.index ignored = all_names[~which] - if ignored.size != 0: + if not is_empty(ignored): print("ignored due to NaN value:") print(itemize(ignored)) print() diff --git a/utils/seq.py b/utils/seq.py new file mode 100644 index 0000000..f8df990 --- /dev/null +++ b/utils/seq.py @@ -0,0 +1,5 @@ + +def is_empty(seq): + return len(seq) == 0 + +