Snake case

main
Bob Mottram 2021-12-28 13:07:02 +00:00
parent b33539b32f
commit 302090e039
2 changed files with 16 additions and 16 deletions

View File

@ -2106,9 +2106,9 @@ def is_news_post(post_json_object: {}) -> bool:
return post_json_object.get('news') return post_json_object.get('news')
def _searchVirtualBoxPosts(base_dir: str, nickname: str, domain: str, def _search_virtual_box_posts(base_dir: str, nickname: str, domain: str,
search_str: str, max_results: int, search_str: str, max_results: int,
box_name: str) -> []: box_name: str) -> []:
"""Searches through a virtual box, which is typically an index on the inbox """Searches through a virtual box, which is typically an index on the inbox
""" """
index_filename = \ index_filename = \
@ -2158,9 +2158,9 @@ def _searchVirtualBoxPosts(base_dir: str, nickname: str, domain: str,
return res return res
def searchBoxPosts(base_dir: str, nickname: str, domain: str, def search_box_posts(base_dir: str, nickname: str, domain: str,
search_str: str, max_results: int, search_str: str, max_results: int,
box_name='outbox') -> []: box_name='outbox') -> []:
"""Search your posts and return a list of the filenames """Search your posts and return a list of the filenames
containing matching strings containing matching strings
""" """
@ -2168,8 +2168,8 @@ def searchBoxPosts(base_dir: str, nickname: str, domain: str,
# is this a virtual box, such as direct messages? # is this a virtual box, such as direct messages?
if not os.path.isdir(path): if not os.path.isdir(path):
if os.path.isfile(path + '.index'): if os.path.isfile(path + '.index'):
return _searchVirtualBoxPosts(base_dir, nickname, domain, return _search_virtual_box_posts(base_dir, nickname, domain,
search_str, max_results, box_name) search_str, max_results, box_name)
return [] return []
search_str = search_str.lower().strip() search_str = search_str.lower().strip()
@ -2397,8 +2397,8 @@ def undo_announce_collection_entry(recent_posts_cache: {},
if announce_item['actor'] == actor: if announce_item['actor'] == actor:
if debug: if debug:
print('DEBUG: Announce was removed for ' + actor) print('DEBUG: Announce was removed for ' + actor)
anIt = announce_item an_it = announce_item
post_json_object['object']['shares']['items'].remove(anIt) post_json_object['object']['shares']['items'].remove(an_it)
item_found = True item_found = True
break break
if not item_found: if not item_found:
@ -2561,10 +2561,10 @@ def camel_case_split(text: str) -> str:
'(?<=[A-Z])(?=[A-Z][a-z])|$)', text) '(?<=[A-Z])(?=[A-Z][a-z])|$)', text)
if not matches: if not matches:
return text return text
resultStr = '' result_str = ''
for word in matches: for word in matches:
resultStr += word.group(0) + ' ' result_str += word.group(0) + ' '
return resultStr.strip() return result_str.strip()
def reject_post_id(base_dir: str, nickname: str, domain: str, def reject_post_id(base_dir: str, nickname: str, domain: str,

View File

@ -22,7 +22,7 @@ from utils import get_nickname_from_actor
from utils import locate_post from utils import locate_post
from utils import isPublicPost from utils import isPublicPost
from utils import first_paragraph_from_string from utils import first_paragraph_from_string
from utils import searchBoxPosts from utils import search_box_posts
from utils import get_alt_path from utils import get_alt_path
from utils import acct_dir from utils import acct_dir
from utils import local_actor_url from utils import local_actor_url
@ -616,8 +616,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
historysearch = historysearch.lower().strip('\n').strip('\r') historysearch = historysearch.lower().strip('\n').strip('\r')
boxFilenames = \ boxFilenames = \
searchBoxPosts(base_dir, nickname, domain, search_box_posts(base_dir, nickname, domain,
historysearch, postsPerPage, boxName) historysearch, postsPerPage, boxName)
cssFilename = base_dir + '/epicyon-profile.css' cssFilename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):