Skip to content

feat: support for python3.7 (async is a keyword)#8401

Merged
HugoMario merged 3 commits into
swagger-api:masterfrom
tomplus:feat/python37
Sep 26, 2018
Merged

feat: support for python3.7 (async is a keyword)#8401
HugoMario merged 3 commits into
swagger-api:masterfrom
tomplus:feat/python37

Conversation

@tomplus

@tomplus tomplus commented Jul 7, 2018

Copy link
Copy Markdown
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Fix: #8328

In Python 3.7 'async' is a reserved keyword. I replaced async wih async_req in function definitions.

PTAL: @kenjones-cisco

@HugoMario

Copy link
Copy Markdown
Contributor

cc @frantuma

@kenjones-cisco

Copy link
Copy Markdown
Contributor

LGTM!
Thanks @tomplus

@joshowen

Copy link
Copy Markdown

Anything I can help with to get this merged in? Thanks!

@xavierhardy

Copy link
Copy Markdown

Can you rebase on the master branch please?

def date(self, date):
"""Sets the date of this FormatTest.
@_date.setter
def _date(self, _date):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are trying to avoid a conflict with date, you should put the underscore at the end not at the beginning since it usually means that an argument/method is private (https://docs.python-guide.org/writing/style/#we-are-all-responsible-users). It is also recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xavierhardy it's not my change. It appears after regenerate this sample client.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/swagger-api/swagger-codegen/pull/7956/files < this introduced the change but without regenerating samples

raise ValueError("Invalid value for `_date`, must not be `None`") # noqa: E501

self._date = date
self.__date = _date

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the double underscore is really necessary here (nor anywhere else).

https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles
__double_leading_underscore: when naming a class attribute, invokes name mangling (inside class FooBar, __boo becomes _FooBar__boo; see below).

@PeaceInColour

Copy link
Copy Markdown

Is this PR still expected to be open for a while or will the merge happen soon?

@detonavomek-zz

Copy link
Copy Markdown

Had the same issue. Could you merge this PR?

@shelling

Copy link
Copy Markdown

LGTM. Hope it can be merged son

@HugoMario

Copy link
Copy Markdown
Contributor

thanks a lot !!!

@HugoMario HugoMario merged commit 1f93f09 into swagger-api:master Sep 26, 2018
@MrSaints

Copy link
Copy Markdown

Any ETA on a release that will include this fix?

@deansg

deansg commented Feb 16, 2020

Copy link
Copy Markdown

I think that since the name of this issue is "support for python 3.7", it should be noted that there are also other currently unsolved problems with upgrading the python version. The most major one I came across is the following issue related to util.py:
#8921

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 this pull request may close these issues.

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

10 participants