From 9b944360c05ccd0f91ec91bab65c5aabbc0c9afa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Dec 2021 17:20:01 +0000 Subject: [PATCH] Snake case --- epicyon.py | 4 ++-- inbox.py | 4 ++-- person.py | 4 ++-- utils.py | 6 +++--- webapp_post.py | 4 ++-- webapp_utils.py | 4 ++-- webfinger.py | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/epicyon.py b/epicyon.py index 84fb964ef..a106dc2a5 100644 --- a/epicyon.py +++ b/epicyon.py @@ -75,7 +75,7 @@ from utils import getDomainFromActor from utils import getNicknameFromActor from utils import follow_person from utils import validNickname -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import acct_dir from media import archiveMedia from media import getAttachmentMediaType @@ -2125,7 +2125,7 @@ if args.followers: args.followers.startswith('http') or \ args.followers.startswith('hyper'): # format: https://domain/@nick - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() for prefix in prefixes: args.followers = args.followers.replace(prefix, '') args.followers = args.followers.replace('/@', '/users/') diff --git a/inbox.py b/inbox.py index bb36291a1..0d9edcb50 100644 --- a/inbox.py +++ b/inbox.py @@ -40,7 +40,7 @@ from utils import has_users_path from utils import valid_post_date from utils import get_full_domain from utils import remove_id_ending -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import isBlogPost from utils import removeAvatarFromCache from utils import isPublicPost @@ -1856,7 +1856,7 @@ def _receiveAnnounce(recent_posts_cache: {}, return False blockedCache = {} - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() # is the domain of the announce actor blocked? objectDomain = message_json['object'] for prefix in prefixes: diff --git a/person.py b/person.py index 7e9244f0f..988255434 100644 --- a/person.py +++ b/person.py @@ -51,7 +51,7 @@ from utils import save_json from utils import setConfigParam from utils import get_config_param from utils import refresh_newswire -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import has_users_path from utils import get_image_extensions from utils import is_image_file @@ -1457,7 +1457,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool, 'https://domain/@nick or https://domain' + detectedUsersPath + 'nick') return None, None - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() for prefix in prefixes: handle = handle.replace(prefix, '') handle = handle.replace('/@', detectedUsersPath) diff --git a/utils.py b/utils.py index f5c7c072a..cfd02f8a4 100644 --- a/utils.py +++ b/utils.py @@ -618,7 +618,7 @@ def remove_hash_from_post_id(post_id: str) -> str: return post_id.split('#')[0] -def getProtocolPrefixes() -> []: +def get_protocol_prefixes() -> []: """Returns a list of valid prefixes """ return ('https://', 'http://', 'ftp://', @@ -1072,7 +1072,7 @@ def getDomainFromActor(actor: str) -> (str, int): if actor.startswith('@'): actor = actor[1:] port = None - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() usersPaths = get_user_paths() for possiblePath in usersPaths: if possiblePath in actor: @@ -2894,7 +2894,7 @@ def get_actor_property_url(actor_json: {}, property_name: str) -> str: if property_value['type'] != 'PropertyValue': continue property_value['value'] = property_value['value'].strip() - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() prefixFound = False for prefix in prefixes: if property_value['value'].startswith(prefix): diff --git a/webapp_post.py b/webapp_post.py index 6e2e5492a..cae817081 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -41,7 +41,7 @@ from utils import locate_post from utils import load_json from utils import get_cached_post_directory from utils import get_cached_post_filename -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import isNewsPost from utils import isBlogPost from utils import getDisplayName @@ -1153,7 +1153,7 @@ def _getPostTitleReplyHtml(base_dir: str, # has a reply if '/statuses/' not in objJson['inReplyTo']: postDomain = objJson['inReplyTo'] - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() for prefix in prefixes: postDomain = postDomain.replace(prefix, '') if '/' in postDomain: diff --git a/webapp_utils.py b/webapp_utils.py index 1acf630b0..465963b02 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -13,7 +13,7 @@ from collections import OrderedDict from session import getJson from utils import is_account_dir from utils import remove_html -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import load_json from utils import get_cached_post_filename from utils import get_config_param @@ -192,7 +192,7 @@ def _setActorPropertyUrl(actor_json: {}, property_name: str, url: str) -> None: if propertyFound: actor_json['attachment'].remove(propertyFound) - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() prefixFound = False for prefix in prefixes: if url.startswith(prefix): diff --git a/webfinger.py b/webfinger.py index 9da1c0fd4..a0bf3e8c1 100644 --- a/webfinger.py +++ b/webfinger.py @@ -16,7 +16,7 @@ from utils import get_full_domain from utils import load_json from utils import load_json_onionify from utils import save_json -from utils import getProtocolPrefixes +from utils import get_protocol_prefixes from utils import remove_domain_port from utils import get_user_paths from utils import get_group_paths @@ -29,7 +29,7 @@ def _parseHandle(handle: str) -> (str, str, bool): group_account = False if '.' not in handle: return None, None, False - prefixes = getProtocolPrefixes() + prefixes = get_protocol_prefixes() handleStr = handle for prefix in prefixes: handleStr = handleStr.replace(prefix, '')