Snake case

merge-requests/30/head
Bob Mottram 2021-12-28 14:24:14 +00:00
parent 2c39ccf66a
commit e580ea1963
3 changed files with 12 additions and 12 deletions

View File

@ -73,7 +73,7 @@ from utils import get_full_domain
from utils import validNickname
from utils import first_paragraph_from_string
from utils import remove_id_ending
from utils import updateRecentPostsCache
from utils import update_recent_posts_cache
from utils import follow_person
from utils import get_nickname_from_actor
from utils import get_domain_from_actor
@ -3538,8 +3538,8 @@ def _testRecentPostsCache():
post_json_object = {
"id": "https://somesite.whatever/users/someuser/statuses/" + str(i)
}
updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, htmlStr)
update_recent_posts_cache(recent_posts_cache, max_recent_posts,
post_json_object, htmlStr)
assert len(recent_posts_cache['index']) == max_recent_posts
assert len(recent_posts_cache['json'].items()) == max_recent_posts
assert len(recent_posts_cache['html'].items()) == max_recent_posts

View File

@ -2014,8 +2014,8 @@ def get_cached_post_filename(base_dir: str, nickname: str, domain: str,
return cached_post_filename + '.html'
def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
post_json_object: {}, htmlStr: str) -> None:
def update_recent_posts_cache(recent_posts_cache: {}, max_recent_posts: int,
post_json_object: {}, html_str: str) -> None:
"""Store recent posts in memory so that they can be quickly recalled
"""
if not post_json_object.get('id'):
@ -2030,7 +2030,7 @@ def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
recent_posts_cache['index'].append(post_id)
post_json_object['muted'] = False
recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
recent_posts_cache['html'][post_id] = htmlStr
recent_posts_cache['html'][post_id] = html_str
while len(recent_posts_cache['html'].items()) > max_recent_posts:
post_id = recent_posts_cache['index'][0]
@ -2044,7 +2044,7 @@ def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
recent_posts_cache['json'] = {}
recent_posts_cache['html'] = {}
recent_posts_cache['json'][post_id] = json.dumps(post_json_object)
recent_posts_cache['html'][post_id] = htmlStr
recent_posts_cache['html'][post_id] = html_str
def file_last_modified(filename: str) -> str:

View File

@ -46,7 +46,7 @@ from utils import is_news_post
from utils import is_blog_post
from utils import get_display_name
from utils import isPublicPost
from utils import updateRecentPostsCache
from utils import update_recent_posts_cache
from utils import remove_id_ending
from utils import get_nickname_from_actor
from utils import get_domain_from_actor
@ -324,8 +324,8 @@ def _getPostFromRecentCache(session,
postHtml = \
preparePostFromHtmlCache(nickname, postHtml, boxName, pageNumber)
updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
update_recent_posts_cache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '3')
return postHtml
@ -1984,8 +1984,8 @@ def individualPostAsHtml(signing_priv_key_pem: str,
boxName != 'bookmarks':
_saveIndividualPostAsHtmlToCache(base_dir, nickname, domain,
post_json_object, postHtml)
updateRecentPostsCache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
update_recent_posts_cache(recent_posts_cache, max_recent_posts,
post_json_object, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '19')