python: simplify module imports (#17507)

In #16624, I introduced a new mechanism to record imports to other
modules, instead of having specialized datetime/typing/pydantic objects
to manage imports for these modules.

This change reuses the mechanism from #16624 and replace the specialized
import managers by the generic one. Unused imports from various
.mustache templates are also cleaned up.
This commit is contained in:
Jonathan Ballet
2024-01-03 14:22:53 +01:00
committed by GitHub
parent dffb5c121f
commit 063865973d
266 changed files with 356 additions and 1335 deletions

View File

@@ -18,8 +18,6 @@ To test special tags and operation ID starting with number
```python
import time
import os
import petstore_api
from petstore_api.models.client import Client
from petstore_api.rest import ApiException

View File

@@ -16,8 +16,6 @@ Method | HTTP request | Description
```python
import time
import os
import petstore_api
from petstore_api.models.foo_get_default_response import FooGetDefaultResponse
from petstore_api.rest import ApiException

View File

@@ -40,8 +40,6 @@ test any type request body
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -105,8 +103,6 @@ test enum reference query parameter
```python
import time
import os
import petstore_api
from petstore_api.models.enum_class import EnumClass
from petstore_api.rest import ApiException
@@ -171,8 +167,6 @@ Health check endpoint
```python
import time
import os
import petstore_api
from petstore_api.models.health_check_result import HealthCheckResult
from petstore_api.rest import ApiException
@@ -235,8 +229,6 @@ test http signature authentication
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -374,8 +366,6 @@ Test serialization of outer boolean types
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -442,8 +432,6 @@ Test serialization of object with outer number type
```python
import time
import os
import petstore_api
from petstore_api.models.outer_composite import OuterComposite
from petstore_api.rest import ApiException
@@ -511,8 +499,6 @@ Test serialization of outer number types
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -579,8 +565,6 @@ Test serialization of outer string types
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -647,8 +631,6 @@ Test serialization of enum (int) properties with examples
```python
import time
import os
import petstore_api
from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty
from petstore_api.rest import ApiException
@@ -714,8 +696,6 @@ test ref to enum string
```python
import time
import os
import petstore_api
from petstore_api.models.enum_class import EnumClass
from petstore_api.rest import ApiException
@@ -778,8 +758,6 @@ test returning list of objects
```python
import time
import os
import petstore_api
from petstore_api.models.tag import Tag
from petstore_api.rest import ApiException
@@ -842,8 +820,6 @@ test uuid example
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -909,8 +885,6 @@ For this test, the body has to be a binary file.
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -975,8 +949,6 @@ For this test, the body for this request must reference a schema named `File`.
```python
import time
import os
import petstore_api
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
from petstore_api.rest import ApiException
@@ -1040,8 +1012,6 @@ No authorization required
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException
@@ -1109,8 +1079,6 @@ To test \"client\" model
```python
import time
import os
import petstore_api
from petstore_api.models.client import Client
from petstore_api.rest import ApiException
@@ -1177,8 +1145,6 @@ No authorization required
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1245,8 +1211,6 @@ test empty and non-empty responses
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1310,8 +1274,6 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
* Basic Authentication (http_basic_test):
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1414,8 +1376,6 @@ test error responses with model
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1480,8 +1440,6 @@ Fake endpoint to test group parameters (optional)
* Bearer (JWT) Authentication (bearer_test):
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1566,8 +1524,6 @@ test inline additionalProperties
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1633,8 +1589,6 @@ test inline free-form additionalProperties
```python
import time
import os
import petstore_api
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
from petstore_api.rest import ApiException
@@ -1701,8 +1655,6 @@ test json serialization of form data
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -1770,8 +1722,6 @@ To test the collection format in query parameters
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint

View File

@@ -19,8 +19,6 @@ To test class name in snake case
* Api Key Authentication (api_key_query):
```python
import time
import os
import petstore_api
from petstore_api.models.client import Client
from petstore_api.rest import ApiException

View File

@@ -27,8 +27,6 @@ Add a new pet to the store
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -166,8 +164,6 @@ Deletes a pet
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -243,8 +239,6 @@ Multiple status values can be provided with comma separated strings
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -384,8 +378,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -525,8 +517,6 @@ Returns a single pet
* Api Key Authentication (api_key):
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -608,8 +598,6 @@ Update an existing pet
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.pet import Pet
from petstore_api.rest import ApiException
@@ -749,8 +737,6 @@ Updates a pet in the store with form data
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -828,8 +814,6 @@ uploads an image
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.api_response import ApiResponse
from petstore_api.rest import ApiException
@@ -909,8 +893,6 @@ uploads an image (required)
* OAuth Authentication (petstore_auth):
```python
import time
import os
import petstore_api
from petstore_api.models.api_response import ApiResponse
from petstore_api.rest import ApiException

View File

@@ -21,8 +21,6 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -90,8 +88,6 @@ Returns a map of status codes to quantities
* Api Key Authentication (api_key):
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -165,8 +161,6 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
```python
import time
import os
import petstore_api
from petstore_api.models.order import Order
from petstore_api.rest import ApiException
@@ -237,8 +231,6 @@ Place an order for a pet
```python
import time
import os
import petstore_api
from petstore_api.models.order import Order
from petstore_api.rest import ApiException

View File

@@ -25,8 +25,6 @@ This can only be done by the logged in user.
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException
@@ -93,8 +91,6 @@ Creates list of users with given input array
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException
@@ -161,8 +157,6 @@ Creates list of users with given input array
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException
@@ -229,8 +223,6 @@ This can only be done by the logged in user.
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -297,8 +289,6 @@ Get user by user name
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException
@@ -369,8 +359,6 @@ Logs user into the system
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -441,8 +429,6 @@ Logs out current logged in user session
```python
import time
import os
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
@@ -504,8 +490,6 @@ This can only be done by the logged in user.
```python
import time
import os
import petstore_api
from petstore_api.models.user import User
from petstore_api.rest import ApiException