Format nodes display name to a standard format
(
description: str, class_name: str, experimental: bool, deprecated: bool
)
| 121 | |
| 122 | |
| 123 | def _format_description( |
| 124 | description: str, class_name: str, experimental: bool, deprecated: bool |
| 125 | ) -> str: |
| 126 | """Format nodes display name to a standard format""" |
| 127 | |
| 128 | # If description is not provided, auto-generate one based on the class name |
| 129 | if description is None: |
| 130 | description = camel_case_to_spaces(class_name) |
| 131 | |
| 132 | # Strip the prefix if it's already there |
| 133 | prefix_len = len(NODES_DISPLAY_NAME_PREFIX) |
| 134 | if description.startswith(NODES_DISPLAY_NAME_PREFIX): |
| 135 | description = description[prefix_len:].lstrip() |
| 136 | |
| 137 | # Add the deprecated / experimental prefixes |
| 138 | if deprecated: |
| 139 | description = f"{DEPRECATED_DISPLAY_NAME_PREFIX} {description}" |
| 140 | elif experimental: |
| 141 | description = f"{EXPERIMENTAL_DISPLAY_NAME_PREFIX} {description}" |
| 142 | |
| 143 | # Add the prefix |
| 144 | description = f"{NODES_DISPLAY_NAME_PREFIX} {description}" |
| 145 | |
| 146 | return description |
| 147 | |
| 148 | |
| 149 | def camel_case_to_spaces(text: str) -> str: |
no test coverage detected