This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Custom JSON Encoder to convert snake_case properties to camelCase json""" | |
import json | |
def to_camel_case(snake_str): | |
"""converts snake_case to camelCase""" | |
components = snake_str.split('_') | |
# We capitalize the first letter of each component except the first one | |
# with the 'title' method and join them together. | |
return components[0] + ''.join(x.title() for x in components[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo: str = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dataclass | |
class FooBar: | |
id: str | |
description: str | |
score: float | |
my_var: FooBar = FooBar() |