mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 02:43:45 +03:00
Fix wrong camel case for all names
This commit is contained in:
parent
70f5af44de
commit
748f2db23d
|
@ -46,8 +46,8 @@ def _get_class_name(error_code):
|
||||||
error_code, 'RPCError' + str(error_code).replace('-', 'Neg')
|
error_code, 'RPCError' + str(error_code).replace('-', 'Neg')
|
||||||
)
|
)
|
||||||
|
|
||||||
return snake_to_camel_case(error_code.replace('FIRSTNAME', 'FIRST_NAME'),
|
return snake_to_camel_case(
|
||||||
suffix='Error')
|
error_code.replace('FIRSTNAME', 'FIRST_NAME').lower(), suffix='Error')
|
||||||
|
|
||||||
|
|
||||||
class Error:
|
class Error:
|
||||||
|
|
|
@ -3,6 +3,6 @@ import re
|
||||||
|
|
||||||
def snake_to_camel_case(name, suffix=None):
|
def snake_to_camel_case(name, suffix=None):
|
||||||
# Courtesy of http://stackoverflow.com/a/31531797/4759433
|
# Courtesy of http://stackoverflow.com/a/31531797/4759433
|
||||||
result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), name.lower())
|
result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), name)
|
||||||
result = result[:1].upper() + result[1:].replace('_', '')
|
result = result[:1].upper() + result[1:].replace('_', '')
|
||||||
return result + suffix if suffix else result
|
return result + suffix if suffix else result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user