Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] "async" is now a reserved keyword in Python 3.7 #8328

Closed
ghost opened this issue Jun 18, 2018 · 4 comments · Fixed by #8401
Closed

[Python] "async" is now a reserved keyword in Python 3.7 #8328

ghost opened this issue Jun 18, 2018 · 4 comments · Fixed by #8401

Comments

@ghost
Copy link

ghost commented Jun 18, 2018

Description

"async" is now a reserved keyword in Python 3.7.

"async" is used as variable and argument name multiple time in swagger-codegen Python client.

This make the client non working on Python 3.7 (Raises SyntaxError).

Swagger-codegen version

2.3.1

Swagger declaration file content or url

https://github.com/Accelize/apyfal/blob/master/rest_api/input_spec.json

Command line used for generation

java -jar swagger-codegen-cli-2.3.1.jar generate -i input_spec.json -o output -l python"

Steps to reproduce

Import generated client in Python 3.7.

Related issues/PRs

None found.

Suggest a fix/enhancement

Replace "async" variable/argument name use by anything else.

@austindrenski
Copy link

@ehlertjd Was this closed via #1345?

@ehlertjd
Copy link

@austindrenski Nope! I'm using a copy of the swagger templates and updated them in my copy. I just referenced this issue for posterity.

@gkatzioura
Copy link

gkatzioura commented Aug 23, 2018

A workaround for those with this issue using sed

find path/ -type f -exec sed -i 's/async=params.get/is_async=params.get/g' {} +
find path/ -type f -exec sed -i 's/async=None/is_async=None/g' {} +
find path/ -type f -exec sed -i 's/if not async/if not is_async/g' {} +

@xavierhardy
Copy link

You should use snake_case (PEP8: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names). I'd rather use async_ or is_async, but that does not really matter.

There already is a pull request on that topic: #8401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants