MCPcopy Index your code
hub / github.com/feast-dev/feast / _make_var_name

Function _make_var_name

sdk/python/feast/dbt/codegen.py:160–167  ·  view source on GitHub ↗

Convert a name to a valid Python variable name.

(name: str)

Source from the content-addressed store, hash-verified

158
159
160def _make_var_name(name: str) -> str:
161 """Convert a name to a valid Python variable name."""
162 # Replace hyphens and spaces with underscores
163 var_name = name.replace("-", "_").replace(" ", "_")
164 # Ensure it starts with a letter or underscore
165 if var_name and var_name[0].isdigit():
166 var_name = f"_{var_name}"
167 return var_name
168
169
170def _escape_description(desc: Optional[str]) -> str:

Callers 6

test_hyphens_replacedMethod · 0.90
test_spaces_replacedMethod · 0.90
test_combinedMethod · 0.90
test_already_validMethod · 0.90
generateMethod · 0.85

Calls

no outgoing calls

Tested by 5

test_hyphens_replacedMethod · 0.72
test_spaces_replacedMethod · 0.72
test_combinedMethod · 0.72
test_already_validMethod · 0.72