From 42466883596315a9aa7339c476303478e4cc5329 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Dec 2021 23:02:50 +0000 Subject: [PATCH] Snake case --- daemon.py | 25 +++++++++++++------------ inbox.py | 23 ++++++++++++----------- reaction.py | 8 ++++---- utils.py | 14 +++++++------- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/daemon.py b/daemon.py index 3766ffed4..7ecaf4201 100644 --- a/daemon.py +++ b/daemon.py @@ -243,7 +243,7 @@ from languages import getActorLanguages from languages import setActorLanguages from like import updateLikesCollection from reaction import updateReactionCollection -from utils import undoReactionCollectionEntry +from utils import undo_reaction_collection_entry from utils import get_new_post_endpoints from utils import has_actor from utils import setReplyIntervalHours @@ -8704,21 +8704,22 @@ class PubServer(BaseHTTPRequestHandler): recent_posts_cache = self.server.recent_posts_cache reactionPostJson = load_json(reactionPostFilename, 0, 1) if origFilename and origPostUrl: - undoReactionCollectionEntry(recent_posts_cache, - base_dir, reactionPostFilename, - reactionUrl, - undoActor, domain, debug, - reactionPostJson, - emojiContent) + undo_reaction_collection_entry(recent_posts_cache, + base_dir, + reactionPostFilename, + reactionUrl, + undoActor, domain, debug, + reactionPostJson, + emojiContent) reactionUrl = origPostUrl reactionPostFilename = origFilename if debug: print('Removing emoji reaction for ' + reactionPostFilename) - undoReactionCollectionEntry(recent_posts_cache, - base_dir, - reactionPostFilename, reactionUrl, - undoActor, domain, debug, - reactionPostJson, emojiContent) + undo_reaction_collection_entry(recent_posts_cache, + base_dir, + reactionPostFilename, reactionUrl, + undoActor, domain, debug, + reactionPostJson, emojiContent) if debug: print('Regenerating html post for changed ' + 'emoji reaction collection') diff --git a/inbox.py b/inbox.py index b78766e00..8a9949b5a 100644 --- a/inbox.py +++ b/inbox.py @@ -57,7 +57,7 @@ from utils import removeModerationPostFromIndex from utils import load_json from utils import save_json from utils import undoLikesCollectionEntry -from utils import undoReactionCollectionEntry +from utils import undo_reaction_collection_entry from utils import has_group_type from utils import local_actor_url from utils import has_object_stringType @@ -1446,9 +1446,9 @@ def _receiveUndoReaction(recent_posts_cache: {}, if debug: print('DEBUG: unreaction has no content') return True - undoReactionCollectionEntry(recent_posts_cache, base_dir, post_filename, - postReactionId, reactionActor, domain, - debug, None, emojiContent) + undo_reaction_collection_entry(recent_posts_cache, base_dir, post_filename, + postReactionId, reactionActor, domain, + debug, None, emojiContent) # regenerate the html reactionPostJson = load_json(post_filename, 0, 1) if reactionPostJson: @@ -1463,13 +1463,14 @@ def _receiveUndoReaction(recent_posts_cache: {}, if announceReactionFilename: postReactionId = announceReactionUrl post_filename = announceReactionFilename - undoReactionCollectionEntry(recent_posts_cache, - base_dir, - post_filename, - postReactionId, - reactionActor, domain, - debug, None, - emojiContent) + undo_reaction_collection_entry(recent_posts_cache, + base_dir, + post_filename, + postReactionId, + reactionActor, + domain, + debug, None, + emojiContent) if reactionPostJson: if debug: cachedPostFilename = \ diff --git a/reaction.py b/reaction.py index 300721b59..c1993fdad 100644 --- a/reaction.py +++ b/reaction.py @@ -23,7 +23,7 @@ from utils import url_permitted from utils import get_nickname_from_actor from utils import get_domain_from_actor from utils import locate_post -from utils import undoReactionCollectionEntry +from utils import undo_reaction_collection_entry from utils import has_group_type from utils import local_actor_url from utils import load_json @@ -432,9 +432,9 @@ def outboxUndoReaction(recent_posts_cache: {}, print('DEBUG: c2s undo reaction post not found in inbox or outbox') print(messageId) return True - undoReactionCollectionEntry(recent_posts_cache, base_dir, post_filename, - messageId, message_json['actor'], - domain, debug, None, emojiContent) + undo_reaction_collection_entry(recent_posts_cache, base_dir, post_filename, + messageId, message_json['actor'], + domain, debug, None, emojiContent) if debug: print('DEBUG: post undo reaction via c2s - ' + post_filename) diff --git a/utils.py b/utils.py index b6ef7a39a..f0bc49031 100644 --- a/utils.py +++ b/utils.py @@ -2276,12 +2276,12 @@ def undoLikesCollectionEntry(recent_posts_cache: {}, save_json(post_json_object, post_filename) -def undoReactionCollectionEntry(recent_posts_cache: {}, - base_dir: str, post_filename: str, - objectUrl: str, - actor: str, domain: str, debug: bool, - post_json_object: {}, - emojiContent: str) -> None: +def undo_reaction_collection_entry(recent_posts_cache: {}, + base_dir: str, post_filename: str, + objectUrl: str, + actor: str, domain: str, debug: bool, + post_json_object: {}, + emojiContent: str) -> None: """Undoes an emoji reaction for a particular actor """ if not post_json_object: @@ -2299,7 +2299,7 @@ def undoReactionCollectionEntry(recent_posts_cache: {}, try: os.remove(cached_post_filename) except OSError: - print('EX: undoReactionCollectionEntry ' + + print('EX: undo_reaction_collection_entry ' + 'unable to delete cached post ' + str(cached_post_filename)) remove_post_from_cache(post_json_object, recent_posts_cache)