We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c2138d8 commit 6bf6d07Copy full SHA for 6bf6d07
1 file changed
src/replit_river/codegen/typing.py
@@ -1,3 +1,4 @@
1
+import keyword
2
from dataclasses import dataclass
3
from typing import NewType, assert_never, cast
4
@@ -165,7 +166,11 @@ def work(
165
166
def normalize_special_chars(value: str) -> str:
167
for char in SPECIAL_CHARS:
168
value = value.replace(char, "_")
- return value.lstrip("_")
169
+ value = value.lstrip("_")
170
+ # Append underscore to Python keywords (e.g., "from" -> "from_")
171
+ if keyword.iskeyword(value):
172
+ value = value + "_"
173
+ return value
174
175
176
def render_type_expr(value: TypeExpression) -> str:
0 commit comments