mirror of https://gitlab.com/bashrc2/epicyon
Variable types
parent
ae0534200d
commit
e0b866c631
|
|
@ -602,13 +602,14 @@ def update_blocked_cache(base_dir: str,
|
||||||
if blocked_cache_last_updated > curr_time:
|
if blocked_cache_last_updated > curr_time:
|
||||||
print('WARN: Cache updated in the future')
|
print('WARN: Cache updated in the future')
|
||||||
blocked_cache_last_updated: int = 0
|
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:
|
if seconds_since_last_update < blocked_cache_update_secs:
|
||||||
return blocked_cache_last_updated
|
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):
|
if not is_a_file(global_blocking_filename):
|
||||||
return blocked_cache_last_updated
|
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 ' +
|
'EX: update_blocked_cache unable to read ' +
|
||||||
global_blocking_filename + ' [ex]')
|
global_blocking_filename + ' [ex]')
|
||||||
if blocked_lines is None:
|
if blocked_lines is None:
|
||||||
|
|
@ -627,7 +628,7 @@ def _get_short_domain(domain: str) -> str:
|
||||||
who constantly change their subdomain
|
who constantly change their subdomain
|
||||||
e.g. subdomain123.mydomain.com becomes mydomain.com
|
e.g. subdomain123.mydomain.com becomes mydomain.com
|
||||||
"""
|
"""
|
||||||
sections = domain.split('.')
|
sections: list[str] = domain.split('.')
|
||||||
no_of_sections = len(sections)
|
no_of_sections = len(sections)
|
||||||
if no_of_sections > 2:
|
if no_of_sections > 2:
|
||||||
return sections[no_of_sections-2] + '.' + sections[-1]
|
return sections[no_of_sections-2] + '.' + sections[-1]
|
||||||
|
|
|
||||||
|
|
@ -1472,7 +1472,7 @@ def add_html_tags(base_dir: str, http_prefix: str,
|
||||||
content = content.replace('#' + now_playing_lower_str,
|
content = content.replace('#' + now_playing_lower_str,
|
||||||
'#' + now_playing_str)
|
'#' + now_playing_str)
|
||||||
content = _add_music_tag(content, 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
|
# remove . for words which are not mentions
|
||||||
new_words: list[str] = []
|
new_words: list[str] = []
|
||||||
|
|
|
||||||
|
|
@ -2257,7 +2257,7 @@ class JsonLdProcessor(object):
|
||||||
# continue to hash bnode quads while bnodes are assigned names
|
# continue to hash bnode quads while bnodes are assigned names
|
||||||
unnamed = None
|
unnamed = None
|
||||||
next_unnamed = bnodes.keys()
|
next_unnamed = bnodes.keys()
|
||||||
duplicates = None
|
duplicates: dict = None
|
||||||
while True:
|
while True:
|
||||||
unnamed = next_unnamed
|
unnamed = next_unnamed
|
||||||
next_unnamed = []
|
next_unnamed = []
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ def _search_virtual_box_posts(base_dir: str, nickname: str, domain: str,
|
||||||
search_str = search_str.lower().strip()
|
search_str = search_str.lower().strip()
|
||||||
|
|
||||||
if '+' in search_str:
|
if '+' in search_str:
|
||||||
search_words = search_str.split('+')
|
search_words: list[str] = search_str.split('+')
|
||||||
for index, _ in enumerate(search_words):
|
for index, _ in enumerate(search_words):
|
||||||
search_words[index] = search_words[index].strip()
|
search_words[index] = search_words[index].strip()
|
||||||
print('SEARCH: ' + str(search_words))
|
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()
|
search_str = search_str.lower().strip()
|
||||||
|
|
||||||
if '+' in search_str:
|
if '+' in search_str:
|
||||||
search_words = search_str.split('+')
|
search_words: list[str] = search_str.split('+')
|
||||||
for index, _ in enumerate(search_words):
|
for index, _ in enumerate(search_words):
|
||||||
search_words[index] = search_words[index].strip()
|
search_words[index] = search_words[index].strip()
|
||||||
print('SEARCH: ' + str(search_words))
|
print('SEARCH: ' + str(search_words))
|
||||||
|
|
|
||||||
8
utils.py
8
utils.py
|
|
@ -384,7 +384,7 @@ def get_media_descriptions_from_post(post_json_object: {}) -> str:
|
||||||
"""Returns all attached media descriptions as a single text.
|
"""Returns all attached media descriptions as a single text.
|
||||||
This is used for filtering
|
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:
|
if not post_attachments:
|
||||||
return ''
|
return ''
|
||||||
descriptions: str = ''
|
descriptions: str = ''
|
||||||
|
|
@ -707,10 +707,10 @@ def get_memorials(base_dir: str) -> str:
|
||||||
if not is_a_file(memorial_file):
|
if not is_a_file(memorial_file):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
memorial_str = load_string(memorial_file,
|
memorial_str: str = \
|
||||||
'EX: unable to read ' + memorial_file)
|
load_string(memorial_file, 'EX: unable to read ' + memorial_file)
|
||||||
if memorial_str is None:
|
if memorial_str is None:
|
||||||
memorial_str: str = ''
|
memorial_str = ''
|
||||||
return memorial_str
|
return memorial_str
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue