type_bridge.generator.naming¶
naming
¶
Naming convention utilities for code generation.
Handles conversion between TypeDB naming conventions (kebab-case) and Python conventions (PascalCase for classes, snake_case for identifiers).
to_class_name
¶
Convert a TypeDB name to PascalCase for Python classes.
Handles both kebab-case and snake_case inputs.
Examples:
"person" -> "Person" "isbn-13" -> "Isbn13" "user_story" -> "UserStory" "order-line" -> "OrderLine"
Source code in type_bridge/generator/naming.py
to_python_name
¶
Convert a TypeDB name to snake_case for Python identifiers.
Examples:
"person" -> "person" "isbn-13" -> "isbn_13" "order-line" -> "order_line" "birth-date" -> "birth_date"
Source code in type_bridge/generator/naming.py
build_class_name_map
¶
Build a mapping from TypeDB names to Python class names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
Mapping[str, object]
|
Mapping with TypeDB names as keys (values ignored) |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Dict mapping TypeDB name -> Python class name |
Source code in type_bridge/generator/naming.py
render_all_export
¶
Generate all export list lines for a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
list[str]
|
List of names to export (will be sorted) |
required |
extras
|
list[str] | None
|
Optional additional names to export |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Lines for the all block including trailing newline |