Variable types

main
bashrc 2026-05-05 15:07:45 +01:00
parent ae0534200d
commit e0b866c631
5 changed files with 15 additions and 14 deletions

View File

@ -602,13 +602,14 @@ def update_blocked_cache(base_dir: str,
if blocked_cache_last_updated > curr_time:
print('WARN: Cache updated in the future')
blocked_cache_last_updated: int = 0
seconds_since_last_update = curr_time - blocked_cache_last_updated
seconds_since_last_update: int = curr_time - blocked_cache_last_updated
if seconds_since_last_update < blocked_cache_update_secs:
return blocked_cache_last_updated
global_blocking_filename = data_dir(base_dir) + '/blocking.txt'
global_blocking_filename: str = data_dir(base_dir) + '/blocking.txt'
if not is_a_file(global_blocking_filename):
return blocked_cache_last_updated
blocked_lines = load_list(global_blocking_filename,
blocked_lines: list[str] = \
load_list(global_blocking_filename,
'EX: update_blocked_cache unable to read ' +
global_blocking_filename + ' [ex]')
if blocked_lines is None:
@ -627,7 +628,7 @@ def _get_short_domain(domain: str) -> str:
who constantly change their subdomain
e.g. subdomain123.mydomain.com becomes mydomain.com
"""
sections = domain.split('.')
sections: list[str] = domain.split('.')
no_of_sections = len(sections)
if no_of_sections > 2:
return sections[no_of_sections-2] + '.' + sections[-1]

View File

@ -1472,7 +1472,7 @@ def add_html_tags(base_dir: str, http_prefix: str,
content = content.replace('#' + now_playing_lower_str,
'#' + now_playing_str)
content = _add_music_tag(content, now_playing_str)
words = _get_simplified_content(content).split(' ')
words: list[str] = _get_simplified_content(content).split(' ')
# remove . for words which are not mentions
new_words: list[str] = []

View File

@ -2257,7 +2257,7 @@ class JsonLdProcessor(object):
# continue to hash bnode quads while bnodes are assigned names
unnamed = None
next_unnamed = bnodes.keys()
duplicates = None
duplicates: dict = None
while True:
unnamed = next_unnamed
next_unnamed = []

View File

@ -102,7 +102,7 @@ def _search_virtual_box_posts(base_dir: str, nickname: str, domain: str,
search_str = search_str.lower().strip()
if '+' in search_str:
search_words = search_str.split('+')
search_words: list[str] = search_str.split('+')
for index, _ in enumerate(search_words):
search_words[index] = search_words[index].strip()
print('SEARCH: ' + str(search_words))
@ -160,7 +160,7 @@ def search_box_posts(base_dir: str, nickname: str, domain: str,
search_str = search_str.lower().strip()
if '+' in search_str:
search_words = search_str.split('+')
search_words: list[str] = search_str.split('+')
for index, _ in enumerate(search_words):
search_words[index] = search_words[index].strip()
print('SEARCH: ' + str(search_words))

View File

@ -384,7 +384,7 @@ def get_media_descriptions_from_post(post_json_object: {}) -> str:
"""Returns all attached media descriptions as a single text.
This is used for filtering
"""
post_attachments = get_post_attachments(post_json_object)
post_attachments: list[dict] = get_post_attachments(post_json_object)
if not post_attachments:
return ''
descriptions: str = ''
@ -707,10 +707,10 @@ def get_memorials(base_dir: str) -> str:
if not is_a_file(memorial_file):
return ''
memorial_str = load_string(memorial_file,
'EX: unable to read ' + memorial_file)
memorial_str: str = \
load_string(memorial_file, 'EX: unable to read ' + memorial_file)
if memorial_str is None:
memorial_str: str = ''
memorial_str = ''
return memorial_str