Snake case

main
Bob Mottram 2021-12-26 12:24:40 +00:00
parent fc98441a40
commit 257f29a815
8 changed files with 23 additions and 23 deletions

View File

@ -14,7 +14,7 @@ from session import getJson
from utils import loadJson
from utils import saveJson
from utils import getFileCaseInsensitive
from utils import getUserPaths
from utils import get_user_paths
def _removePersonFromCache(base_dir: str, personUrl: str,
@ -144,7 +144,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str,
if not personUrl:
return None
personUrl = personUrl.replace('#main-key', '')
usersPaths = getUserPaths()
usersPaths = get_user_paths()
for possibleUsersPath in usersPaths:
if personUrl.endswith(possibleUsersPath + 'inbox'):
if debug:

View File

@ -26,7 +26,7 @@ from posts import getPersonBox
from utils import loadJson
from utils import saveJson
from utils import isAccountDir
from utils import getUserPaths
from utils import get_user_paths
from utils import acct_dir
from utils import hasGroupType
from utils import local_actor_url
@ -118,7 +118,7 @@ def _removeFromFollowBase(base_dir: str,
acceptDenyDomain = acceptOrDenyHandle.split('@')[1]
# for each possible users path construct an actor and
# check if it exists in teh file
usersPaths = getUserPaths()
usersPaths = get_user_paths()
actorFound = False
for usersName in usersPaths:
acceptDenyActor = \
@ -271,7 +271,7 @@ def isFollowerOfPerson(base_dir: str, nickname: str, domain: str,
if handle in followersStr:
alreadyFollowing = True
else:
paths = getUserPaths()
paths = get_user_paths()
for userPath in paths:
url = '://' + followerDomain + userPath + followerNickname
if url in followersStr:
@ -652,7 +652,7 @@ def storeFollowRequest(base_dir: str,
if approveHandle in followersStr:
alreadyFollowing = True
else:
usersPaths = getUserPaths()
usersPaths = get_user_paths()
for possibleUsersPath in usersPaths:
url = '://' + domain_full + possibleUsersPath + nickname
if url in followersStr:

View File

@ -27,7 +27,7 @@ from utils import hasObjectString
from utils import hasObjectStringObject
from utils import getReplyIntervalHours
from utils import canReplyTo
from utils import getUserPaths
from utils import get_user_paths
from utils import get_base_content_from_post
from utils import acct_dir
from utils import removeDomainPort
@ -836,7 +836,7 @@ def _personReceiveUpdate(base_dir: str,
' ' + str(personJson))
domain_full = getFullDomain(domain, port)
updateDomainFull = getFullDomain(updateDomain, updatePort)
usersPaths = getUserPaths()
usersPaths = get_user_paths()
usersStrFound = False
for usersStr in usersPaths:
actor = updateDomainFull + usersStr + updateNickname

View File

@ -14,7 +14,7 @@ from follow import removeFromFollowRequests
from utils import loadJson
from utils import removeDomainPort
from utils import getPortFromDomain
from utils import getUserPaths
from utils import get_user_paths
from utils import acct_dir
from threads import threadWithTrace
@ -157,7 +157,7 @@ def manualApproveFollowRequest(session, base_dir: str,
reqNick = approveHandle.split('@')[0].replace('!', '')
reqDomain = approveHandle.split('@')[1].strip()
reqPrefix = http_prefix + '://' + reqDomain
paths = getUserPaths()
paths = get_user_paths()
for userPath in paths:
if reqPrefix + userPath + reqNick in approveFollowsStr:
exists = True

View File

@ -56,7 +56,7 @@ from utils import has_users_path
from utils import getImageExtensions
from utils import isImageFile
from utils import acct_dir
from utils import getUserPaths
from utils import get_user_paths
from utils import getGroupPaths
from utils import local_actor_url
from utils import dangerousSVG
@ -1421,7 +1421,7 @@ def _detectUsersPath(url: str) -> str:
"""
if '/' not in url:
return '/users/'
usersPaths = getUserPaths()
usersPaths = get_user_paths()
for possibleUsersPath in usersPaths:
if possibleUsersPath in url:
return possibleUsersPath
@ -1460,7 +1460,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
for prefix in prefixes:
handle = handle.replace(prefix, '')
handle = handle.replace('/@', detectedUsersPath)
paths = getUserPaths()
paths = get_user_paths()
userPathFound = False
for userPath in paths:
if userPath in handle:
@ -1570,7 +1570,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
if not personUrl and wfRequest:
personUrl = getUserUrl(wfRequest, 0, debug)
if nickname == domain:
paths = getUserPaths()
paths = get_user_paths()
for userPath in paths:
personUrl = personUrl.replace(userPath, '/actor/')
if not personUrl and group_account:

View File

@ -32,7 +32,7 @@ from webfinger import webfingerHandle
from httpsig import createSignedHeader
from siteactive import siteIsActive
from languages import understoodPostLanguage
from utils import getUserPaths
from utils import get_user_paths
from utils import invalidCiphertext
from utils import hasObjectStringType
from utils import removeIdEnding
@ -1271,7 +1271,7 @@ def _consolidateActorsList(actorsList: []) -> None:
if ccActor not in possibleDuplicateActors:
possibleDuplicateActors.append(ccActor)
if possibleDuplicateActors:
uPaths = getUserPaths()
uPaths = get_user_paths()
removeActors = []
for ccActor in possibleDuplicateActors:
for usrPath in uPaths:

View File

@ -194,7 +194,7 @@ def get_locked_account(actor_json: {}) -> bool:
def has_users_path(pathStr: str) -> bool:
"""Whether there is a /users/ path (or equivalent) in the given string
"""
usersList = getUserPaths()
usersList = get_user_paths()
for usersStr in usersList:
if usersStr in pathStr:
return True
@ -1022,7 +1022,7 @@ def getNicknameFromActor(actor: str) -> str:
"""
if actor.startswith('@'):
actor = actor[1:]
usersPaths = getUserPaths()
usersPaths = get_user_paths()
for possiblePath in usersPaths:
if possiblePath in actor:
nickStr = actor.split(possiblePath)[1].replace('@', '')
@ -1052,7 +1052,7 @@ def getNicknameFromActor(actor: str) -> str:
return None
def getUserPaths() -> []:
def get_user_paths() -> []:
"""Returns possible user paths
e.g. /users/nickname, /channel/nickname
"""
@ -1074,7 +1074,7 @@ def getDomainFromActor(actor: str) -> (str, int):
actor = actor[1:]
port = None
prefixes = getProtocolPrefixes()
usersPaths = getUserPaths()
usersPaths = get_user_paths()
for possiblePath in usersPaths:
if possiblePath in actor:
domain = actor.split(possiblePath)[0]
@ -3148,7 +3148,7 @@ def getSharesFilesList() -> []:
def replaceUsersWithAt(actor: str) -> str:
""" https://domain/users/nick becomes https://domain/@nick
"""
uPaths = getUserPaths()
uPaths = get_user_paths()
for path in uPaths:
if path in actor:
actor = actor.replace(path, '/@')

View File

@ -18,7 +18,7 @@ from utils import loadJsonOnionify
from utils import saveJson
from utils import getProtocolPrefixes
from utils import removeDomainPort
from utils import getUserPaths
from utils import get_user_paths
from utils import getGroupPaths
from utils import local_actor_url
@ -48,7 +48,7 @@ def _parseHandle(handle: str) -> (str, str, bool):
return nickname, domain, group_account
# try for different /users/ paths
usersPaths = getUserPaths()
usersPaths = get_user_paths()
groupPaths = getGroupPaths()
for possibleUsersPath in usersPaths:
if possibleUsersPath in handle: