From 22afac70b8e3db8bdd958be518eaeafd565af576 Mon Sep 17 00:00:00 2001 From: umarcor Date: Thu, 2 Dec 2021 15:29:07 +0100 Subject: [PATCH] Tip: style --- tip/tip.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tip/tip.py b/tip/tip.py index 8388bf7..cc0c7b1 100755 --- a/tip/tip.py +++ b/tip/tip.py @@ -22,15 +22,13 @@ if len(argv) > 1: if len(args) == 1 and args[0] == "none": files = [] print("! Skipping 'files' because it's set to 'none") +elif len(args) == 0: + stdout.flush() + raise (Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!")) else: - if len(args) == 0: - stdout.flush() - raise (Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!")) - for item in args: - items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()] print(f" glob({item!s}):") - for fname in items: + for fname in [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]: if Path(fname).stat().st_size == 0: print(f" - ! Skipping empty file {fname!s}") continue