-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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-server] Support python 3.5+ for all server-generators #2884
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
49cf292
Support python 3.7 for all server-generators
GuillaumeSmaha cbc4058
Rename typing_patch.py to typing_utils.py
GuillaumeSmaha 82dcb4e
Renaming typing_patch.mustache to typing_utils.mustache
GuillaumeSmaha b232d61
Fix comparaison in typing_utils.is_dict for python3.7
GuillaumeSmaha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
modules/openapi-generator/src/main/resources/python-aiohttp/typing_patch.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding: utf-8 | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 7): | ||
import typing | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return type(klass) == typing.GenericMeta | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__extra__ == dict | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__extra__ == list | ||
|
||
else: | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return hasattr(klass, '__origin__') | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__origin__ == list | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__origin__ == list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...-generator/src/main/resources/python-blueplanet/app/{{packageName}}/typing_patch.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding: utf-8 | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 7): | ||
import typing | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return type(klass) == typing.GenericMeta | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__extra__ == dict | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__extra__ == list | ||
|
||
else: | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return hasattr(klass, '__origin__') | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__origin__ == list | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__origin__ == list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
modules/openapi-generator/src/main/resources/python-flask/typing_patch.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding: utf-8 | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 7): | ||
import typing | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return type(klass) == typing.GenericMeta | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__extra__ == dict | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__extra__ == list | ||
|
||
else: | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return hasattr(klass, '__origin__') | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__origin__ == list | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__origin__ == list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/server/openapi3/petstore/python-flask-python2/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.0.0-SNAPSHOT | ||
4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
samples/server/openapi3/petstore/python-flask-python2/openapi_server/typing_patch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding: utf-8 | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 7): | ||
import typing | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return type(klass) == typing.GenericMeta | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__extra__ == dict | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__extra__ == list | ||
|
||
else: | ||
|
||
def is_generic(klass): | ||
""" Determine whether klass is a generic class """ | ||
return hasattr(klass, '__origin__') | ||
|
||
def is_dict(klass): | ||
""" Determine whether klass is a Dict """ | ||
return klass.__origin__ == list | ||
|
||
def is_list(klass): | ||
""" Determine whether klass is a List """ | ||
return klass.__origin__ == list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/server/openapi3/petstore/python-flask/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.0.0-SNAPSHOT | ||
4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: what about naming it as
typing_utils.py
instead?Patch sounds like the code is more like a workaround and not production ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's is better with
typing_utils.py