From 2ebb258123e619ee55a92281348d47eaecaed894 Mon Sep 17 00:00:00 2001 From: Keith James Date: Tue, 5 Nov 2024 15:20:16 +0000 Subject: [PATCH] Work around iquest's bad behaviour --- src/npg_irods/ont.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/npg_irods/ont.py b/src/npg_irods/ont.py index cfd55c1..8e433b9 100644 --- a/src/npg_irods/ont.py +++ b/src/npg_irods/ont.py @@ -462,13 +462,17 @@ def find_run_collections( ) # iquest mixes logging and data in its output - ignore = f"Zone is {zone}" if zone is not None else "Zone is" + ignore1 = f"Zone is {zone}" if zone is not None else "Zone is" + ignore2 = "CAT_NO_ROWS_FOUND" - return [ - Collection(p) - for p in iquest(*args, query).splitlines() - if not p.strip().startswith(ignore) - ] + paths = [] + for line in iquest(*args, query).splitlines(): + p = line.strip() + if p.startswith(ignore1) or p.startswith(ignore2): + continue + paths.append(p) + + return [Collection(p) for p in paths] def tag_index_from_id(tag_identifier: str) -> int: