-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[python-server] Support python 3.7 for all server-generators (#2884)
* Support python 3.7 for all server-generators Signed-off-by: Guillaume Smaha <[email protected]> * Rename typing_patch.py to typing_utils.py * Renaming typing_patch.mustache to typing_utils.mustache * Fix comparaison in typing_utils.is_dict for python3.7
- Loading branch information
1 parent
1411880
commit 20b8eff
Showing
31 changed files
with
377 additions
and
59 deletions.
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_utils.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__ == dict | ||
|
||
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_utils.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__ == dict | ||
|
||
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_utils.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__ == dict | ||
|
||
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_utils.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__ == dict | ||
|
||
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.