From 886401990c33c8492d5f65270672dfb004f75de7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 20:39:35 +0000 Subject: [PATCH] Snake case --- speaker.py | 4 ++-- tests.py | 6 +++--- utils.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/speaker.py b/speaker.py index f32caeaea..86b2c3c03 100644 --- a/speaker.py +++ b/speaker.py @@ -14,7 +14,7 @@ import urllib.parse from utils import removeIdEnding from utils import is_dm from utils import is_reply -from utils import camelCaseSplit +from utils import camel_case_split from utils import getDomainFromActor from utils import getNicknameFromActor from utils import getGenderFromBio @@ -475,7 +475,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, return speakerName = _removeEmojiFromText(speakerName) speakerName = speakerName.replace('_', ' ') - speakerName = camelCaseSplit(speakerName) + speakerName = camel_case_split(speakerName) gender = getGenderFromBio(base_dir, post_json_object['actor'], person_cache, translate) if announcingActor: diff --git a/tests.py b/tests.py index 51c6ffcc8..172c98eaf 100644 --- a/tests.py +++ b/tests.py @@ -67,7 +67,7 @@ from utils import date_string_to_seconds from utils import date_seconds_to_string from utils import valid_password from utils import user_agent_domain -from utils import camelCaseSplit +from utils import camel_case_split from utils import decoded_host from utils import get_full_domain from utils import validNickname @@ -5010,10 +5010,10 @@ def _testSpeakerReplaceLinks(): def _testCamelCaseSplit(): print('testCamelCaseSplit') testStr = 'ThisIsCamelCase' - assert camelCaseSplit(testStr) == 'This Is Camel Case' + assert camel_case_split(testStr) == 'This Is Camel Case' testStr = 'Notcamelcase test' - assert camelCaseSplit(testStr) == 'Notcamelcase test' + assert camel_case_split(testStr) == 'Notcamelcase test' def _testEmojiImages(): diff --git a/utils.py b/utils.py index 727cc1112..b4cabf570 100644 --- a/utils.py +++ b/utils.py @@ -2541,7 +2541,7 @@ def isRecentPost(post_json_object: {}, maxDays: int) -> bool: return True -def camelCaseSplit(text: str) -> str: +def camel_case_split(text: str) -> str: """ Splits CamelCase into "Camel Case" """ matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|' +