-
-
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-experimental] Quicken package loading (#6437)
* apis and models contains all apis and models, omits loading them in the package namespace * Runs git add -a and commits it * Fixes test_outer_enum.py * Fixes test_fruit.py * Updates test_fruit and test_mammal * Fixes test_parent_pet * Updates test_discard_unknown_properties.py * Updates test_deserialization.py * Updates v2 docs md files for apis + the readme * Fixes v2 tests * v2 doc updates * Updates v3 docs * Reverts python_doc_auth_partial.mustache * Adds sys to v3 tests * Adds FILES update Co-authored-by: Justin Black <justinblack@justins-air.lan>
- Loading branch information
Showing
363 changed files
with
2,503 additions
and
2,005 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
3 changes: 3 additions & 0 deletions
3
modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.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,3 @@ | ||
# do not import all apis into this module because that uses a lot of memory and stack frames | ||
# if you need the ability to import all models from one package, import them with | ||
# from {{packageName}.apis import DefaultApi, PetApi |
19 changes: 19 additions & 0 deletions
19
...les/openapi-generator/src/main/resources/python/python-experimental/__init__apis.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,19 @@ | ||
# coding: utf-8 | ||
|
||
# flake8: noqa | ||
|
||
# import all apis into this package | ||
# if you have many ampis here with many many models used in each api this may | ||
# raise a RecursionError | ||
# to avoid this, import only the api that you directly need like: | ||
# from {{packagename}}.api.pet_api import PetApi | ||
# or import this package, but before doing it, use: | ||
# import sys | ||
# sys.setrecursionlimit(n) | ||
|
||
# import apis into api package | ||
{{#apiInfo}} | ||
{{#apis}} | ||
from {{apiPackage}}.{{classVarName}} import {{classname}} | ||
{{/apis}} | ||
{{/apiInfo}} |
8 changes: 3 additions & 5 deletions
8
...es/openapi-generator/src/main/resources/python/python-experimental/__init__model.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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# coding: utf-8 | ||
|
||
# flake8: noqa | ||
{{>partial_header}} | ||
|
||
# we can not import model classes here because that would create a circular | ||
# reference which would not work in python2 | ||
# do not import all models into this module because that uses a lot of memory and stack frames | ||
# if you need the ability to import all models from one package, import them with | ||
# from {{packageName}.models import ModelA, ModelB |
18 changes: 18 additions & 0 deletions
18
...s/openapi-generator/src/main/resources/python/python-experimental/__init__models.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,18 @@ | ||
# coding: utf-8 | ||
|
||
# flake8: noqa | ||
|
||
# import all models into this package | ||
# if you have many models here with many references from one model to another this may | ||
# raise a RecursionError | ||
# to avoid this, import only the models that you directly need like: | ||
# from from {{modelPackage}}.pet import Pet | ||
# or import this package, but before doing it, use: | ||
# import sys | ||
# sys.setrecursionlimit(n) | ||
|
||
{{#models}} | ||
{{#model}} | ||
from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} | ||
{{/model}} | ||
{{/models}} |
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
36 changes: 36 additions & 0 deletions
36
modules/openapi-generator/src/main/resources/python/python-experimental/api_test.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,36 @@ | ||
# coding: utf-8 | ||
|
||
{{>partial_header}} | ||
|
||
from __future__ import absolute_import | ||
|
||
import unittest | ||
|
||
import {{packageName}} | ||
from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 | ||
|
||
|
||
class {{#operations}}Test{{classname}}(unittest.TestCase): | ||
"""{{classname}} unit test stubs""" | ||
|
||
def setUp(self): | ||
self.api = {{classname}}() # noqa: E501 | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
{{#operation}} | ||
def test_{{operationId}}(self): | ||
"""Test case for {{{operationId}}} | ||
|
||
{{#summary}} | ||
{{{summary}}} # noqa: E501 | ||
{{/summary}} | ||
""" | ||
pass | ||
|
||
{{/operation}} | ||
{{/operations}} | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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.