PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pydantic
"""Alias generators for converting between different capitalization conventions.""" import re __all__ = ('to_pascal', 'to_camel', 'to_snake') def to_pascal(snake: str) -> str: """Convert a snake_case string to PascalCase. Args: snake: The string to convert. Returns: The PascalCase string. """ camel = snake.title() return re.sub('([0-9A-Za-z])_(?=[0-9A-Z])', lambda m: m.group(1), camel) def to_camel(snake: str) -> str: """Convert a snake_case string to camelCase. Args: snake: The string to convert. Returns: The converted camelCase string. """ camel = to_pascal(snake) return re.sub('(^_*[A-Z])', lambda m: m.group(1).lower(), camel) def to_snake(camel: str) -> str: """Convert a PascalCase or camelCase string to snake_case. Args: camel: The string to convert. Returns: The converted string in snake_case. """ snake = re.sub(r'([a-zA-Z])([0-9])', lambda m: f'{m.group(1)}_{m.group(2)}', camel) snake = re.sub(r'([a-z0-9])([A-Z])', lambda m: f'{m.group(1)}_{m.group(2)}', snake) return snake.lower()
[-] warnings.py
[edit]
[+]
plugin
[+]
v1
[-] color.py
[edit]
[+]
_internal
[-] dataclasses.py
[edit]
[-] generics.py
[edit]
[-] schema.py
[edit]
[-] type_adapter.py
[edit]
[-] datetime_parse.py
[edit]
[-] error_wrappers.py
[edit]
[+]
__pycache__
[-] fields.py
[edit]
[-] parse.py
[edit]
[-] tools.py
[edit]
[-] decorator.py
[edit]
[-] env_settings.py
[edit]
[-] errors.py
[edit]
[-] version.py
[edit]
[-] py.typed
[edit]
[-] _migration.py
[edit]
[+]
..
[-] class_validators.py
[edit]
[-] typing.py
[edit]
[-] json.py
[edit]
[-] alias_generators.py
[edit]
[-] types.py
[edit]
[-] functional_serializers.py
[edit]
[-] validators.py
[edit]
[-] json_schema.py
[edit]
[-] config.py
[edit]
[-] functional_validators.py
[edit]
[-] mypy.py
[edit]
[-] utils.py
[edit]
[-] annotated_handlers.py
[edit]
[-] __init__.py
[edit]
[-] root_model.py
[edit]
[-] networks.py
[edit]
[-] main.py
[edit]
[-] validate_call.py
[edit]
[+]
deprecated