Check for unused function arguments

main
Bob Mottram 2024-04-08 15:00:47 +01:00
parent addd2a2bb1
commit c60fb9b467
23 changed files with 253 additions and 221 deletions

View File

@ -182,7 +182,6 @@ def blocked_user_agent(calling_domain: str, agent_str: str,
blocked_ua = \
is_blocked_domain(base_dir, agent_domain,
blocked_cache, block_federated)
# if self.server.debug:
if blocked_ua:
print('BLOCK: Blocked User agent 2: ' + agent_domain)

View File

@ -220,7 +220,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname, self.server.domain,
self.path,
self.server.http_prefix,
self.server.debug,
debug,
self.server.recent_posts_cache)
if not response_str:
http_404(self, 148)

View File

@ -4402,7 +4402,7 @@ def _security_txt(self, ua_str: str, calling_domain: str,
http_400(self)
self.server.security_txt_is_active = False
return True
if self.server.debug:
if debug:
print('DEBUG: security.txt ' + self.path)
# If we are in broch mode then don't reply

View File

@ -98,10 +98,10 @@ def announce_button(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -150,7 +150,7 @@ def announce_button(self, calling_domain: str, path: str,
debug,
self.server.project_version,
self.server.signing_priv_key_pem,
self.server.domain,
domain,
onion_domain,
i2p_domain, sites_unavailable,
self.server.system_language)
@ -177,7 +177,7 @@ def announce_button(self, calling_domain: str, path: str,
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_announce_button postToOutboxThread',
self.server.debug)
debug)
# generate the html for the announce
if announce_json and announce_filename:
@ -219,7 +219,7 @@ def announce_button(self, calling_domain: str, path: str,
self.server.cached_webfingers,
self.server.person_cache,
self.post_to_nickname, domain,
self.server.port, announce_json,
port, announce_json,
None, True,
self.server.allow_deletion,
http_prefix, self.server.project_version,
@ -246,10 +246,10 @@ def announce_button(self, calling_domain: str, path: str,
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -257,7 +257,7 @@ def announce_button(self, calling_domain: str, path: str,
str(page_number) + first_post_id + timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_announce_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie, calling_domain)
@ -313,10 +313,10 @@ def announce_button_undo(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + '?page=' + \
@ -386,10 +386,10 @@ def announce_button_undo(self, calling_domain: str, path: str,
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -397,7 +397,7 @@ def announce_button_undo(self, calling_domain: str, path: str,
str(page_number) + first_post_id + timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_undo_announce_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie, calling_domain)
@ -425,12 +425,12 @@ def follow_approve_button(self, calling_domain: str, path: str,
handle_nickname + '@' + \
get_full_domain(handle_domain, handle_port)
if '@' in following_handle:
if self.server.onion_domain:
if onion_domain:
if following_handle.endswith('.onion'):
curr_session = self.server.session_onion
proxy_type = 'tor'
port = 80
if self.server.i2p_domain:
if i2p_domain:
if following_handle.endswith('.i2p'):
curr_session = self.server.session_i2p
proxy_type = 'i2p'
@ -452,8 +452,8 @@ def follow_approve_button(self, calling_domain: str, path: str,
manual_approve_follow_request_thread(self.server.session,
self.server.session_onion,
self.server.session_i2p,
self.server.onion_domain,
self.server.i2p_domain,
onion_domain,
i2p_domain,
base_dir, http_prefix,
follower_nickname,
domain, port,
@ -480,7 +480,7 @@ def follow_approve_button(self, calling_domain: str, path: str,
'http://' + i2p_domain + origin_path_str
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_follow_approve_button',
self.server.debug)
debug)
redirect_headers(self, origin_path_str_absolute,
cookie, calling_domain)
@ -538,7 +538,7 @@ def follow_deny_button(self, calling_domain: str, path: str,
cookie, calling_domain)
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_follow_deny_button',
self.server.debug)
debug)
def like_button(self, calling_domain: str, path: str,
@ -592,10 +592,10 @@ def like_button(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -651,7 +651,7 @@ def like_button(self, calling_domain: str, path: str,
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_like_button postToOutbox',
self.server.debug)
debug)
print('Locating liked post ' + like_url)
# directly like the post file
@ -753,10 +753,10 @@ def like_button(self, calling_domain: str, path: str,
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -765,7 +765,7 @@ def like_button(self, calling_domain: str, path: str,
timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_like_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie,
calling_domain)
@ -820,10 +820,10 @@ def like_button_undo(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -969,10 +969,10 @@ def like_button_undo(self, calling_domain: str, path: str,
del self.server.iconsCache['like_inactive.png']
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -980,8 +980,7 @@ def like_button_undo(self, calling_domain: str, path: str,
'?page=' + str(page_number) + first_post_id + \
timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_undo_like_button',
self.server.debug)
'_GET', '_undo_like_button', debug)
redirect_headers(self, actor_path_str, cookie,
calling_domain)
@ -1042,10 +1041,10 @@ def reaction_button(self, calling_domain: str, path: str,
print('WARN: no emoji reaction ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1059,10 +1058,10 @@ def reaction_button(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1120,7 +1119,7 @@ def reaction_button(self, calling_domain: str, path: str,
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_reaction_button postToOutbox',
self.server.debug)
debug)
print('Locating emoji reaction post ' + reaction_url)
# directly emoji reaction the post file
@ -1226,10 +1225,10 @@ def reaction_button(self, calling_domain: str, path: str,
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -1238,7 +1237,7 @@ def reaction_button(self, calling_domain: str, path: str,
timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_reaction_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie,
calling_domain)
@ -1293,10 +1292,10 @@ def reaction_button_undo(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1313,10 +1312,10 @@ def reaction_button_undo(self, calling_domain: str, path: str,
print('WARN: no emoji reaction ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1466,10 +1465,10 @@ def reaction_button_undo(self, calling_domain: str, path: str,
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -1478,7 +1477,7 @@ def reaction_button_undo(self, calling_domain: str, path: str,
timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_undo_reaction_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie, calling_domain)
@ -1533,10 +1532,10 @@ def bookmark_button(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1615,7 +1614,7 @@ def bookmark_button(self, calling_domain: str, path: str,
self.server.cached_webfingers,
self.server.person_cache,
self.post_to_nickname, domain,
self.server.port, bookmark_post_json,
port, bookmark_post_json,
None, True,
self.server.allow_deletion,
http_prefix,
@ -1647,10 +1646,10 @@ def bookmark_button(self, calling_domain: str, path: str,
# curr_session, proxy_type)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -1714,10 +1713,10 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
actor
actor_path_str = \
actor_absolute + '/' + timeline_str + \
@ -1799,7 +1798,7 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
self.server.cached_webfingers,
self.server.person_cache,
self.post_to_nickname, domain,
self.server.port, bookmark_post_json,
port, bookmark_post_json,
None, True,
self.server.allow_deletion,
http_prefix,
@ -1829,10 +1828,10 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
bookmark_filename)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + self.post_to_nickname
actor_path_str = \
@ -1841,7 +1840,7 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
timeline_bookmark
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_undo_bookmark_button',
self.server.debug)
debug)
redirect_headers(self, actor_path_str, cookie,
calling_domain)
@ -1883,7 +1882,7 @@ def delete_button(self, calling_domain: str, path: str,
http_prefix + '://' + domain_full + users_path
if self.server.allow_deletion or \
delete_url.startswith(actor):
if self.server.debug:
if debug:
print('DEBUG: delete_url=' + delete_url)
print('DEBUG: actor=' + actor)
if actor not in delete_url:
@ -2066,7 +2065,7 @@ def mute_button(self, calling_domain: str, path: str,
self.server.cached_webfingers,
self.server.person_cache,
nickname, domain,
self.server.port, mute_post_json,
port, mute_post_json,
avatar_url, show_avatar_options,
self.server.allow_deletion,
http_prefix,
@ -2104,7 +2103,7 @@ def mute_button(self, calling_domain: str, path: str,
'http://' + i2p_domain + \
path.split('?mute=')[0]
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_mute_button', self.server.debug)
'_GET', '_mute_button', debug)
page_number_str = str(page_number)
redirect_str = \
@ -2213,7 +2212,7 @@ def mute_button_undo(self, calling_domain: str, path: str,
self.server.cached_webfingers,
self.server.person_cache,
nickname, domain,
self.server.port, mute_post_json,
port, mute_post_json,
avatar_url, show_avatar_options,
self.server.allow_deletion,
http_prefix,
@ -2248,7 +2247,7 @@ def mute_button_undo(self, calling_domain: str, path: str,
actor = \
'http://' + i2p_domain + path.split('?unmute=')[0]
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_undo_mute_button', self.server.debug)
'_GET', '_undo_mute_button', debug)
page_number_str = str(page_number)
redirect_str = \

View File

@ -94,7 +94,7 @@ def get_favicon(self, calling_domain: str,
False, None)
write2(self, fav_binary)
self.server.iconsCache[fav_filename] = fav_binary
if self.server.debug:
if debug:
print('Sent favicon from file: ' + calling_domain)
return
if debug:

View File

@ -118,7 +118,7 @@ def show_shares_feed(self, authorized: bool,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -281,7 +281,7 @@ def show_following_feed(self, authorized: bool,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -442,7 +442,7 @@ def show_moved_feed(self, authorized: bool,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -597,11 +597,11 @@ def show_inactive_feed(self, authorized: bool,
self.server.show_published_date_only,
self.server.newswire,
self.server.theme_name,
self.server.dormant_months,
dormant_months,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -762,7 +762,7 @@ def show_followers_feed(self, authorized: bool,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,

View File

@ -73,8 +73,8 @@ def show_instance_actor(self, calling_domain: str,
referer_domain,
msg_str, http_prefix,
domain,
self.server.onion_domain,
self.server.i2p_domain)
onion_domain,
i2p_domain)
msg = msg_str.encode('utf-8')
msglen = len(msg)
if 'application/ld+json' in accept_str:

View File

@ -76,7 +76,7 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
http_400(self)
self.server.nodeinfo_is_active = False
return True
if self.server.debug:
if debug:
print('DEBUG: nodeinfo ' + self.path)
crawl_time = \
update_known_crawlers(ua_str,
@ -102,7 +102,7 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
show_node_info_accounts = False
instance_url = get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain)

View File

@ -107,7 +107,7 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
msg = \
html_individual_post(self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
translate,
base_dir,
curr_session,
self.server.cached_webfingers,
@ -269,7 +269,7 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool,
curr_session, translate)
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', 'show_individual_post',
self.server.debug)
debug)
return result
@ -357,9 +357,9 @@ def show_new_post(self, edit_post_params: {},
languages_understood = \
get_understood_languages(base_dir,
self.server.http_prefix,
http_prefix,
nickname,
self.server.domain_full,
domain_full,
self.server.person_cache)
default_buy_site = ''
msg = \
@ -523,7 +523,7 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool,
curr_session, translate)
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', 'show_individual_at_post',
self.server.debug)
debug)
return result
@ -980,7 +980,7 @@ def show_notify_post(self, authorized: bool,
curr_session, translate)
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', 'show_notify_post',
self.server.debug)
debug)
return result
@ -1000,7 +1000,7 @@ def show_conversation_thread(self, authorized: bool,
post_id = post_id.replace('--', '/')
if post_id.startswith('/users/'):
instance_url = get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain)

View File

@ -105,7 +105,7 @@ def show_person_profile(self, authorized: bool,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -129,7 +129,7 @@ def show_person_profile(self, authorized: bool,
self.server.fitness,
'_GET', '_show_person_profile',
debug)
if self.server.debug:
if debug:
print('DEBUG: html actor sent')
else:
if secure_mode(curr_session, proxy_type, False,
@ -140,8 +140,8 @@ def show_person_profile(self, authorized: bool,
referer_domain,
msg_str, http_prefix,
domain,
self.server.onion_domain,
self.server.i2p_domain)
onion_domain,
i2p_domain)
msg = msg_str.encode('utf-8')
msglen = len(msg)
if 'application/ld+json' in accept_str:
@ -157,8 +157,8 @@ def show_person_profile(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_person_profile json',
self.server.debug)
if self.server.debug:
debug)
if debug:
print('DEBUG: json actor sent')
else:
http_404(self, 87)
@ -246,7 +246,7 @@ def show_roles(self, calling_domain: str, referer_domain: str,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -309,7 +309,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
actor_json = load_json(actor_filename)
if actor_json:
if no_of_actor_skills(actor_json) > 0:
if request_http(self.headers, self.server.debug):
if request_http(self.headers, debug):
get_person = \
person_lookup(domain,
path.replace('/skills', ''),
@ -383,7 +383,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
peertube_instances,
allow_local_network_access,
self.server.text_mode_banner,
self.server.debug,
debug,
access_keys, city,
self.server.system_language,
self.server.max_like_count,
@ -409,7 +409,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_skills',
self.server.debug)
debug)
else:
if secure_mode(curr_session,
proxy_type, False,
@ -450,7 +450,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
actor = path.replace('/skills', '')
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \

View File

@ -56,7 +56,7 @@ def reaction_picker2(self, calling_domain: str, path: str,
print('WARN: unable to find nickname in ' + actor)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
@ -77,7 +77,7 @@ def reaction_picker2(self, calling_domain: str, path: str,
print('WARN: unable to locate reaction post ' + reaction_url)
actor_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \

View File

@ -101,7 +101,7 @@ def get_rss2site(self, calling_domain: str, path: str,
msg += \
html_blog_page_rss2(base_dir,
http_prefix,
self.server.translate,
translate,
nickname,
domain,
port,
@ -165,7 +165,7 @@ def get_rss3feed(self, calling_domain: str, path: str,
set_headers(self, 'text/plain; charset=utf-8',
msglen, None, calling_domain, True)
write2(self, msg)
if self.server.debug:
if debug:
print('Sent rss3 feed: ' +
path + ' ' + calling_domain)
fitness_performance(getreq_start_time, self.server.fitness,

View File

@ -172,7 +172,7 @@ def show_media_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_media_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because there is
# already the authorization check
@ -196,7 +196,7 @@ def show_media_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_media_timeline json',
self.server.debug)
debug)
return True
if debug:
nickname = path.replace('/users/', '')
@ -350,7 +350,7 @@ def show_blogs_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_blogs_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because there is
# already the authorization check
@ -374,7 +374,7 @@ def show_blogs_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_blogs_timeline json',
self.server.debug)
debug)
return True
if debug:
nickname = path.replace('/users/', '')
@ -531,7 +531,7 @@ def show_news_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_news_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because there is
# already the authorization check
@ -555,7 +555,7 @@ def show_news_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_news_timeline json',
self.server.debug)
debug)
return True
if debug:
nickname = 'news'
@ -716,7 +716,7 @@ def show_features_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_features_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because there is
# already the authorization check
@ -741,7 +741,7 @@ def show_features_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_features_timeline json',
self.server.debug)
debug)
return True
if debug:
nickname = 'news'
@ -853,7 +853,7 @@ def show_shares_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_shares_timeline',
self.server.debug)
debug)
return True
# not the shares timeline
if debug:
@ -958,7 +958,7 @@ def show_wanted_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_wanted_timeline',
self.server.debug)
debug)
return True
# not the shares timeline
if debug:
@ -1104,7 +1104,7 @@ def show_bookmarks_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_bookmarks_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because
# there is already the authorization check
@ -1130,7 +1130,7 @@ def show_bookmarks_timeline(self, authorized: bool,
self.server.fitness,
'_GET',
'_show_bookmarks_timeline json',
self.server.debug)
debug)
return True
else:
if debug:
@ -1440,7 +1440,7 @@ def show_mod_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_mod_timeline',
self.server.debug)
debug)
else:
# don't need authorized fetch here because
# there is already the authorization check
@ -1465,7 +1465,7 @@ def show_mod_timeline(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_mod_timeline json',
self.server.debug)
debug)
return True
else:
if debug:
@ -1618,7 +1618,7 @@ def show_dms(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_dms',
self.server.debug)
debug)
else:
# don't need authorized fetch here because
# there is already the authorization check
@ -1643,7 +1643,7 @@ def show_dms(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_dms json',
self.server.debug)
debug)
return True
else:
if debug:
@ -1801,7 +1801,7 @@ def show_replies(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_replies',
self.server.debug)
debug)
else:
# don't need authorized fetch here because there is
# already the authorization check
@ -1825,7 +1825,7 @@ def show_replies(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_replies json',
self.server.debug)
debug)
return True
if debug:
nickname = path.replace('/users/', '')
@ -1882,7 +1882,7 @@ def show_inbox(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_inbox',
self.server.debug)
debug)
if request_http(self.headers, debug):
nickname = path.replace('/users/', '')
nickname = nickname.replace('/inbox', '')
@ -1916,7 +1916,7 @@ def show_inbox(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_inbox2',
self.server.debug)
debug)
full_width_tl_button_header = \
self.server.full_width_tl_button_header
minimal_nick = is_minimal(base_dir, domain, nickname)
@ -1995,7 +1995,7 @@ def show_inbox(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_inbox3',
self.server.debug)
debug)
if msg:
msg_str = msg
onion_domain = self.server.onion_domain
@ -2017,7 +2017,7 @@ def show_inbox(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_inbox4',
self.server.debug)
debug)
else:
# don't need authorized fetch here because
# there is already the authorization check
@ -2042,7 +2042,7 @@ def show_inbox(self, authorized: bool,
fitness_performance(getreq_start_time,
self.server.fitness,
'_GET', '_show_inbox5',
self.server.debug)
debug)
return True
else:
if debug:

View File

@ -118,9 +118,9 @@ def unfollow_confirm(self, calling_domain: str, cookie: str,
group_account = has_group_type(base_dir, following_actor,
self.server.person_cache)
unfollow_account(base_dir, self.post_to_nickname,
self.server.domain,
domain,
following_nickname, following_domain_full,
self.server.debug, group_account,
debug, group_account,
'following.txt')
post_to_outbox_thread(self, unfollow_json,
curr_session, proxy_type)
@ -193,9 +193,9 @@ def follow_confirm2(self, calling_domain: str, cookie: str,
html_account_info(self.server.translate,
base_dir, http_prefix,
follower_nickname,
self.server.domain,
domain,
following_actor,
self.server.debug,
debug,
self.server.system_language,
self.server.signing_priv_key_pem,
users_path,
@ -286,9 +286,9 @@ def follow_confirm2(self, calling_domain: str, cookie: str,
self.server.person_cache, debug,
self.server.project_version,
self.server.signing_priv_key_pem,
self.server.domain,
self.server.onion_domain,
self.server.i2p_domain,
domain,
onion_domain,
i2p_domain,
self.server.sites_unavailable,
self.server.system_language)

View File

@ -94,7 +94,7 @@ def post_login_screen(self, calling_domain: str, cookie: str,
self.server.postreq_busy = False
login_url = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
@ -108,7 +108,7 @@ def post_login_screen(self, calling_domain: str, cookie: str,
self.server.postreq_busy = False
login_url = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
@ -205,7 +205,7 @@ def post_login_screen(self, calling_domain: str, cookie: str,
self.server.tokens[login_nickname] + '; SameSite=Strict'
tl_url = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \

View File

@ -44,7 +44,7 @@ def moderator_actions(self, path: str, calling_domain: str, cookie: str,
nickname = users_path.replace('/users/', '')
actor_str = \
get_instance_url(calling_domain,
self.server.http_prefix,
http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
@ -150,9 +150,9 @@ def moderator_actions(self, path: str, calling_domain: str, cookie: str,
html_account_info(self.server.translate,
base_dir, http_prefix,
nickname,
self.server.domain,
domain,
search_handle,
self.server.debug,
debug,
self.server.system_language,
self.server.signing_priv_key_pem,
None,
@ -161,7 +161,7 @@ def moderator_actions(self, path: str, calling_domain: str, cookie: str,
msg = \
html_moderation_info(self.server.translate,
base_dir, nickname,
self.server.domain,
domain,
self.server.theme_name,
self.server.access_keys)
if msg:

View File

@ -259,7 +259,7 @@ def person_options2(self, path: str,
curr_session,
cached_webfingers,
self.server.person_cache,
self.server.debug,
debug,
self.server.project_version,
yt_replace_domain,
twitter_replacement_domain,
@ -275,8 +275,8 @@ def person_options2(self, path: str,
self.server.cw_lists,
self.server.lists_enabled,
timezone,
self.server.onion_domain,
self.server.i2p_domain,
onion_domain,
i2p_domain,
bold_reading,
self.server.dogwhistles,
min_images_for_accounts,
@ -707,7 +707,7 @@ def person_options2(self, path: str,
get_understood_languages(base_dir,
http_prefix,
chooser_nickname,
self.server.domain_full,
domain_full,
self.server.person_cache)
default_post_language = self.server.system_language
@ -736,7 +736,7 @@ def person_options2(self, path: str,
curr_session,
self.server.cached_webfingers,
self.server.person_cache,
self.server.port,
port,
None,
self.server.project_version,
self.server.yt_replace_domain,
@ -782,7 +782,7 @@ def person_options2(self, path: str,
chooser_nickname,
domain,
options_actor,
self.server.debug,
debug,
self.server.system_language,
signing_priv_key_pem,
None,
@ -872,7 +872,7 @@ def person_options2(self, path: str,
get_understood_languages(base_dir,
http_prefix,
chooser_nickname,
self.server.domain_full,
domain_full,
self.server.person_cache)
default_post_language = self.server.system_language
@ -900,7 +900,7 @@ def person_options2(self, path: str,
curr_session,
self.server.cached_webfingers,
self.server.person_cache,
self.server.port,
port,
None,
self.server.project_version,
self.server.yt_replace_domain,

View File

@ -2404,10 +2404,10 @@ def profile_edit(self, calling_domain: str, cookie: str,
users_path = users_path.replace('/editprofile', '')
actor_str = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
users_path
boundary = None
@ -2603,7 +2603,7 @@ def profile_edit(self, calling_domain: str, cookie: str,
elif 'name="welcomeCompleteButton"' in post_bytes_str:
redirect_path = '/' + self.server.default_timeline
welcome_screen_is_complete(base_dir, nickname,
self.server.domain)
domain)
on_final_welcome_screen = True
elif 'name="submitExportTheme"' in post_bytes_str:
print('submitExportTheme')
@ -2746,11 +2746,11 @@ def profile_edit(self, calling_domain: str, cookie: str,
actor_changed = \
_profile_post_blog_address(curr_session,
base_dir,
self.server.http_prefix,
http_prefix,
nickname, domain,
actor_json, fields,
actor_changed,
self.server.debug)
debug)
actor_changed = \
_profile_post_show_languages(actor_json, fields,
@ -2804,12 +2804,12 @@ def profile_edit(self, calling_domain: str, cookie: str,
actor_changed = \
_profile_post_website(curr_session,
base_dir,
self.server.http_prefix,
http_prefix,
nickname, domain,
actor_json, fields,
actor_changed,
self.server.translate,
self.server.debug)
debug)
actor_changed = \
_profile_post_gemini_link(actor_json, fields,

View File

@ -341,7 +341,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url,
@ -494,7 +494,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url,
@ -687,7 +687,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url,
@ -815,7 +815,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url,
media_creator,
languages_understood,
@ -1204,7 +1204,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
self.server.debug, fields['subject'],
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate,
@ -1271,7 +1271,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
int_duration_days,
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate,
@ -1355,7 +1355,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url,
@ -1506,7 +1506,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
fields['languagesDropdown'],
self.server.translate, shares_file_type,
self.server.low_bandwidth,
self.server.content_license_url,
content_license_url,
share_on_profile,
self.server.block_federated)
if post_type == 'newshare':

View File

@ -175,10 +175,10 @@ def remove_share(self, calling_domain: str, cookie: str,
# src/branch/main/fep/0837/fep-0837.md
actor = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
http_prefix,
domain_full,
onion_domain,
i2p_domain) + \
'/users/' + share_nickname
person_cache = self.server.person_cache
actor_json = get_person_from_cache(base_dir,

View File

@ -516,7 +516,7 @@ def receive_search_query(self, calling_domain: str, cookie: str,
curr_session,
cached_webfingers,
self.server.person_cache,
self.server.debug,
debug,
self.server.project_version,
yt_replace_domain,
twitter_replacement_domain,
@ -532,8 +532,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
self.server.cw_lists,
self.server.lists_enabled,
timezone,
self.server.onion_domain,
self.server.i2p_domain,
onion_domain,
i2p_domain,
bold_reading,
self.server.dogwhistles,
min_images_for_accounts,

View File

@ -258,7 +258,7 @@ def update_inbox_queue(self, nickname: str, message_json: {},
if debug:
print('INBOX: checking for actor')
message_domain = None
if not has_actor(message_json, self.server.debug):
if not has_actor(message_json, debug):
print('INBOX: message arriving at inbox queue has no actor')
http_400(self)
self.server.postreq_busy = False
@ -500,7 +500,7 @@ def update_inbox_queue(self, nickname: str, message_json: {},
)
for add_to_type in add_to_field_types:
message_json, _ = \
add_to_field(add_to_type, message_json, self.server.debug)
add_to_field(add_to_type, message_json, debug)
begin_save_time = time.time()
# save the json for later queue processing
@ -532,7 +532,7 @@ def update_inbox_queue(self, nickname: str, message_json: {},
message_bytes_decoded,
headers_dict,
self.path,
self.server.debug,
debug,
self.server.blocked_cache,
self.server.block_federated,
self.server.system_language,
@ -541,7 +541,7 @@ def update_inbox_queue(self, nickname: str, message_json: {},
# add json to the queue
if queue_filename not in self.server.inbox_queue:
self.server.inbox_queue.append(queue_filename)
if self.server.debug:
if debug:
time_diff = int((time.time() - begin_save_time) * 1000)
if time_diff > 200:
print('SLOW: slow save of inbox queue item ' +
@ -721,9 +721,9 @@ def show_person_options(self, calling_domain: str, path: str,
self.server.thrCheckActor[nickname] = \
thread_with_trace(target=check_for_changed_actor,
args=(curr_session,
self.server.base_dir,
base_dir,
self.server.http_prefix,
self.server.domain_full,
domain_full,
options_actor, options_profile_url,
self.server.person_cache,
self.server.check_actor_timeout),
@ -781,7 +781,7 @@ def show_person_options(self, calling_domain: str, path: str,
origin_path_str_absolute = \
get_instance_url(calling_domain,
self.server.http_prefix,
self.server.domain_full,
domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
origin_path_str

View File

@ -5441,6 +5441,32 @@ def _test_thread_functions():
ctr += 1
def _check_self_variables(mod_name: str, method_name: str,
method_args: [], line: str,
module_line: int) -> bool:
""" Detects whether self.server.variable exists as a function argument
"""
self_vars = line.split('self.server.')
ctr = 0
terminators = (' ', '.', ',', ')', '[', ' ', ':')
func_args = []
for arg_str in method_args:
arg_str = arg_str.strip().split(':')[0]
func_args.append(arg_str)
for line_substr in self_vars:
if ctr > 0:
variable_str = line_substr
for term_str in terminators:
variable_str = variable_str.split(term_str)[0]
if variable_str in func_args:
print('self variable is an argument: ' + variable_str +
' in module ' + mod_name + ' function ' + method_name +
' line ' + str(module_line))
return False
ctr += 1
return True
def _test_functions():
print('test_functions')
function = {}
@ -5475,7 +5501,10 @@ def _test_functions():
line_count = 0
prev_line = 'start'
method_name = ''
method_args = []
module_line = 0
for line in lines:
module_line += 1
# what group is this module in?
if '__module_group__' in line:
if '=' in line:
@ -5490,6 +5519,11 @@ def _test_functions():
mod_groups[group_name].append(mod_name)
# reading function lines
if not line.strip().startswith('def '):
if 'self.server.' in line:
assert _check_self_variables(mod_name,
method_name,
method_args, line,
module_line)
if line_count > 0:
line_count += 1
# add LOC count for this function
@ -5593,11 +5627,11 @@ def _test_functions():
assert False
# which modules is each function used within?
for mod_name, _ in modules.items():
for mod_name, mod_props in modules.items():
print('Module: ' + mod_name + '')
for name, properties in function_properties.items():
line_ctr = 0
for line in modules[mod_name]['lines']:
for line in mod_props['lines']:
line_str = line.strip()
if line_str.startswith('def '):
line_ctr += 1
@ -5608,7 +5642,7 @@ def _test_functions():
# detect a call to this function
if name + '(' in line:
mod_list = \
function_properties[name]['calledInModule']
properties['calledInModule']
if mod_name not in mod_list:
mod_list.append(mod_name)
if mod_name in exclude_func_args:
@ -5620,17 +5654,17 @@ def _test_functions():
# get the function call arguments
call_args = \
_get_function_call_args(name,
modules[mod_name]['lines'],
mod_props['lines'],
line_ctr)
# get the function def arguments
func_args = function_properties[name]['args']
func_args = properties['args']
# match the call arguments to the definition arguments
if not _function_args_match(call_args, func_args):
print('Call to function ' + name +
' does not match its arguments')
print('def args: ' +
str(len(function_properties[name]['args'])) +
'\n' + str(function_properties[name]['args']))
str(len(properties['args'])) +
'\n' + str(properties['args']))
print('Call args: ' + str(len(call_args)) + '\n' +
str(call_args))
print('module ' + mod_name + ' line ' + str(line_ctr))
@ -5768,17 +5802,17 @@ def _test_functions():
max_module_calls = 1
max_function_calls = 1
color_ctr = 0
for mod_name, _ in modules.items():
for mod_name, mod_props in modules.items():
line_ctr = 0
modules[mod_name]['color'] = module_colors[color_ctr]
mod_props['color'] = module_colors[color_ctr]
color_ctr += 1
if color_ctr >= len(module_colors):
color_ctr = 0
for line in modules[mod_name]['lines']:
for line in mod_props['lines']:
if line.strip().startswith('def '):
name = line.split('def ')[1].split('(')[0]
calls_list = \
get_function_calls(name, modules[mod_name]['lines'],
get_function_calls(name, mod_props['lines'],
line_ctr, function_properties)
function_properties[name]['calls'] = calls_list.copy()
if len(calls_list) > max_function_calls: