From 4cdad1089752a3dd0674160ea39169c2495c1414 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 17:21:37 +0000 Subject: [PATCH] Snake case --- announce.py | 4 ++-- daemon.py | 4 ++-- person.py | 4 ++-- pgp.py | 4 ++-- posts.py | 8 ++++---- utils.py | 2 +- webapp_calendar.py | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/announce.py b/announce.py index 8177a8574..99af2a4df 100644 --- a/announce.py +++ b/announce.py @@ -23,7 +23,7 @@ from utils import save_json from utils import undoAnnounceCollectionEntry from utils import updateAnnounceCollection from utils import local_actor_url -from utils import replaceUsersWithAt +from utils import replace_users_with_at from utils import has_actor from utils import has_object_stringType from posts import sendSignedJson @@ -318,7 +318,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session, domain_full = get_full_domain(domain, port) actor = local_actor_url(http_prefix, nickname, domain_full) - handle = replaceUsersWithAt(actor) + handle = replace_users_with_at(actor) statusNumber, published = getStatusNumber() unAnnounceJson = { diff --git a/daemon.py b/daemon.py index 40e03570e..7da5221b2 100644 --- a/daemon.py +++ b/daemon.py @@ -249,7 +249,7 @@ from utils import has_actor from utils import setReplyIntervalHours from utils import canReplyTo from utils import isDM -from utils import replaceUsersWithAt +from utils import replace_users_with_at from utils import local_actor_url from utils import isfloat from utils import validPassword @@ -13977,7 +13977,7 @@ class PubServer(BaseHTTPRequestHandler): pinnedPostJson) message_json['id'] = postId + '/activity' message_json['object']['id'] = postId - message_json['object']['url'] = replaceUsersWithAt(postId) + message_json['object']['url'] = replace_users_with_at(postId) message_json['object']['atomUri'] = postId msg = json.dumps(message_json, ensure_ascii=False).encode('utf-8') diff --git a/person.py b/person.py index 4c297f859..90e7d0af4 100644 --- a/person.py +++ b/person.py @@ -40,7 +40,7 @@ from roles import getActorRolesList from media import processMetaData from utils import removeHtml from utils import containsInvalidChars -from utils import replaceUsersWithAt +from utils import replace_users_with_at from utils import removeLineEndings from utils import removeDomainPort from utils import getStatusNumber @@ -852,7 +852,7 @@ def personUpgradeActor(base_dir: str, personJson: {}, # update domain/@nickname in actors cache actorCacheFilename = \ base_dir + '/accounts/cache/actors/' + \ - replaceUsersWithAt(personJson['id']).replace('/', '#') + \ + replace_users_with_at(personJson['id']).replace('/', '#') + \ '.json' if os.path.isfile(actorCacheFilename): save_json(personJson, actorCacheFilename) diff --git a/pgp.py b/pgp.py index 253f6c2f2..bb26bbd61 100644 --- a/pgp.py +++ b/pgp.py @@ -16,7 +16,7 @@ from utils import isPGPEncrypted from utils import get_full_domain from utils import getStatusNumber from utils import local_actor_url -from utils import replaceUsersWithAt +from utils import replace_users_with_at from webfinger import webfingerHandle from posts import getPersonBox from auth import createBasicAuthHeader @@ -501,7 +501,7 @@ def pgpPublicKeyUpload(base_dir: str, session, print('Actor for ' + handle + ' obtained') actor = local_actor_url(http_prefix, nickname, domain_full) - handle = replaceUsersWithAt(actor) + handle = replace_users_with_at(actor) # check that this looks like the correct actor if not actor_json.get('id'): diff --git a/posts.py b/posts.py index 3fc11b6de..03d503bd1 100644 --- a/posts.py +++ b/posts.py @@ -36,7 +36,7 @@ from utils import get_user_paths from utils import invalidCiphertext from utils import has_object_stringType from utils import removeIdEnding -from utils import replaceUsersWithAt +from utils import replace_users_with_at from utils import hasGroupType from utils import get_base_content_from_post from utils import removeDomainPort @@ -1694,7 +1694,7 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str, 'tag': [], 'to': ['https://www.w3.org/ns/activitystreams#Public'], 'type': 'Note', - 'url': replaceUsersWithAt(actor) + '/pinned' + 'url': replace_users_with_at(actor) + '/pinned' } return pinnedPostJson @@ -4860,7 +4860,7 @@ def sendMuteViaServer(base_dir: str, session, fromDomainFull = get_full_domain(fromDomain, fromPort) actor = local_actor_url(http_prefix, fromNickname, fromDomainFull) - handle = replaceUsersWithAt(actor) + handle = replace_users_with_at(actor) newMuteJson = { "@context": "https://www.w3.org/ns/activitystreams", @@ -4940,7 +4940,7 @@ def sendUndoMuteViaServer(base_dir: str, session, fromDomainFull = get_full_domain(fromDomain, fromPort) actor = local_actor_url(http_prefix, fromNickname, fromDomainFull) - handle = replaceUsersWithAt(actor) + handle = replace_users_with_at(actor) undoMuteJson = { "@context": "https://www.w3.org/ns/activitystreams", diff --git a/utils.py b/utils.py index c5ed2ab67..517930e34 100644 --- a/utils.py +++ b/utils.py @@ -3148,7 +3148,7 @@ def getSharesFilesList() -> []: return ('shares', 'wanted') -def replaceUsersWithAt(actor: str) -> str: +def replace_users_with_at(actor: str) -> str: """ https://domain/users/nick becomes https://domain/@nick """ u_paths = get_user_paths() diff --git a/webapp_calendar.py b/webapp_calendar.py index e663b5b80..2fb593735 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -21,7 +21,7 @@ from utils import getAltPath from utils import removeDomainPort from utils import acct_dir from utils import local_actor_url -from utils import replaceUsersWithAt +from utils import replace_users_with_at from happening import getTodaysEvents from happening import getCalendarEvents from webapp_utils import setCustomBackground @@ -175,7 +175,7 @@ def _htmlCalendarDay(person_cache: {}, cssCache: {}, translate: {}, if senderName and eventDescription: # if the sender is also mentioned within the event # description then this is a reminder - senderActor2 = replaceUsersWithAt(senderActor) + senderActor2 = replace_users_with_at(senderActor) if senderActor not in eventDescription and \ senderActor2 not in eventDescription: eventDescription = senderName + eventDescription