From e6afc23952f4dcb74a9f79e6fa3a93bcdb093f80 Mon Sep 17 00:00:00 2001 From: stroblme Date: Thu, 15 Oct 2026 09:55:41 +0200 Subject: [PATCH] sweep_artifacts: narrow the optional flow store for mypy --- backend/fluksio/flow/runs.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/fluksio/flow/runs.py b/backend/fluksio/flow/runs.py index a465891..0ac7d13 100644 --- a/backend/fluksio/flow/runs.py +++ b/backend/fluksio/flow/runs.py @@ -403,14 +403,15 @@ def sweep_artifacts( return 0 keep = set(session.exec(select(col(RunArtifact.digest)).distinct()).all()) - for name in flows.list_flows() if flows else (): - for draft in (False, True): - try: - flow = flows.read_flow(name, draft=draft) - except FlowNotFound: - continue - for declared in flow.inputs: - _references_in(declared.initial, keep) + if flows is not None: + for name in flows.list_flows(): + for draft in (False, True): + try: + flow = flows.read_flow(name, draft=draft) + except FlowNotFound: + continue + for declared in flow.inputs: + _references_in(declared.initial, keep) keys = state.keys() for start in range(0, len(keys), _SWEEP_BATCH):