Fix wrong camel case for all names

This commit is contained in:
Lonami Exo 2018-04-14 19:04:07 +02:00
parent 70f5af44de
commit 748f2db23d
2 changed files with 3 additions and 3 deletions

View File

@ -46,8 +46,8 @@ def _get_class_name(error_code):
error_code, 'RPCError' + str(error_code).replace('-', 'Neg')
)
return snake_to_camel_case(error_code.replace('FIRSTNAME', 'FIRST_NAME'),
suffix='Error')
return snake_to_camel_case(
error_code.replace('FIRSTNAME', 'FIRST_NAME').lower(), suffix='Error')
class Error:

View File

@ -3,6 +3,6 @@ import re
def snake_to_camel_case(name, suffix=None):
# 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('_', '')
return result + suffix if suffix else result