Snake case

merge-requests/26/head
Bob Mottram 2022-01-01 15:11:42 +00:00
parent a508415b85
commit f53810e82d
8 changed files with 3239 additions and 3197 deletions

View File

@ -122,10 +122,11 @@ def expire_person_cache(person_cache: {}):
print(str(len(removals)) + ' actors were expired from the cache')
def store_webfinger_in_cache(handle: str, wf, cached_webfingers: {}) -> None:
def store_webfinger_in_cache(handle: str, webfing,
cached_webfingers: {}) -> None:
"""Store a webfinger endpoint in the cache
"""
cached_webfingers[handle] = wf
cached_webfingers[handle] = webfing
def get_webfinger_from_cache(handle: str, cached_webfingers: {}) -> {}:

6396
daemon.py

File diff suppressed because it is too large Load Diff

View File

@ -2642,7 +2642,7 @@ def _send_to_group_members(session, base_dir: str, handle: str, port: int,
print('\n\n=========================================================')
print(handle + ' sending to group members')
sharedItemFederationTokens = {}
shared_item_federation_tokens = {}
shared_items_federated_domains = []
shared_items_federated_domainsStr = \
get_config_param(base_dir, 'shared_items_federated_domains')
@ -2695,7 +2695,7 @@ def _send_to_group_members(session, base_dir: str, handle: str, port: int,
cached_webfingers, person_cache,
announceJson, debug, __version__,
shared_items_federated_domains,
sharedItemFederationTokens,
shared_item_federation_tokens,
signing_priv_key_pem)
@ -3074,7 +3074,7 @@ def _receive_question_vote(base_dir: str, nickname: str, domain: str,
# send out an update
questionJson['type'] = 'Update'
shared_items_federated_domains = []
sharedItemFederationTokens = {}
shared_item_federation_tokens = {}
send_to_followers_thread(session, base_dir, nickname, domain,
onion_domain, i2p_domain, port,
http_prefix, federation_list,
@ -3082,7 +3082,7 @@ def _receive_question_vote(base_dir: str, nickname: str, domain: str,
cached_webfingers, person_cache,
post_json_object, debug, __version__,
shared_items_federated_domains,
sharedItemFederationTokens,
shared_item_federation_tokens,
signing_priv_key_pem)
@ -3704,15 +3704,15 @@ def run_inbox_queue_watchdog(project_version: str, httpd) -> None:
httpd.thrInboxQueue.start()
while True:
time.sleep(20)
if not httpd.thrInboxQueue.is_alive() or httpd.restartInboxQueue:
httpd.restartInboxQueueInProgress = True
if not httpd.thrInboxQueue.is_alive() or httpd.restart_inbox_queue:
httpd.restart_inbox_queue_in_progress = True
httpd.thrInboxQueue.kill()
httpd.thrInboxQueue = inbox_queueOriginal.clone(run_inbox_queue)
httpd.inbox_queue.clear()
httpd.thrInboxQueue.start()
print('Restarting inbox queue...')
httpd.restartInboxQueueInProgress = False
httpd.restartInboxQueue = False
httpd.restart_inbox_queue_in_progress = False
httpd.restart_inbox_queue = False
def _inbox_quota_exceeded(queue: {}, queueFilename: str,

View File

@ -193,7 +193,7 @@ def post_message_to_outbox(session, translate: {},
allow_local_network_access: bool,
city: str, system_language: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
shared_item_federation_tokens: {},
low_bandwidth: bool,
signing_priv_key_pem: str,
peertube_instances: str, theme: str,
@ -524,7 +524,7 @@ def post_message_to_outbox(session, translate: {},
message_json, debug,
version,
shared_items_federated_domains,
sharedItemFederationTokens,
shared_item_federation_tokens,
signing_priv_key_pem)
followers_threads.append(followersThread)
@ -665,7 +665,7 @@ def post_message_to_outbox(session, translate: {},
message_json, debug,
version,
shared_items_federated_domains,
sharedItemFederationTokens,
shared_item_federation_tokens,
signing_priv_key_pem)
followers_threads.append(namedAddressesThread)
return True

View File

@ -120,7 +120,7 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
httpd.allow_local_network_access,
httpd.city, httpd.system_language,
httpd.shared_items_federated_domains,
httpd.sharedItemFederationTokens,
httpd.shared_item_federation_tokens,
httpd.low_bandwidth,
httpd.signing_priv_key_pem,
httpd.peertube_instances,

View File

@ -1693,7 +1693,7 @@ def _regenerate_shares_token(base_dir: str, domain_full: str,
_generate_next_shares_token_update(base_dir, minDays, maxDays)
# update the tokens used within the daemon
shared_fed_domains = httpd.shared_items_federated_domains
httpd.sharedItemFederationTokens = \
httpd.shared_item_federation_tokens = \
generate_shared_item_federation_tokens(shared_fed_domains,
base_dir)

View File

@ -4646,6 +4646,9 @@ def _test_post_field_names():
if ']' not in names_list[index]:
continue
param_var_name = names_list[index].split(']')[0].strip()
if '"' not in param_var_name and \
"'" not in param_var_name:
continue
orig_param_var_name = 'fields[' + param_var_name + ']'
param_var_name = param_var_name.replace('"', '')
param_var_name = param_var_name.replace("'", '')

View File

@ -16,7 +16,7 @@ from webapp_utils import html_header_with_external_style
from webapp_utils import html_footer
def load_access_keys_for_accounts(base_dir: str, keyShortcuts: {},
def load_access_keys_for_accounts(base_dir: str, key_shortcuts: {},
access_keysTemplate: {}) -> None:
"""Loads key shortcuts for each account
"""
@ -31,10 +31,10 @@ def load_access_keys_for_accounts(base_dir: str, keyShortcuts: {},
nickname = acct.split('@')[0]
access_keys = load_json(access_keysFilename)
if access_keys:
keyShortcuts[nickname] = access_keysTemplate.copy()
key_shortcuts[nickname] = access_keysTemplate.copy()
for variableName, key in access_keysTemplate.items():
if access_keys.get(variableName):
keyShortcuts[nickname][variableName] = \
key_shortcuts[nickname][variableName] = \
access_keys[variableName]
break