From b71d662d8edf041a29d07af10ddb88ead4b55c49 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 17:12:07 +0000 Subject: [PATCH] Snake case --- acceptreject.py | 4 ++-- announce.py | 6 +++--- availability.py | 4 ++-- blocking.py | 16 ++++++++-------- bookmarks.py | 6 +++--- delete.py | 4 ++-- follow.py | 4 ++-- git.py | 4 ++-- inbox.py | 24 ++++++++++++------------ like.py | 8 ++++---- outbox.py | 4 ++-- posts.py | 8 ++++---- reaction.py | 8 ++++---- shares.py | 6 +++--- skills.py | 4 ++-- utils.py | 10 +++++----- 16 files changed, 60 insertions(+), 60 deletions(-) diff --git a/acceptreject.py b/acceptreject.py index f921feb0f..9617901c4 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -20,7 +20,7 @@ from utils import acct_dir from utils import hasGroupType from utils import local_actor_url from utils import hasActor -from utils import hasObjectStringType +from utils import has_object_stringType def _create_accept_reject(base_dir: str, federation_list: [], @@ -79,7 +79,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {}, federation_list: [], debug: bool) -> None: """Receiving a follow Accept activity """ - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Follow': if not message_json['object']['type'] == 'Join': diff --git a/announce.py b/announce.py index f5b09e7d2..e093c7cda 100644 --- a/announce.py +++ b/announce.py @@ -25,7 +25,7 @@ from utils import updateAnnounceCollection from utils import local_actor_url from utils import replaceUsersWithAt from utils import hasActor -from utils import hasObjectStringType +from utils import has_object_stringType from posts import sendSignedJson from posts import getPersonBox from session import postJson @@ -82,7 +82,7 @@ def outboxAnnounce(recentPostsCache: {}, nickname, domain, debug) return True elif message_json['type'] == 'Undo': - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if message_json['object']['type'] == 'Announce': if not isinstance(message_json['object']['object'], str): @@ -396,7 +396,7 @@ def outboxUndoAnnounce(recentPostsCache: {}, return if not message_json['type'] == 'Undo': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Announce': if debug: diff --git a/availability.py b/availability.py index 0f3b95615..99295fb54 100644 --- a/availability.py +++ b/availability.py @@ -12,7 +12,7 @@ from webfinger import webfingerHandle from auth import createBasicAuthHeader from posts import getPersonBox from session import postJson -from utils import hasObjectString +from utils import has_object_string from utils import get_full_domain from utils import getNicknameFromActor from utils import getDomainFromActor @@ -64,7 +64,7 @@ def outboxAvailability(base_dir: str, nickname: str, message_json: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False actorNickname = getNicknameFromActor(message_json['actor']) diff --git a/blocking.py b/blocking.py index 8fa8d2294..fc109e2c1 100644 --- a/blocking.py +++ b/blocking.py @@ -11,9 +11,9 @@ import os import json import time from datetime import datetime -from utils import hasObjectString +from utils import has_object_string from utils import has_object_string_object -from utils import hasObjectStringType +from utils import has_object_stringType from utils import removeDomainPort from utils import has_object_dict from utils import isAccountDir @@ -427,7 +427,7 @@ def outboxBlock(base_dir: str, http_prefix: str, if debug: print('DEBUG: not a block') return False - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False if debug: print('DEBUG: c2s block request arrived in outbox') @@ -477,7 +477,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str, print('DEBUG: not an undo block') return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Block': if debug: @@ -540,7 +540,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int, if has_object_dict(post_json_object): postJsonObj = post_json_object['object'] else: - if hasObjectString(post_json_object, debug): + if has_object_string(post_json_object, debug): alsoUpdatePostId = removeIdEnding(post_json_object['object']) domain_full = get_full_domain(domain, port) @@ -679,7 +679,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int, if has_object_dict(post_json_object): postJsonObj = post_json_object['object'] else: - if hasObjectString(post_json_object, debug): + if has_object_string(post_json_object, debug): alsoUpdatePostId = removeIdEnding(post_json_object['object']) if postJsonObj.get('conversation'): @@ -783,7 +783,7 @@ def outboxMute(base_dir: str, http_prefix: str, return if not message_json['type'] == 'Ignore': return - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return if debug: print('DEBUG: c2s mute request arrived in outbox') @@ -832,7 +832,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str, return if not message_json['type'] == 'Undo': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if message_json['object']['type'] != 'Ignore': return diff --git a/bookmarks.py b/bookmarks.py index 2ff3d84c2..26cb560f6 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -27,7 +27,7 @@ from utils import has_object_dict from utils import acct_dir from utils import local_actor_url from utils import hasActor -from utils import hasObjectStringType +from utils import has_object_stringType from posts import getPersonBox from session import postJson @@ -566,7 +566,7 @@ def outboxBookmark(recentPostsCache: {}, if debug: print('DEBUG: no target in bookmark Add') return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not isinstance(message_json['target'], str): if debug: @@ -622,7 +622,7 @@ def outboxUndoBookmark(recentPostsCache: {}, if debug: print('DEBUG: no target in unbookmark Remove') return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not isinstance(message_json['target'], str): if debug: diff --git a/delete.py b/delete.py index 76bae973b..6f0387b38 100644 --- a/delete.py +++ b/delete.py @@ -9,7 +9,7 @@ __module_group__ = "ActivityPub" import os from datetime import datetime -from utils import hasObjectString +from utils import has_object_string from utils import removeDomainPort from utils import has_users_path from utils import get_full_domain @@ -127,7 +127,7 @@ def outboxDelete(base_dir: str, http_prefix: str, if debug: print('DEBUG: not a delete') return - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return if debug: print('DEBUG: c2s delete request arrived in outbox') diff --git a/follow.py b/follow.py index e14bcfa6a..e8084ca2c 100644 --- a/follow.py +++ b/follow.py @@ -10,7 +10,7 @@ __module_group__ = "ActivityPub" from pprint import pprint import os from utils import has_object_string_object -from utils import hasObjectStringType +from utils import has_object_stringType from utils import removeDomainPort from utils import has_users_path from utils import get_full_domain @@ -1385,7 +1385,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None: return if not message_json['type'] == 'Undo': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Follow': if not message_json['object']['type'] == 'Join': diff --git a/git.py b/git.py index 177dfd1fa..8451d532c 100644 --- a/git.py +++ b/git.py @@ -10,7 +10,7 @@ __module_group__ = "Profile Metadata" import os import html from utils import acct_dir -from utils import hasObjectStringType +from utils import has_object_stringType def _gitFormatContent(content: str) -> str: @@ -116,7 +116,7 @@ def convertPostToPatch(base_dir: str, nickname: str, domain: str, """Detects whether the given post contains a patch and if so then converts it to a Patch ActivityPub type """ - if not hasObjectStringType(post_json_object, False): + if not has_object_stringType(post_json_object, False): return False if post_json_object['object']['type'] == 'Patch': return True diff --git a/inbox.py b/inbox.py index b5308827b..ac83039d0 100644 --- a/inbox.py +++ b/inbox.py @@ -23,7 +23,7 @@ from utils import isSystemAccount from utils import invalidCiphertext from utils import removeHtml from utils import fileLastModified -from utils import hasObjectString +from utils import has_object_string from utils import has_object_string_object from utils import getReplyIntervalHours from utils import canReplyTo @@ -60,7 +60,7 @@ from utils import undoLikesCollectionEntry from utils import undoReactionCollectionEntry from utils import hasGroupType from utils import local_actor_url -from utils import hasObjectStringType +from utils import has_object_stringType from categories import getHashtagCategories from categories import setHashtagCategory from httpsig import getDigestAlgorithmFromHeaders @@ -811,7 +811,7 @@ def _receiveUndo(session, base_dir: str, http_prefix: str, if debug: print('DEBUG: "users" or "profile" missing from actor') return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if not has_object_string_object(message_json, debug): return False @@ -951,7 +951,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str, return False if not hasActor(message_json, debug): return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if not has_users_path(message_json['actor']): if debug: @@ -1015,7 +1015,7 @@ def _receiveLike(recentPostsCache: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False if not message_json.get('to'): if debug: @@ -1137,7 +1137,7 @@ def _receiveUndoLike(recentPostsCache: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if message_json['object']['type'] != 'Like': return False @@ -1249,7 +1249,7 @@ def _receiveReaction(recentPostsCache: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False if not message_json.get('to'): if debug: @@ -1398,7 +1398,7 @@ def _receiveUndoReaction(recentPostsCache: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if message_json['object']['type'] != 'EmojiReact': return False @@ -1530,7 +1530,7 @@ def _receiveBookmark(recentPostsCache: {}, if debug: print('DEBUG: no target in inbox bookmark Add') return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if not isinstance(message_json['target'], str): if debug: @@ -1642,7 +1642,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, if debug: print('DEBUG: no target in inbox undo bookmark Remove') return False - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return False if not isinstance(message_json['target'], str): if debug: @@ -1739,7 +1739,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str, return False if debug: print('DEBUG: Delete activity arrived') - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False domain_full = get_full_domain(domain, port) deletePrefix = http_prefix + '://' + domain_full + '/' @@ -1829,7 +1829,7 @@ def _receiveAnnounce(recentPostsCache: {}, return False if debug: print('DEBUG: receiving announce on ' + handle) - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False if not message_json.get('to'): if debug: diff --git a/like.py b/like.py index 3909684d6..f003f6ffe 100644 --- a/like.py +++ b/like.py @@ -9,9 +9,9 @@ __module_group__ = "ActivityPub" import os from pprint import pprint -from utils import hasObjectString +from utils import has_object_string from utils import has_object_string_object -from utils import hasObjectStringType +from utils import has_object_stringType from utils import removeDomainPort from utils import has_object_dict from utils import has_users_path @@ -353,7 +353,7 @@ def outboxLike(recentPostsCache: {}, if debug: print('DEBUG: not a like') return - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return if debug: print('DEBUG: c2s like request arrived in outbox') @@ -384,7 +384,7 @@ def outboxUndoLike(recentPostsCache: {}, return if not message_json['type'] == 'Undo': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Like': if debug: diff --git a/outbox.py b/outbox.py index 15dcff630..a8a0c7034 100644 --- a/outbox.py +++ b/outbox.py @@ -16,7 +16,7 @@ from posts import outboxMessageCreateWrap from posts import savePostToBox from posts import sendToFollowersThread from posts import sendToNamedAddressesThread -from utils import hasObjectStringType +from utils import has_object_stringType from utils import get_base_content_from_post from utils import has_object_dict from utils import getLocalNetworkAddresses @@ -76,7 +76,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {}, return if message_json['type'] != 'Update': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not isinstance(message_json['object']['type'], str): if debug: diff --git a/posts.py b/posts.py index 45d119b60..3fc11b6de 100644 --- a/posts.py +++ b/posts.py @@ -34,7 +34,7 @@ from siteactive import siteIsActive from languages import understoodPostLanguage from utils import get_user_paths from utils import invalidCiphertext -from utils import hasObjectStringType +from utils import has_object_stringType from utils import removeIdEnding from utils import replaceUsersWithAt from utils import hasGroupType @@ -2850,7 +2850,7 @@ def _isProfileUpdate(post_json_object: {}) -> bool: for actor updates there is no 'to' within the object """ if post_json_object.get('type'): - if hasObjectStringType(post_json_object, False): + if has_object_stringType(post_json_object, False): if (post_json_object['type'] == 'Update' and (post_json_object['object']['type'] == 'Person' or post_json_object['object']['type'] == 'Application' or @@ -2891,7 +2891,7 @@ def _sendToNamedAddresses(session, base_dir: str, pprint(post_json_object) print('DEBUG: ' + 'no "to" field when sending to named addresses') - if hasObjectStringType(post_json_object, debug): + if has_object_stringType(post_json_object, debug): if post_json_object['object']['type'] == 'Follow' or \ post_json_object['object']['type'] == 'Join': post_json_obj2 = post_json_object['object']['object'] @@ -3077,7 +3077,7 @@ def _sendingProfileUpdate(post_json_object: {}) -> bool: """ if post_json_object['type'] != 'Update': return False - if not hasObjectStringType(post_json_object, False): + if not has_object_stringType(post_json_object, False): return False activityType = post_json_object['object']['type'] if activityType == 'Person' or \ diff --git a/reaction.py b/reaction.py index 38fb86180..ed91cf273 100644 --- a/reaction.py +++ b/reaction.py @@ -11,9 +11,9 @@ import os import re import urllib.parse from pprint import pprint -from utils import hasObjectString +from utils import has_object_string from utils import has_object_string_object -from utils import hasObjectStringType +from utils import has_object_stringType from utils import removeDomainPort from utils import has_object_dict from utils import has_users_path @@ -368,7 +368,7 @@ def outboxReaction(recentPostsCache: {}, if debug: print('DEBUG: not a reaction') return - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return if not message_json.get('content'): return @@ -408,7 +408,7 @@ def outboxUndoReaction(recentPostsCache: {}, return if not message_json['type'] == 'Undo': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'EmojiReact': if debug: diff --git a/shares.py b/shares.py index a246fcdd2..71b976571 100644 --- a/shares.py +++ b/shares.py @@ -22,7 +22,7 @@ from posts import getPersonBox from session import postJson from session import postImage from session import createSession -from utils import hasObjectStringType +from utils import has_object_stringType from utils import dateStringToSeconds from utils import dateSecondsToString from utils import get_config_param @@ -1039,7 +1039,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str, return if not message_json['type'] == 'Add': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Offer': if debug: @@ -1108,7 +1108,7 @@ def outboxUndoShareUpload(base_dir: str, http_prefix: str, return if not message_json['type'] == 'Remove': return - if not hasObjectStringType(message_json, debug): + if not has_object_stringType(message_json, debug): return if not message_json['object']['type'] == 'Offer': if debug: diff --git a/skills.py b/skills.py index 57f359634..4eb355207 100644 --- a/skills.py +++ b/skills.py @@ -12,7 +12,7 @@ from webfinger import webfingerHandle from auth import createBasicAuthHeader from posts import getPersonBox from session import postJson -from utils import hasObjectString +from utils import has_object_string from utils import get_full_domain from utils import getNicknameFromActor from utils import getDomainFromActor @@ -154,7 +154,7 @@ def outboxSkills(base_dir: str, nickname: str, message_json: {}, return False if not hasActor(message_json, debug): return False - if not hasObjectString(message_json, debug): + if not has_object_string(message_json, debug): return False actorNickname = getNicknameFromActor(message_json['actor']) diff --git a/utils.py b/utils.py index a72a59022..90773aeca 100644 --- a/utils.py +++ b/utils.py @@ -2084,7 +2084,7 @@ def isBlogPost(post_json_object: {}) -> bool: return False if not has_object_dict(post_json_object): return False - if not hasObjectStringType(post_json_object, False): + if not has_object_stringType(post_json_object, False): return False if not post_json_object['object'].get('content'): return False @@ -3175,12 +3175,12 @@ def hasActor(post_json_object: {}, debug: bool) -> bool: return False -def hasObjectStringType(post_json_object: {}, debug: bool) -> bool: +def has_object_stringType(post_json_object: {}, debug: bool) -> bool: """Does the given post have a type field within an object dict? """ if not has_object_dict(post_json_object): if debug: - print('hasObjectStringType no object found') + print('has_object_stringType no object found') return False if post_json_object['object'].get('type'): if isinstance(post_json_object['object']['type'], str): @@ -3199,7 +3199,7 @@ def has_object_string_object(post_json_object: {}, debug: bool) -> bool: """ if not has_object_dict(post_json_object): if debug: - print('hasObjectStringType no object found') + print('has_object_stringType no object found') return False if post_json_object['object'].get('object'): if isinstance(post_json_object['object']['object'], str): @@ -3213,7 +3213,7 @@ def has_object_string_object(post_json_object: {}, debug: bool) -> bool: return False -def hasObjectString(post_json_object: {}, debug: bool) -> bool: +def has_object_string(post_json_object: {}, debug: bool) -> bool: """Does the given post have an object string field? """ if post_json_object.get('object'):