|
|
|
|
|
by anentropic
439 days ago
|
|
Looks brilliant! My only suggestion is here: > It also ignores any leading, trailing, or duplicate delimiters: from textcase import case, convert
print(convert("IOStream", case.SNAKE)) # io_stream
print(convert("myJSONParser", case.SNAKE)) # my_json_parser
print(convert("__weird--var _name-", case.SNAKE)) # weird_var_name
In the case of a conversion target that has delimiters (snake, kebab) it might be nice to have an alternative option to preserve such features but normalise them to the target delimiteri.e. print(convert("__weird--var _name-", case.SNAKE, preserve=True)) # __weird__var__name
|
|