From eff7c73a229c2548e8324b7186163de5087f685a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9r=C3=A9nice=20Batut?= Date: Tue, 31 Oct 2023 15:01:55 +0100 Subject: [PATCH] Restructure check_categories function Co-authored-by: Nicola Soranzo --- bin/extract_galaxy_tools.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/extract_galaxy_tools.py b/bin/extract_galaxy_tools.py index eb905ae4..bd2124c2 100644 --- a/bin/extract_galaxy_tools.py +++ b/bin/extract_galaxy_tools.py @@ -134,14 +134,12 @@ def check_categories(ts_categories, ts_cat): :param ts_categories: tool ToolShed categories :param ts_cat: list of ToolShed categories to keep in the extraction """ - if ts_categories is not None and len(ts_cat) > 0: + if not ts_cat: + return True + if not ts_categories: + return False ts_cats = ts_categories.split(", ") - to_keep = False - for cat in ts_cats: - if cat in ts_cat: - to_keep = True - return to_keep - return True + return bool(set(ts_cat) & set(ts_cats)) def get_tool_metadata(tool: ContentFile, repo: Repository) -> :