From 682a6755e06b407200fd79a1dfdf19c2274891dc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Dec 2021 15:52:08 +0000 Subject: [PATCH] Snake case --- blog.py | 6 +++--- daemon.py | 4 ++-- newswire.py | 6 +++--- tests.py | 6 +++--- utils.py | 2 +- webapp_search.py | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/blog.py b/blog.py index 4fd04ee01..9b8870fc3 100644 --- a/blog.py +++ b/blog.py @@ -30,7 +30,7 @@ from utils import getNicknameFromActor from utils import getDomainFromActor from utils import locate_post from utils import load_json -from utils import firstParagraphFromString +from utils import first_paragraph_from_string from utils import get_actor_property_url from utils import acct_dir from posts import createBlogsTimeline @@ -370,7 +370,7 @@ def _htmlBlogPostRSS2(authorized: bool, content = \ get_base_content_from_post(post_json_object, system_language) - description = firstParagraphFromString(content) + description = first_paragraph_from_string(content) rssStr = ' ' rssStr += ' ' + titleStr + '' rssStr += ' ' + messageLink + '' @@ -405,7 +405,7 @@ def _htmlBlogPostRSS3(authorized: bool, content = \ get_base_content_from_post(post_json_object, system_language) - description = firstParagraphFromString(content) + description = first_paragraph_from_string(content) rssStr = 'title: ' + titleStr + '\n' rssStr += 'link: ' + messageLink + '\n' rssStr += 'description: ' + description + '\n' diff --git a/daemon.py b/daemon.py index ee7027778..aaf591af1 100644 --- a/daemon.py +++ b/daemon.py @@ -279,7 +279,7 @@ from utils import is_artist from utils import get_image_extensions from utils import media_file_mime_type from utils import getCSS -from utils import firstParagraphFromString +from utils import first_paragraph_from_string from utils import clearFromPostCaches from utils import containsInvalidChars from utils import is_system_account @@ -4648,7 +4648,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire[publishedDate][0] = \ newsPostTitle self.server.newswire[publishedDate][4] = \ - firstParagraphFromString(newsPostContent) + first_paragraph_from_string(newsPostContent) # save newswire newswireStateFilename = \ base_dir + '/accounts/.newswirestate.json' diff --git a/newswire.py b/newswire.py index b505f7588..6fa0ddd6a 100644 --- a/newswire.py +++ b/newswire.py @@ -22,7 +22,7 @@ from utils import dangerousSVG from utils import get_fav_filename_from_url from utils import get_base_content_from_post from utils import has_object_dict -from utils import firstParagraphFromString +from utils import first_paragraph_from_string from utils import isPublicPost from utils import locate_post from utils import load_json @@ -946,7 +946,7 @@ def getRSSfromDict(base_dir: str, newswire: {}, rssStr += \ '\n' + \ ' ' + fields[0] + '\n' - description = remove_html(firstParagraphFromString(fields[4])) + description = remove_html(first_paragraph_from_string(fields[4])) rssStr += ' ' + description + '\n' url = fields[1] if '://' not in url: @@ -1064,7 +1064,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str, content = \ get_base_content_from_post(post_json_object, system_language) - description = firstParagraphFromString(content) + description = first_paragraph_from_string(content) description = remove_html(description) tagsFromPost = _getHashtagsFromPost(post_json_object) summary = post_json_object['object']['summary'] diff --git a/tests.py b/tests.py index c272f6212..72214bca4 100644 --- a/tests.py +++ b/tests.py @@ -71,7 +71,7 @@ from utils import camel_case_split from utils import decoded_host from utils import get_full_domain from utils import validNickname -from utils import firstParagraphFromString +from utils import first_paragraph_from_string from utils import remove_id_ending from utils import updateRecentPostsCache from utils import followPerson @@ -4154,13 +4154,13 @@ def _testFirstParagraphFromString(): testStr = \ '

This is a test

' + \ '

This is another paragraph

' - resultStr = firstParagraphFromString(testStr) + resultStr = first_paragraph_from_string(testStr) if resultStr != 'This is a test': print(resultStr) assert resultStr == 'This is a test' testStr = 'Testing without html' - resultStr = firstParagraphFromString(testStr) + resultStr = first_paragraph_from_string(testStr) assert resultStr == testStr diff --git a/utils.py b/utils.py index 5b8f4ab27..acea66eeb 100644 --- a/utils.py +++ b/utils.py @@ -474,7 +474,7 @@ def remove_html(content: str) -> str: return result -def firstParagraphFromString(content: str) -> str: +def first_paragraph_from_string(content: str) -> str: """Get the first paragraph from a blog post to be used as a summary in the newswire feed """ diff --git a/webapp_search.py b/webapp_search.py index 0b190c541..f695a7cfd 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -21,7 +21,7 @@ from utils import getDomainFromActor from utils import getNicknameFromActor from utils import locate_post from utils import isPublicPost -from utils import firstParagraphFromString +from utils import first_paragraph_from_string from utils import searchBoxPosts from utils import get_alt_path from utils import acct_dir @@ -989,7 +989,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int, description = \ get_base_content_from_post(post_json_object, system_language) - description = firstParagraphFromString(description) + description = first_paragraph_from_string(description) hashtagFeed += \ ' ' + description + '' hashtagFeed += \