Skip to content

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

Closed

Description

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.

Activity

  1. austindrenski commented on Aug 20, 2018

    @austindrenski

    @ehlertjd Was this closed via #1345?

  2. ehlertjd commented on Aug 20, 2018

    @ehlertjd

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

  3. gkatzioura commented on Aug 23, 2018

    @gkatzioura

    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' {} +

  4. xavierhardy commented on Aug 25, 2018

    @xavierhardy

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions