Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 20:39:35 +00:00
parent 25a4d98cc6
commit 886401990c
3 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ import urllib.parse
from utils import removeIdEnding from utils import removeIdEnding
from utils import is_dm from utils import is_dm
from utils import is_reply from utils import is_reply
from utils import camelCaseSplit from utils import camel_case_split
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import getGenderFromBio from utils import getGenderFromBio
@ -475,7 +475,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
return return
speakerName = _removeEmojiFromText(speakerName) speakerName = _removeEmojiFromText(speakerName)
speakerName = speakerName.replace('_', ' ') speakerName = speakerName.replace('_', ' ')
speakerName = camelCaseSplit(speakerName) speakerName = camel_case_split(speakerName)
gender = getGenderFromBio(base_dir, post_json_object['actor'], gender = getGenderFromBio(base_dir, post_json_object['actor'],
person_cache, translate) person_cache, translate)
if announcingActor: if announcingActor:

View File

@ -67,7 +67,7 @@ from utils import date_string_to_seconds
from utils import date_seconds_to_string from utils import date_seconds_to_string
from utils import valid_password from utils import valid_password
from utils import user_agent_domain from utils import user_agent_domain
from utils import camelCaseSplit from utils import camel_case_split
from utils import decoded_host from utils import decoded_host
from utils import get_full_domain from utils import get_full_domain
from utils import validNickname from utils import validNickname
@ -5010,10 +5010,10 @@ def _testSpeakerReplaceLinks():
def _testCamelCaseSplit(): def _testCamelCaseSplit():
print('testCamelCaseSplit') print('testCamelCaseSplit')
testStr = 'ThisIsCamelCase' testStr = 'ThisIsCamelCase'
assert camelCaseSplit(testStr) == 'This Is Camel Case' assert camel_case_split(testStr) == 'This Is Camel Case'
testStr = 'Notcamelcase test' testStr = 'Notcamelcase test'
assert camelCaseSplit(testStr) == 'Notcamelcase test' assert camel_case_split(testStr) == 'Notcamelcase test'
def _testEmojiImages(): def _testEmojiImages():

View File

@ -2541,7 +2541,7 @@ def isRecentPost(post_json_object: {}, maxDays: int) -> bool:
return True return True
def camelCaseSplit(text: str) -> str: def camel_case_split(text: str) -> str:
""" Splits CamelCase into "Camel Case" """ Splits CamelCase into "Camel Case"
""" """
matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|' + matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|' +