Skip to content

Commit a95fa64

Browse files
committed
fix: Prevent generating Python files named the same as reserved / key words.
1 parent 8b2849d commit a95fa64

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

openapi_python_client/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .config import Config
1818
from .parser import GeneratorData, import_string_from_class
1919
from .parser.errors import GeneratorError
20-
from .utils import snake_case
2120

2221
if sys.version_info.minor < 8: # version did not exist before 3.8, need to use a backport
2322
from importlib_metadata import version
@@ -270,7 +269,7 @@ def _build_api(self) -> None:
270269
)
271270

272271
for endpoint in collection.endpoints:
273-
module_path = tag_dir / f"{snake_case(endpoint.name)}.py"
272+
module_path = tag_dir / f"{utils.PythonIdentifier(endpoint.name, self.config.field_prefix)}.py"
274273
module_path.write_text(endpoint_template.render(endpoint=endpoint), encoding=self.file_encoding)
275274

276275

0 commit comments

Comments
 (0)