mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
733ae3a17e
commit
63194d2f0c
36
posts.py
36
posts.py
|
@ -738,10 +738,10 @@ def _update_word_frequency(content: str, word_frequency: {}) -> None:
|
||||||
words_list = plain_text.split(' ')
|
words_list = plain_text.split(' ')
|
||||||
common_words = _get_common_words()
|
common_words = _get_common_words()
|
||||||
for word in words_list:
|
for word in words_list:
|
||||||
wordLen = len(word)
|
word_len = len(word)
|
||||||
if wordLen < 3:
|
if word_len < 3:
|
||||||
continue
|
continue
|
||||||
if wordLen < 4:
|
if word_len < 4:
|
||||||
if word.upper() != word:
|
if word.upper() != word:
|
||||||
continue
|
continue
|
||||||
if '&' in word or \
|
if '&' in word or \
|
||||||
|
@ -759,17 +759,10 @@ def _update_word_frequency(content: str, word_frequency: {}) -> None:
|
||||||
word_frequency[word] = 1
|
word_frequency[word] = 1
|
||||||
|
|
||||||
|
|
||||||
def get_post_domains(session, outbox_url: str, max_posts: int,
|
def get_post_domains(session, outbox_url: str, max_posts: int, debug: bool,
|
||||||
max_mentions: int,
|
project_version: str, http_prefix: str, domain: str,
|
||||||
max_emoji: int, max_attachments: int,
|
word_frequency: {}, domain_list: [],
|
||||||
federation_list: [],
|
system_language: str, signing_priv_key_pem: str) -> []:
|
||||||
person_cache: {},
|
|
||||||
debug: bool,
|
|
||||||
project_version: str, http_prefix: str,
|
|
||||||
domain: str,
|
|
||||||
word_frequency: {},
|
|
||||||
domain_list: [], system_language: str,
|
|
||||||
signing_priv_key_pem: str) -> []:
|
|
||||||
"""Returns a list of domains referenced within public posts
|
"""Returns a list of domains referenced within public posts
|
||||||
"""
|
"""
|
||||||
if not outbox_url:
|
if not outbox_url:
|
||||||
|
@ -806,7 +799,7 @@ def get_post_domains(session, outbox_url: str, max_posts: int,
|
||||||
_update_word_frequency(content_str, word_frequency)
|
_update_word_frequency(content_str, word_frequency)
|
||||||
if item['object'].get('inReplyTo'):
|
if item['object'].get('inReplyTo'):
|
||||||
if isinstance(item['object']['inReplyTo'], str):
|
if isinstance(item['object']['inReplyTo'], str):
|
||||||
post_domain, post_port = \
|
post_domain, _ = \
|
||||||
get_domain_from_actor(item['object']['inReplyTo'])
|
get_domain_from_actor(item['object']['inReplyTo'])
|
||||||
if post_domain not in post_domains:
|
if post_domain not in post_domains:
|
||||||
post_domains.append(post_domain)
|
post_domains.append(post_domain)
|
||||||
|
@ -4450,7 +4443,6 @@ def get_public_post_domains(session, base_dir: str, nickname: str, domain: str,
|
||||||
return domain_list
|
return domain_list
|
||||||
person_cache = {}
|
person_cache = {}
|
||||||
cached_webfingers = {}
|
cached_webfingers = {}
|
||||||
federation_list = []
|
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||||
|
@ -4473,13 +4465,8 @@ def get_public_post_domains(session, base_dir: str, nickname: str, domain: str,
|
||||||
project_version, http_prefix,
|
project_version, http_prefix,
|
||||||
nickname, domain, 'outbox',
|
nickname, domain, 'outbox',
|
||||||
92522)
|
92522)
|
||||||
max_mentions = 99
|
|
||||||
max_emoji = 99
|
|
||||||
max_attachments = 5
|
|
||||||
post_domains = \
|
post_domains = \
|
||||||
get_post_domains(session, person_url, 64, max_mentions, max_emoji,
|
get_post_domains(session, person_url, 64, debug,
|
||||||
max_attachments, federation_list,
|
|
||||||
person_cache, debug,
|
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
word_frequency, domain_list, system_language,
|
word_frequency, domain_list, system_language,
|
||||||
signing_priv_key_pem)
|
signing_priv_key_pem)
|
||||||
|
@ -4575,10 +4562,7 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str,
|
||||||
max_attachments = 5
|
max_attachments = 5
|
||||||
max_posts = 64
|
max_posts = 64
|
||||||
post_domains = \
|
post_domains = \
|
||||||
get_post_domains(session, person_url, max_posts,
|
get_post_domains(session, person_url, max_posts, debug,
|
||||||
max_mentions, max_emoji,
|
|
||||||
max_attachments, federation_list,
|
|
||||||
person_cache, debug,
|
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
word_frequency, [], system_language,
|
word_frequency, [], system_language,
|
||||||
signing_priv_key_pem)
|
signing_priv_key_pem)
|
||||||
|
|
|
@ -33,10 +33,6 @@ def instances_graph(base_dir: str, handles: str,
|
||||||
|
|
||||||
person_cache = {}
|
person_cache = {}
|
||||||
cached_webfingers = {}
|
cached_webfingers = {}
|
||||||
federation_list = []
|
|
||||||
max_mentions = 99
|
|
||||||
max_emoji = 99
|
|
||||||
max_attachments = 5
|
|
||||||
|
|
||||||
person_handles = handles.split(',')
|
person_handles = handles.split(',')
|
||||||
for handle in person_handles:
|
for handle in person_handles:
|
||||||
|
@ -74,9 +70,7 @@ def instances_graph(base_dir: str, handles: str,
|
||||||
27261)
|
27261)
|
||||||
word_frequency = {}
|
word_frequency = {}
|
||||||
post_domains = \
|
post_domains = \
|
||||||
get_post_domains(session, person_url, 64, max_mentions, max_emoji,
|
get_post_domains(session, person_url, 64, debug,
|
||||||
max_attachments, federation_list,
|
|
||||||
person_cache, debug,
|
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
word_frequency, [], system_language,
|
word_frequency, [], system_language,
|
||||||
signing_priv_key_pem)
|
signing_priv_key_pem)
|
||||||
|
|
Loading…
Reference in New Issue