'
@@ -749,7 +747,7 @@ def html_history_search(translate: {}, base_dir: str,
historysearch = historysearch.lower().strip('\n').strip('\r')
- box_filenames = \
+ box_filenames: str = \
search_box_posts(base_dir, nickname, domain,
historysearch, posts_per_page, box_name)
if box_name == 'outbox':
@@ -757,21 +755,20 @@ def html_history_search(translate: {}, base_dir: str,
search_box_posts(base_dir, nickname, domain,
historysearch, posts_per_page, 'inbox')
- css_filename = base_dir + '/epicyon-profile.css'
+ css_filename: str = base_dir + '/epicyon-profile.css'
if is_a_file(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
- instance_title = \
- get_config_param(base_dir, 'instanceTitle')
+ instance_title: str = get_config_param(base_dir, 'instanceTitle')
preload_images: list[str] = []
- history_search_form = \
+ history_search_form: str = \
html_header_with_external_style(css_filename, instance_title, None,
preload_images)
# add the page title
- domain_full = get_full_domain(domain, port)
- actor = local_actor_url(http_prefix, nickname, domain_full)
- history_search_title = '🔍 ' + translate['Your Posts']
+ domain_full: str = get_full_domain(domain, port)
+ actor: str = local_actor_url(http_prefix, nickname, domain_full)
+ history_search_title: str = '🔍 ' + translate['Your Posts']
if box_name == 'bookmarks':
history_search_title = '🔍 ' + translate['Bookmarks']
@@ -802,7 +799,7 @@ def html_history_search(translate: {}, base_dir: str,
history_search_form += html_footer()
return history_search_form
- separator_str = html_post_separator(base_dir, None)
+ separator_str: str = html_post_separator(base_dir, None)
# ensure that the page number is in bounds
if not page_number:
@@ -811,29 +808,30 @@ def html_history_search(translate: {}, base_dir: str,
page_number = 1
# get the start end end within the index file
- start_index = int((page_number - 1) * posts_per_page)
- end_index = start_index + posts_per_page
- no_of_box_filenames = len(box_filenames)
+ start_index: int = int((page_number - 1) * posts_per_page)
+ end_index: int = start_index + posts_per_page
+ no_of_box_filenames: int = len(box_filenames)
if end_index >= no_of_box_filenames and no_of_box_filenames > 0:
end_index = no_of_box_filenames - 1
- index = start_index
+ index: int = start_index
minimize_all_images: bool = False
if nickname in min_images_for_accounts:
minimize_all_images = True
while index <= end_index:
- post_filename = box_filenames[index]
+ post_filename: str = box_filenames[index]
if not post_filename:
index += 1
continue
- post_json_object = load_json(post_filename)
+ post_json_object: dict = load_json(post_filename)
if not post_json_object:
index += 1
continue
- show_individual_post_icons = True
+ show_individual_post_icons: bool = True
allow_deletion: bool = False
# get the list of mutuals for the current account
- mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
+ mutuals_list: list[str] = \
+ get_mutuals_of_person(base_dir, nickname, domain)
post_str = \
individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache,
@@ -910,7 +908,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
if hashtag.startswith('#'):
hashtag = hashtag[1:]
hashtag = urllib.parse.unquote(hashtag)
- hashtag_index_file = base_dir + '/tags/' + hashtag + '.txt'
+ hashtag_index_file: str = base_dir + '/tags/' + hashtag + '.txt'
if not is_a_file(hashtag_index_file):
if hashtag != hashtag.lower():
hashtag = hashtag.lower()
@@ -919,11 +917,11 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
print('WARN: hashtag file not found ' + hashtag_index_file)
return None
- separator_str = html_post_separator(base_dir, None)
+ separator_str: str = html_post_separator(base_dir, None)
# check that the directory for the nickname exists
if nickname:
- account_dir = acct_dir(base_dir, nickname, domain)
+ account_dir: str = acct_dir(base_dir, nickname, domain)
if not is_a_dir(account_dir):
nickname = None
@@ -936,7 +934,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
return None
# read the css
- css_filename = base_dir + '/epicyon-profile.css'
+ css_filename: str = base_dir + '/epicyon-profile.css'
if is_a_file(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
@@ -947,16 +945,15 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
page_number = 1
# get the start end end within the index file
- start_index = int((page_number - 1) * posts_per_page)
- end_index = start_index + posts_per_page
- no_of_lines = len(lines)
+ start_index: int = int((page_number - 1) * posts_per_page)
+ end_index: int = start_index + posts_per_page
+ no_of_lines: int = len(lines)
if end_index >= no_of_lines and no_of_lines > 0:
end_index = no_of_lines - 1
- instance_title = \
- get_config_param(base_dir, 'instanceTitle')
+ instance_title: str = get_config_param(base_dir, 'instanceTitle')
preload_images: list[str] = []
- hashtag_search_form = \
+ hashtag_search_form: str = \
html_header_with_external_style(css_filename, instance_title, None,
preload_images)
@@ -994,15 +991,16 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
'icons/logorss.png" />\n'
# maps for geolocations with this hashtag
- maps_str = html_hashtag_maps(base_dir, hashtag, translate, map_format,
- nickname, domain, session, ua_str)
+ maps_str: str = \
+ html_hashtag_maps(base_dir, hashtag, translate, map_format,
+ nickname, domain, session, ua_str)
if maps_str:
maps_str = '
' + maps_str + '\n'
hashtag_search_form += maps_str
# edit the category for this hashtag
if is_editor(base_dir, nickname):
- category = get_hashtag_category(base_dir, hashtag)
+ category: str = get_hashtag_category(base_dir, hashtag)
hashtag_search_form += '
\n'
hashtag_search_form += '
\n'
if admin_nickname:
- admin_actor = '/users/' + admin_nickname
+ admin_actor: str = '/users/' + admin_nickname
specification_form += \
'
\n' + \
'' + \
diff --git a/webapp_suspended.py b/webapp_suspended.py
index 1e3d44eef..e91d3301e 100644
--- a/webapp_suspended.py
+++ b/webapp_suspended.py
@@ -17,12 +17,11 @@ def html_suspended(base_dir: str) -> str:
"""Show the screen for suspended accounts
"""
suspended_form: str = ''
- css_filename = base_dir + '/epicyon-suspended.css'
+ css_filename: str = base_dir + '/epicyon-suspended.css'
if is_a_file(base_dir + '/suspended.css'):
css_filename = base_dir + '/suspended.css'
- instance_title = \
- get_config_param(base_dir, 'instanceTitle')
+ instance_title: str = get_config_param(base_dir, 'instanceTitle')
preload_images: list[str] = []
suspended_form = \
html_header_with_external_style(css_filename, instance_title, None,