Snake case

merge-requests/30/head
Bob Mottram 2021-12-27 17:20:01 +00:00
parent 9df47f2140
commit 9b944360c0
7 changed files with 15 additions and 15 deletions

View File

@ -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/')

View File

@ -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:

View File

@ -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)

View File

@ -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):

View File

@ -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:

View File

@ -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):

View File

@ -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, '')