From 9f03aa51ce1be3b70e31cb6c03ab64e8504999ce Mon Sep 17 00:00:00 2001 From: bashrc Date: Wed, 22 Jul 2026 12:34:38 +0100 Subject: [PATCH] Less indentation --- src/daemon_get_collections.py | 51 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/daemon_get_collections.py b/src/daemon_get_collections.py index f9ed2a91c..25ebe80de 100644 --- a/src/daemon_get_collections.py +++ b/src/daemon_get_collections.py @@ -205,32 +205,31 @@ def get_featured_tags_collection(self, calling_domain: str, 'totalItems': 0, 'type': 'Collection' } - if is_a_dir(account_dir): - featured_tags_filename: str = \ - account_dir + '/featured_hashtags.txt' - if is_a_file(featured_tags_filename): - hashtags_str: str = \ - load_string(featured_tags_filename, - 'EX: unable to load featured hashtags ' + - featured_tags_filename) - if hashtags_str: - separator = ' ' - if ',' in hashtags_str: - separator = ',' - hashtags_list: list[str] = hashtags_str.split(separator) - for tag in hashtags_list: - tag = tag.strip().replace('#', '') - if not tag: - continue - url = http_prefix + '://' + domain_full + '/tagged/' + tag - tag_dict = { - 'href': url, - 'name': '#' + tag, - 'type': 'Hashtag' - } - featured_tags_collection['items'].append(tag_dict) - featured_tags_collection['totalItems'] = \ - featured_tags_collection['totalItems'] + 1 + featured_tags_filename: str = \ + account_dir + '/featured_hashtags.txt' + if is_a_dir(account_dir) and is_a_file(featured_tags_filename): + hashtags_str: str = \ + load_string(featured_tags_filename, + 'EX: unable to load featured hashtags ' + + featured_tags_filename) + if hashtags_str: + separator = ' ' + if ',' in hashtags_str: + separator = ',' + hashtags_list: list[str] = hashtags_str.split(separator) + for tag in hashtags_list: + tag = tag.strip().replace('#', '') + if not tag: + continue + url = http_prefix + '://' + domain_full + '/tagged/' + tag + tag_dict = { + 'href': url, + 'name': '#' + tag, + 'type': 'Hashtag' + } + featured_tags_collection['items'].append(tag_dict) + featured_tags_collection['totalItems'] = \ + featured_tags_collection['totalItems'] + 1 msg_str = json.dumps(featured_tags_collection, ensure_ascii=False) msg_str = convert_domains(calling_domain,