From 59ec54b1719df8a8dbe69a53b8a17092cd1c21bb Mon Sep 17 00:00:00 2001 From: Dominik Reh Date: Sat, 29 Oct 2022 10:08:20 +0200 Subject: [PATCH] Fix duplicate wildcards Would occur if the extension folder was also just "wildcards" due to recursive search --- scripts/tag_autocomplete_helper.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 1969fbe..8be7049 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -30,7 +30,7 @@ EMB_PATH = FILE_DIR.joinpath('embeddings') def find_ext_wildcard_paths(): """Returns the path to the extension wildcards folder""" - found = list(EXT_PATH.rglob('**/wildcards/')) + found = list(EXT_PATH.glob('*/wildcards/')) return found @@ -56,8 +56,7 @@ def get_ext_wildcards(): for path in WILDCARD_EXT_PATHS: wildcard_files.append(path.relative_to(FILE_DIR).as_posix()) - wildcard_files.extend(p.relative_to(path).as_posix() for p in path.rglob( - "*.txt") if p.name != "put wildcards here.txt") + wildcard_files.extend(p.relative_to(path).as_posix() for p in path.rglob("*.txt") if p.name != "put wildcards here.txt") wildcard_files.append("-----") return wildcard_files @@ -99,8 +98,7 @@ write_to_temp_file('emb.txt', []) # Write wildcards to wc.txt if found if WILDCARD_PATH.exists(): - wildcards = [WILDCARD_PATH.relative_to( - FILE_DIR).as_posix()] + get_wildcards() + wildcards = [WILDCARD_PATH.relative_to(FILE_DIR).as_posix()] + get_wildcards() if wildcards: write_to_temp_file('wc.txt', wildcards)