From 23af1b48ef15b10046521e1a453c0e41dc4fd968 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 10:54:58 +0000 Subject: [PATCH] Snake case --- utils.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/utils.py b/utils.py index 6bc579f8c..5517c7699 100644 --- a/utils.py +++ b/utils.py @@ -82,39 +82,39 @@ def get_content_from_post(post_json_object: {}, system_language: str, """Returns the content from the post in the given language including searching for a matching entry within contentMap """ - thisPostJson = post_json_object + this_post_json = post_json_object if hasObjectDict(post_json_object): - thisPostJson = post_json_object['object'] - if not thisPostJson.get('content'): + this_post_json = post_json_object['object'] + if not this_post_json.get('content'): return '' content = '' - if thisPostJson.get('contentMap'): - if isinstance(thisPostJson['contentMap'], dict): - if thisPostJson['contentMap'].get(system_language): - sys_lang = thisPostJson['contentMap'][system_language] + if this_post_json.get('contentMap'): + if isinstance(this_post_json['contentMap'], dict): + if this_post_json['contentMap'].get(system_language): + sys_lang = this_post_json['contentMap'][system_language] if isinstance(sys_lang, str): - return thisPostJson['contentMap'][system_language] + return this_post_json['contentMap'][system_language] else: # is there a contentMap entry for one of # the understood languages? for lang in languages_understood: - if thisPostJson['contentMap'].get(lang): - return thisPostJson['contentMap'][lang] + if this_post_json['contentMap'].get(lang): + return this_post_json['contentMap'][lang] else: - if isinstance(thisPostJson['content'], str): - content = thisPostJson['content'] + if isinstance(this_post_json['content'], str): + content = this_post_json['content'] return content def getBaseContentFromPost(post_json_object: {}, system_language: str) -> str: """Returns the content from the post in the given language """ - thisPostJson = post_json_object + this_post_json = post_json_object if hasObjectDict(post_json_object): - thisPostJson = post_json_object['object'] - if not thisPostJson.get('content'): + this_post_json = post_json_object['object'] + if not this_post_json.get('content'): return '' - return thisPostJson['content'] + return this_post_json['content'] def acctDir(base_dir: str, nickname: str, domain: str) -> str: