Check break after walk

merge-requests/25/head
Bob Mottram 2022-07-22 10:58:42 +01:00
parent 9cb863a185
commit 762a5bdb3e
7 changed files with 470 additions and 452 deletions

View File

@ -1009,6 +1009,8 @@ def load_cw_lists(base_dir: str, verbose: bool) -> {}:
if not os.path.isdir(base_dir + '/cwlists'):
return {}
result = {}
# NOTE: here we do want to allow recursive walk through
# possible subdirectories
for _, _, files in os.walk(base_dir + '/cwlists'):
for fname in files:
if not fname.endswith('.json'):

View File

@ -452,6 +452,7 @@ def _create_news_mirror(base_dir: str, domain: str,
no_of_dirs = 0
for _, dirs, _ in os.walk(mirror_dir):
no_of_dirs = len(dirs)
break
mirror_index_filename = base_dir + '/accounts/newsmirror.txt'

914
sbom.json

File diff suppressed because it is too large Load Diff

View File

@ -1333,6 +1333,7 @@ def shares_catalog_endpoint(base_dir: str, http_prefix: str,
"DFC:description": description
}
endpoint['DFC:supplies'].append(catalog_item)
break
return endpoint

View File

@ -5088,6 +5088,7 @@ def _test_thread_functions():
threads_called_in_modules = []
# get the source for each module
# Allow recursive walk
for _, _, files in os.walk('.'):
for source_file in files:
if not source_file.endswith('.py'):

View File

@ -933,6 +933,7 @@ def update_default_themes_list(base_dir: str) -> None:
def scan_themes_for_scripts(base_dir: str) -> bool:
"""Scans the theme directory for any svg files containing scripts
"""
# allow recursive walk
for subdir, _, files in os.walk(base_dir + '/theme'):
for fname in files:
if not fname.endswith('.svg'):

View File

@ -1559,7 +1559,7 @@ def clear_from_post_caches(base_dir: str, recent_posts_cache: {},
to news will appear
"""
filename = '/postcache/' + post_id + '.html'
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
for _, dirs, _ in os.walk(base_dir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue