mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
9 lines
306 B
Python
9 lines
306 B
Python
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 = result[:1].upper() + result[1:].replace('_', '')
|
|
return result + suffix if suffix else result
|