Variable types

main
bashrc 2026-04-27 21:40:38 +01:00
parent 7154baeff4
commit a400bcf21f
7 changed files with 81 additions and 81 deletions

View File

@ -222,7 +222,7 @@ def _html_shares_result(base_dir: str, shares_json: {}, page_number: int,
shares_file_type: str) -> (bool, int, int, str): shares_file_type: str) -> (bool, int, int, str):
"""Result for shared items search """Result for shared items search
""" """
shared_items_form = '' shared_items_form: str = ''
if curr_page > page_number: if curr_page > page_number:
return results_exist, curr_page, ctr, shared_items_form return results_exist, curr_page, ctr, shared_items_form
@ -276,7 +276,7 @@ def html_search_shared_items(translate: {},
""" """
curr_page = 1 curr_page = 1
ctr = 0 ctr = 0
shared_items_form = '' shared_items_form: str = ''
search_str_lower = urllib.parse.unquote(search_str) search_str_lower = urllib.parse.unquote(search_str)
search_str_lower = search_str_lower.lower().strip('\n').strip('\r') search_str_lower = search_str_lower.lower().strip('\n').strip('\r')
search_str_lower_list = search_str_lower.split('+') search_str_lower_list = search_str_lower.split('+')
@ -491,7 +491,7 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str,
text_mode_banner_str = html_keyboard_navigation(text_mode_banner, {}, {}, text_mode_banner_str = html_keyboard_navigation(text_mode_banner, {}, {},
None, None, None, False) None, None, None, False)
if text_mode_banner_str is None: if text_mode_banner_str is None:
text_mode_banner_str = '' text_mode_banner_str: str = ''
if os.path.isfile(search_banner_filename): if os.path.isfile(search_banner_filename):
timeline_key = access_keys['menuTimeline'] timeline_key = access_keys['menuTimeline']
@ -525,7 +525,7 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str,
cached_hashtag_swarm_filename = \ cached_hashtag_swarm_filename = \
acct_dir(base_dir, search_nickname, domain) + '/.hashtagSwarm' acct_dir(base_dir, search_nickname, domain) + '/.hashtagSwarm'
swarm_str = '' swarm_str: str = ''
if os.path.isfile(cached_hashtag_swarm_filename): if os.path.isfile(cached_hashtag_swarm_filename):
swarm_str = \ swarm_str = \
load_string(cached_hashtag_swarm_filename, load_string(cached_hashtag_swarm_filename,
@ -533,7 +533,7 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str,
'html_search unable to read cached hashtag swarm ' + 'html_search unable to read cached hashtag swarm ' +
cached_hashtag_swarm_filename) cached_hashtag_swarm_filename)
if swarm_str is None: if swarm_str is None:
swarm_str = '' swarm_str: str = ''
if not swarm_str: if not swarm_str:
swarm_str = html_hash_tag_swarm(base_dir, actor, translate) swarm_str = html_hash_tag_swarm(base_dir, actor, translate)
if swarm_str: if swarm_str:

View File

@ -43,7 +43,7 @@ def html_specification(base_dir: str, http_prefix: str,
md_text = markdown_example_numbers(md_text) md_text = markdown_example_numbers(md_text)
specification_text = markdown_to_html(md_text) specification_text = markdown_to_html(md_text)
specification_form = '' specification_form: str = ''
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'

View File

@ -16,7 +16,7 @@ from webapp_utils import html_footer
def html_suspended(base_dir: str) -> str: def html_suspended(base_dir: str) -> str:
"""Show the screen for suspended accounts """Show the screen for suspended accounts
""" """
suspended_form = '' suspended_form: str = ''
css_filename = base_dir + '/epicyon-suspended.css' css_filename = base_dir + '/epicyon-suspended.css'
if os.path.isfile(base_dir + '/suspended.css'): if os.path.isfile(base_dir + '/suspended.css'):
css_filename = base_dir + '/suspended.css' css_filename = base_dir + '/suspended.css'

View File

@ -186,7 +186,7 @@ def html_theme_designer(base_dir: str,
for variable_name, value in custom_theme_params.items(): for variable_name, value in custom_theme_params.items():
theme_json[variable_name] = value theme_json[variable_name] = value
theme_form = '' theme_form: str = ''
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'
@ -228,7 +228,7 @@ def html_theme_designer(base_dir: str,
'name="submitThemeDesigner" accesskey="' + submit_key + '">' + \ 'name="submitThemeDesigner" accesskey="' + submit_key + '">' + \
translate['Save'] + '</button>\n </center>\n' translate['Save'] + '</button>\n </center>\n'
contrast_warning = '' contrast_warning: str = ''
if theme_json.get('main-bg-color'): if theme_json.get('main-bg-color'):
background = theme_json['main-bg-color'] background = theme_json['main-bg-color']
if theme_json.get('main-fg-color'): if theme_json.get('main-fg-color'):
@ -320,7 +320,7 @@ def html_theme_designer(base_dir: str,
switch_str += \ switch_str += \
' <tr><td><label class="labels">' + \ ' <tr><td><label class="labels">' + \
variable_name_str + '</label></td>' variable_name_str + '</label></td>'
checked_str = '' checked_str: str = ''
if value.title() == 'True': if value.title() == 'True':
checked_str = ' checked' checked_str = ' checked'
switch_str += \ switch_str += \

View File

@ -121,7 +121,7 @@ def _html_timeline_new_post(manually_approve_followers: bool,
access_keys: {}) -> str: access_keys: {}) -> str:
"""Returns html for the new post button """Returns html for the new post button
""" """
new_post_button_str = '' new_post_button_str: str = ''
if box_name == 'dm': if box_name == 'dm':
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
@ -191,7 +191,7 @@ def _html_timeline_moderation_buttons(moderator: bool, box_name: str,
translate: {}) -> str: translate: {}) -> str:
"""Returns html for the moderation screen buttons """Returns html for the moderation screen buttons
""" """
tl_str = '' tl_str: str = ''
if moderator and box_name == 'moderation': if moderator and box_name == 'moderation':
tl_str += \ tl_str += \
'<form id="modtimeline" method="POST" action="/users/' + \ '<form id="modtimeline" method="POST" action="/users/' + \
@ -379,7 +379,7 @@ def _html_timeline_end(base_dir: str, nickname: str, domain_full: str,
tl_str += ' </td>\n' tl_str += ' </td>\n'
# right column # right column
right_column_str = '' right_column_str: str = ''
if not text_mode_browser(ua_str): if not text_mode_browser(ua_str):
right_column_str = \ right_column_str = \
get_right_column_content(base_dir, nickname, domain_full, get_right_column_content(base_dir, nickname, domain_full,
@ -416,15 +416,15 @@ def page_number_buttons(users_path: str, box_name: str,
min_page_number = page_number - pages_width min_page_number = page_number - pages_width
min_page_number = max(min_page_number, 1) min_page_number = max(min_page_number, 1)
max_page_number = min_page_number + 1 + (pages_width * 2) max_page_number = min_page_number + 1 + (pages_width * 2)
num_str = '' num_str: str = ''
for page in range(min_page_number, max_page_number): for page in range(min_page_number, max_page_number):
if num_str: if num_str:
separator_str = \ separator_str = \
'<label class="pageslistDash">────</label>' '<label class="pageslistDash">────</label>'
num_str += html_hide_from_screen_reader(separator_str) num_str += html_hide_from_screen_reader(separator_str)
aria_page_str = '' aria_page_str: str = ''
page_str = ' ' + str(page) + ' ' page_str = ' ' + str(page) + ' '
curr_page_str = '' curr_page_str: str = ''
if page == page_number: if page == page_number:
page_str = '[<mark>' + str(page) + '</mark>]' page_str = '[<mark>' + str(page) + '</mark>]'
aria_page_str = ' aria-current="true"' aria_page_str = ' aria-current="true"'
@ -574,7 +574,7 @@ def html_timeline(default_timeline: str,
if os.path.isfile(show_vote_file): if os.path.isfile(show_vote_file):
show_vote_posts = False show_vote_posts = False
separator_str = '' separator_str: str = ''
if box_name != 'tlmedia': if box_name != 'tlmedia':
separator_str = html_post_separator(base_dir, None) separator_str = html_post_separator(base_dir, None)
@ -660,7 +660,7 @@ def html_timeline(default_timeline: str,
show_individual_post_icons = True show_individual_post_icons = True
# show an icon for new follow approvals # show an icon for new follow approvals
follow_approvals = '' follow_approvals: str = ''
follow_requests_filename = \ follow_requests_filename = \
acct_dir(base_dir, nickname, domain) + '/followrequests.txt' acct_dir(base_dir, nickname, domain) + '/followrequests.txt'
if os.path.isfile(follow_requests_filename): if os.path.isfile(follow_requests_filename):
@ -690,7 +690,7 @@ def html_timeline(default_timeline: str,
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '3') _log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '3')
# moderation / reports button # moderation / reports button
moderation_button_str = '' moderation_button_str: str = ''
if moderator and not minimal: if moderator and not minimal:
moderation_button_str = \ moderation_button_str = \
'<a href="' + users_path + '/moderation"' '<a href="' + users_path + '/moderation"'
@ -703,10 +703,10 @@ def html_timeline(default_timeline: str,
' </span></button></a>' ' </span></button></a>'
# shares, bookmarks and events buttons # shares, bookmarks and events buttons
shares_button_str = '' shares_button_str: str = ''
wanted_button_str = '' wanted_button_str: str = ''
bookmarks_button_str = '' bookmarks_button_str: str = ''
events_button_str = '' events_button_str: str = ''
if not minimal: if not minimal:
shares_button_str = \ shares_button_str = \
'<a href="' + users_path + '/tlshares"' '<a href="' + users_path + '/tlshares"'
@ -781,7 +781,7 @@ def html_timeline(default_timeline: str,
if default_timeline == 'tlfeatures' and box_name == 'tlfeatures': if default_timeline == 'tlfeatures' and box_name == 'tlfeatures':
news_header = True news_header = True
header_icons_str = '' header_icons_str: str = ''
# start of headericons div # start of headericons div
if not news_header: if not news_header:
header_icons_str = '<div class="headericons">' header_icons_str = '<div class="headericons">'
@ -848,7 +848,7 @@ def html_timeline(default_timeline: str,
domain_full = get_full_domain(domain, port) domain_full = get_full_domain(domain, port)
# left column # left column
left_column_str = '' left_column_str: str = ''
if not is_text_browser: if not is_text_browser:
left_column_str = \ left_column_str = \
get_left_column_content(base_dir, nickname, domain_full, get_left_column_content(base_dir, nickname, domain_full,
@ -972,7 +972,7 @@ def html_timeline(default_timeline: str,
text_mode_separator = \ text_mode_separator = \
'<div class="transparent"><hr></div>' '<div class="transparent"><hr></div>'
else: else:
text_mode_separator = '' text_mode_separator: str = ''
# page up arrow # page up arrow
if page_number > 1 or is_text_browser: if page_number > 1 or is_text_browser:
@ -980,7 +980,7 @@ def html_timeline(default_timeline: str,
tl_str += '<br>' + \ tl_str += '<br>' + \
page_number_buttons(users_path, box_name, page_number, page_number_buttons(users_path, box_name, page_number,
'timelineposts') 'timelineposts')
first_post_str = '' first_post_str: str = ''
if page_number > 2: if page_number > 2:
if last_post_id: if last_post_id:
first_post_str = ';firstpost=' + last_post_id first_post_str = ';firstpost=' + last_post_id
@ -1009,10 +1009,10 @@ def html_timeline(default_timeline: str,
if box_name == 'inbox': if box_name == 'inbox':
use_cache_only = True use_cache_only = True
first_post_id = '' first_post_id: str = ''
last_post_id = '' last_post_id: str = ''
last_item_str = '' last_item_str: str = ''
if timeline_json: if timeline_json:
# if this is the media timeline then add an extra gallery container # if this is the media timeline then add an extra gallery container
if box_name == 'tlmedia': if box_name == 'tlmedia':
@ -1033,7 +1033,7 @@ def html_timeline(default_timeline: str,
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain) mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
# show each post in the timeline # show each post in the timeline
tl_items_str = '' tl_items_str: str = ''
for item in timeline_json['orderedItems']: for item in timeline_json['orderedItems']:
if item['type'] in ('Create', 'Announce'): if item['type'] in ('Create', 'Announce'):
# is the actor who sent this post snoozed? # is the actor who sent this post snoozed?
@ -1162,10 +1162,10 @@ def html_timeline(default_timeline: str,
if item_ctr > items_per_page / 2: if item_ctr > items_per_page / 2:
tl_str = tl_str.replace(last_item_str, '') tl_str = tl_str.replace(last_item_str, '')
tl_str += text_mode_separator tl_str += text_mode_separator
first_post = '' first_post: str = ''
if last_post_id: if last_post_id:
first_post = ';firstpost=' + last_post_id.replace('#', '--') first_post = ';firstpost=' + last_post_id.replace('#', '--')
last_post = '' last_post: str = ''
if first_post_id: if first_post_id:
last_post = ';lastpost=' + first_post_id.replace('#', '--') last_post = ';lastpost=' + first_post_id.replace('#', '--')
tl_str += \ tl_str += \
@ -1303,11 +1303,11 @@ def _html_shares_timeline(translate: {}, page_number: int, items_per_page: int,
domain_full = get_full_domain(domain, port) domain_full = get_full_domain(domain, port)
actor = local_actor_url(http_prefix, nickname, domain_full) actor = local_actor_url(http_prefix, nickname, domain_full)
admin_nickname = get_config_param(base_dir, 'admin') admin_nickname = get_config_param(base_dir, 'admin')
admin_actor = '' admin_actor: str = ''
if admin_nickname: if admin_nickname:
admin_actor = \ admin_actor = \
local_actor_url(http_prefix, admin_nickname, domain_full) local_actor_url(http_prefix, admin_nickname, domain_full)
timeline_str = '' timeline_str: str = ''
if page_number > 1: if page_number > 1:
timeline_str += '<br>' + \ timeline_str += '<br>' + \

View File

@ -42,7 +42,7 @@ def html_terms_of_service(base_dir: str,
if tos_text_str: if tos_text_str:
tos_text = markdown_to_html(tos_text_str) tos_text = markdown_to_html(tos_text_str)
tos_form = '' tos_form: str = ''
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'

View File

@ -138,7 +138,7 @@ def csv_following_list(following_filename: str,
following_list = msg.split('\n') following_list = msg.split('\n')
following_list.sort() following_list.sort()
if following_list: if following_list:
following_list_csv = '' following_list_csv: str = ''
for following_address in following_list: for following_address in following_list:
if not following_address: if not following_address:
continue continue
@ -153,7 +153,7 @@ def csv_following_list(following_filename: str,
following_nickname, following_nickname,
following_domain) following_domain)
notify_on_new = 'false' notify_on_new = 'false'
languages = '' languages: str = ''
person_notes = \ person_notes = \
get_person_notes(base_dir, nickname, domain, get_person_notes(base_dir, nickname, domain,
following_address) following_address)
@ -184,7 +184,7 @@ def csv_following_list(following_filename: str,
def html_hashtag_blocked(base_dir: str, translate: {}) -> str: def html_hashtag_blocked(base_dir: str, translate: {}) -> str:
"""Show the screen for a blocked hashtag """Show the screen for a blocked hashtag
""" """
blocked_hashtag_form = '' blocked_hashtag_form: str = ''
css_filename = base_dir + '/epicyon-suspended.css' css_filename = base_dir + '/epicyon-suspended.css'
if os.path.isfile(base_dir + '/suspended.css'): if os.path.isfile(base_dir + '/suspended.css'):
css_filename = base_dir + '/suspended.css' css_filename = base_dir + '/suspended.css'
@ -212,7 +212,7 @@ def header_buttons_front_screen(translate: {},
authorized: bool) -> str: authorized: bool) -> str:
"""Returns the header buttons for the front page of a news instance """Returns the header buttons for the front page of a news instance
""" """
header_str = '' header_str: str = ''
if nickname == 'news': if nickname == 'news':
button_features = 'buttonMobile' button_features = 'buttonMobile'
if box_name == 'features': if box_name == 'features':
@ -729,11 +729,11 @@ def html_header_with_external_style(css_filename: str, instance_title: str,
metadata: str, preload_images: [], metadata: str, preload_images: [],
lang: str = 'en') -> str: lang: str = 'en') -> str:
if metadata is None: if metadata is None:
metadata = '' metadata: str = ''
css_file = '/' + css_filename.split('/')[-1] css_file = '/' + css_filename.split('/')[-1]
pwa_theme_color, pwa_theme_background_color = \ pwa_theme_color, pwa_theme_background_color = \
get_pwa_theme_colors(css_filename) get_pwa_theme_colors(css_filename)
preload_images_str = '' preload_images_str: str = ''
if preload_images: if preload_images:
for image_path in preload_images: for image_path in preload_images:
preload_images_str += \ preload_images_str += \
@ -784,11 +784,11 @@ def html_header_with_person_markup(css_filename: str, instance_title: str,
preload_images, lang) preload_images, lang)
return html_str return html_str
city_markup = '' city_markup: str = ''
if city: if city:
city = city.lower().title() city = city.lower().title()
add_comma = '' add_comma: str = ''
country_markup = '' country_markup: str = ''
if ',' in city: if ',' in city:
country = city.split(',', 1)[1].strip().title() country = city.split(',', 1)[1].strip().title()
city = city.split(',', 1)[0] city = city.split(',', 1)[0]
@ -801,7 +801,7 @@ def html_header_with_person_markup(css_filename: str, instance_title: str,
' "addressLocality": "' + city + '"' + \ ' "addressLocality": "' + city + '"' + \
add_comma + '\n' + country_markup + ' },\n' add_comma + '\n' + country_markup + ' },\n'
skills_markup = '' skills_markup: str = ''
if actor_json.get('hasOccupation'): if actor_json.get('hasOccupation'):
if isinstance(actor_json['hasOccupation'], list): if isinstance(actor_json['hasOccupation'], list):
skills_markup = ' "hasOccupation": [\n' skills_markup = ' "hasOccupation": [\n'
@ -872,7 +872,7 @@ def html_header_with_person_markup(css_filename: str, instance_title: str,
first_entry = False first_entry = False
skills_markup += '\n ],\n' skills_markup += '\n ],\n'
description = '' description: str = ''
if actor_json.get('summary'): if actor_json.get('summary'):
description = remove_html(actor_json['summary']) description = remove_html(actor_json['summary'])
name_str = remove_html(actor_json['name']) name_str = remove_html(actor_json['name'])
@ -1103,7 +1103,7 @@ def load_individual_post_as_html_from_cache(base_dir: str,
cached_post_filename = \ cached_post_filename = \
get_cached_post_filename(base_dir, nickname, domain, post_json_object) get_cached_post_filename(base_dir, nickname, domain, post_json_object)
post_html = '' post_html: str = ''
if not cached_post_filename: if not cached_post_filename:
return post_html return post_html
@ -1278,9 +1278,9 @@ def get_post_attachments_as_html(base_dir: str,
system_language: str) -> (str, str): system_language: str) -> (str, str):
"""Returns a string representing any attachments """Returns a string representing any attachments
""" """
attachment_str = '' attachment_str: str = ''
attachment_ctr = 0 attachment_ctr: int = 0
gallery_str = '' gallery_str: str = ''
attachment_dict: list[dict] = [] attachment_dict: list[dict] = []
# handle peertube-style video posts, where the media links # handle peertube-style video posts, where the media links
@ -1342,7 +1342,7 @@ def get_post_attachments_as_html(base_dir: str,
'.' not in url: '.' not in url:
continue continue
# get the domain for the chat link # get the domain for the chat link
chat_domain_str = '' chat_domain_str: str = ''
attach_url = remove_html(url) attach_url = remove_html(url)
if attach_url in attached_urls: if attach_url in attached_urls:
continue continue
@ -1355,7 +1355,7 @@ def get_post_attachments_as_html(base_dir: str,
chat_domain_str = ' (' + chat_domain + ')' chat_domain_str = ' (' + chat_domain + ')'
# avoid displaying very long domains # avoid displaying very long domains
if len(chat_domain_str) > 50: if len(chat_domain_str) > 50:
chat_domain_str = '' chat_domain_str: str = ''
chat_url = remove_html(url) chat_url = remove_html(url)
attachment_str += \ attachment_str += \
'<p><a href="' + chat_url + \ '<p><a href="' + chat_url + \
@ -1428,7 +1428,7 @@ def get_post_attachments_as_html(base_dir: str,
if not isinstance(media_type, str): if not isinstance(media_type, str):
continue continue
media_license = '' media_license: str = ''
if attach.get('schema:license'): if attach.get('schema:license'):
if not dangerous_markup(attach['schema:license'], False, []): if not dangerous_markup(attach['schema:license'], False, []):
if not is_filtered(base_dir, nickname, domain, if not is_filtered(base_dir, nickname, domain,
@ -1449,7 +1449,7 @@ def get_post_attachments_as_html(base_dir: str,
media_license = attach['license'] media_license = attach['license']
else: else:
media_license = attach['license'] media_license = attach['license']
media_creator = '' media_creator: str = ''
if attach.get('schema:creator'): if attach.get('schema:creator'):
if len(attach['schema:creator']) < 120: if len(attach['schema:creator']) < 120:
if not dangerous_markup(attach['schema:creator'], False, []): if not dangerous_markup(attach['schema:creator'], False, []):
@ -1466,7 +1466,7 @@ def get_post_attachments_as_html(base_dir: str,
attrib_str, system_language): attrib_str, system_language):
media_creator = attrib_str media_creator = attrib_str
image_description = '' image_description: str = ''
if attach.get('name'): if attach.get('name'):
image_description = attach['name'].replace('"', "'") image_description = attach['name'].replace('"', "'")
image_description = remove_html(image_description) image_description = remove_html(image_description)
@ -1511,7 +1511,7 @@ def get_post_attachments_as_html(base_dir: str,
'decoding="async" src="' + \ 'decoding="async" src="' + \
image_url + '" alt="" title="">\n' image_url + '" alt="" title="">\n'
gallery_str += ' </a>\n' gallery_str += ' </a>\n'
license_str = '' license_str: str = ''
if media_license and media_creator: if media_license and media_creator:
media_license = remove_html(media_license) media_license = remove_html(media_license)
if resembles_url(media_license): if resembles_url(media_license):
@ -1544,7 +1544,7 @@ def get_post_attachments_as_html(base_dir: str,
# don't show the announce icon if there is no image # don't show the announce icon if there is no image
# description # description
if not image_description: if not image_description:
announce_str = '' announce_str: str = ''
gallery_str += \ gallery_str += \
' ' + reply_str + announce_str + like_str + \ ' ' + reply_str + announce_str + like_str + \
bookmark_str + delete_str + mute_str + '\n' bookmark_str + delete_str + mute_str + '\n'
@ -1600,7 +1600,7 @@ def get_post_attachments_as_html(base_dir: str,
'" alt="' + image_description + '" title="' + \ '" alt="' + image_description + '" title="' + \
image_description + '" class="attachment"></a>\n' image_description + '" class="attachment"></a>\n'
if media_license and media_creator: if media_license and media_creator:
license_str = '' license_str: str = ''
attachment_str += '<figcaption>' attachment_str += '<figcaption>'
media_license = remove_html(media_license) media_license = remove_html(media_license)
if resembles_url(media_license): if resembles_url(media_license):
@ -1793,7 +1793,7 @@ def html_post_separator(base_dir: str, column: str) -> str:
filename = 'separator_' + column + '.png' filename = 'separator_' + column + '.png'
separator_image_filename = \ separator_image_filename = \
base_dir + '/theme/' + theme + '/icons/' + filename base_dir + '/theme/' + theme + '/icons/' + filename
separator_str = '' separator_str: str = ''
if os.path.isfile(separator_image_filename): if os.path.isfile(separator_image_filename):
separator_str = \ separator_str = \
'<div class="' + separator_class + '"><center>' + \ '<div class="' + separator_class + '"><center>' + \
@ -1873,7 +1873,7 @@ def html_keyboard_navigation(banner: str, links: {}, access_keys: {},
# show the list of links # show the list of links
for title, url in links.items(): for title, url in links.items():
access_key_str = '' access_key_str: str = ''
if access_keys.get(title): if access_keys.get(title):
access_key_str = 'accesskey="' + access_keys[title] + '"' access_key_str = 'accesskey="' + access_keys[title] + '"'
@ -1904,14 +1904,14 @@ def edit_text_field(label: str, name: str, value: str = "",
"""Returns html for editing a text field """Returns html for editing a text field
""" """
if value is None: if value is None:
value = '' value: str = ''
placeholder_str = '' placeholder_str: str = ''
if placeholder: if placeholder:
placeholder_str = ' placeholder="' + placeholder + '"' placeholder_str = ' placeholder="' + placeholder + '"'
required_str = '' required_str: str = ''
if required: if required:
required_str = ' required' required_str = ' required'
text_field_str = '' text_field_str: str = ''
if label: if label:
text_field_str = \ text_field_str = \
'<label class="labels">' + label + '</label><br>\n' '<label class="labels">' + label + '</label><br>\n'
@ -1927,8 +1927,8 @@ def edit_number_field(label: str, name: str, value: int,
"""Returns html for editing an integer number field """Returns html for editing an integer number field
""" """
if value is None: if value is None:
value = '' value: str = ''
placeholder_str = '' placeholder_str: str = ''
if placeholder: if placeholder:
placeholder_str = ' placeholder="' + str(placeholder) + '"' placeholder_str = ' placeholder="' + str(placeholder) + '"'
return \ return \
@ -1944,11 +1944,11 @@ def edit_currency_field(label: str, name: str, value: str,
""" """
if value is None: if value is None:
value = '0.00' value = '0.00'
placeholder_str = '' placeholder_str: str = ''
if placeholder: if placeholder:
if placeholder.isdigit(): if placeholder.isdigit():
placeholder_str = ' placeholder="' + str(placeholder) + '"' placeholder_str = ' placeholder="' + str(placeholder) + '"'
required_str = '' required_str: str = ''
if required: if required:
required_str = ' required' required_str = ' required'
return \ return \
@ -1962,7 +1962,7 @@ def edit_currency_field(label: str, name: str, value: str,
def edit_check_box(label: str, name: str, checked: bool) -> str: def edit_check_box(label: str, name: str, checked: bool) -> str:
"""Returns html for editing a checkbox field """Returns html for editing a checkbox field
""" """
checked_str = '' checked_str: str = ''
if checked: if checked:
checked_str = ' checked' checked_str = ' checked'
@ -1976,8 +1976,8 @@ def edit_text_area(label: str, subtitle: str, name: str, value: str,
"""Returns html for editing a textarea field """Returns html for editing a textarea field
""" """
if value is None: if value is None:
value = '' value: str = ''
text = '' text: str = ''
if label: if label:
text = '<label class="labels">' + label + '</label><br>\n' text = '<label class="labels">' + label + '</label><br>\n'
if subtitle: if subtitle:
@ -2215,7 +2215,7 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str:
return '' return ''
line_ctr = 0 line_ctr = 0
ctr = 0 ctr = 0
html_str = '' html_str: str = ''
while ctr < no_of_emoji and line_ctr < len(common_emoji): while ctr < no_of_emoji and line_ctr < len(common_emoji):
name_initial = common_emoji[line_ctr].split(' ') name_initial = common_emoji[line_ctr].split(' ')
if len(name_initial) < 2: if len(name_initial) < 2:
@ -2278,7 +2278,7 @@ def html_following_data_list(base_dir: str, nickname: str,
list_str = '<datalist id="' + following_type + 'Handles">\n' list_str = '<datalist id="' + following_type + 'Handles">\n'
following_filename = \ following_filename = \
acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt' acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt'
msg = '' msg: str = ''
if os.path.isfile(following_filename): if os.path.isfile(following_filename):
msg = load_string(following_filename, msg = load_string(following_filename,
'EX: html_following_data_list unable to read ' + 'EX: html_following_data_list unable to read ' +
@ -2288,7 +2288,7 @@ def html_following_data_list(base_dir: str, nickname: str,
# to yourself as reminders # to yourself as reminders
msg += nickname + '@' + domain_full + '\n' msg += nickname + '@' + domain_full + '\n'
else: else:
msg = '' msg: str = ''
if msg: if msg:
# include petnames # include petnames
petnames_filename = \ petnames_filename = \
@ -2331,7 +2331,7 @@ def html_following_dropdown(base_dir: str, nickname: str,
list_str = '<select name="searchtext">\n' list_str = '<select name="searchtext">\n'
following_filename = \ following_filename = \
acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt' acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt'
msg = '' msg: str = ''
if os.path.isfile(following_filename): if os.path.isfile(following_filename):
msg = load_string(following_filename, msg = load_string(following_filename,
'EX: html_following_dropdown unable to read ' + 'EX: html_following_dropdown unable to read ' +
@ -2341,7 +2341,7 @@ def html_following_dropdown(base_dir: str, nickname: str,
# to yourself as reminders # to yourself as reminders
msg += nickname + '@' + domain_full + '\n' msg += nickname + '@' + domain_full + '\n'
else: else:
msg = '' msg: str = ''
if msg: if msg:
# include petnames # include petnames
petnames_filename = \ petnames_filename = \
@ -2377,7 +2377,7 @@ def html_following_dropdown(base_dir: str, nickname: str,
foll_nick + '@' + foll_domain) foll_nick + '@' + foll_domain)
domain_sorted_list.sort() domain_sorted_list.sort()
prev_foll_domain = '' prev_foll_domain: str = ''
for following_line in domain_sorted_list: for following_line in domain_sorted_list:
following_address = following_line.split(' ')[1] following_address = following_line.split(' ')[1]
foll_domain, _ = get_domain_from_actor(following_address) foll_domain, _ = get_domain_from_actor(following_address)
@ -2475,7 +2475,7 @@ def html_known_epicyon_instances(base_dir: str, http_prefix: str,
translate: {}) -> str: translate: {}) -> str:
"""Show a list of known epicyon instances """Show a list of known epicyon instances
""" """
html_str = '' html_str: str = ''
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'
@ -2486,7 +2486,7 @@ def html_known_epicyon_instances(base_dir: str, http_prefix: str,
http_prefix, domain_full, http_prefix, domain_full,
system_language) system_language)
if known_epicyon_instances: if known_epicyon_instances:
instances_text = '' instances_text: str = ''
newswire_str = translate['Newswire RSS Feed'] newswire_str = translate['Newswire RSS Feed']
for instance in known_epicyon_instances: for instance in known_epicyon_instances:
http_prefix = 'https' http_prefix = 'https'
@ -2529,7 +2529,7 @@ def get_display_name_prefix(actor_type: str,
""" """
if not actor_type: if not actor_type:
return '' return ''
display_name_prefix = '' display_name_prefix: str = ''
if actor_type in ('Organization', 'Organisation'): if actor_type in ('Organization', 'Organisation'):
display_name_prefix = '<b>[' + translate['Organisation'] + ']</b> ' display_name_prefix = '<b>[' + translate['Organisation'] + ']</b> '
elif actor_type == 'Group': elif actor_type == 'Group':