forked from loafle/openapi-generator-original
[python-client] Modify python templates to resolve linting errors (#6839)
The linting results for the generated samples are as follows where the first number is the BEFORE and the second is AFTER. pyclient 7714 vs. 120 pyclient3 7717 vs. 120 pyclient3-asyncio 7584 vs. 120 pyclient-tornado 7633 vs. 120 pyclient3-tornado 7633 vs. 120 For the complete details please see the following gist. https://gist.github.com/kenjones-cisco/2eb69a7e8db75e9fd53789f01570d9f2 Enforces linting for python clients by running flake8 for the generated python client.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**map_property** | **dict(str, str)** | | [optional]
|
||||
**map_of_map_property** | [**dict(str, dict(str, str))**](dict.md) | | [optional]
|
||||
**map_of_map_property** | **dict(str, dict(str, str))** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ To test special tags
|
||||
|
||||
To test special tags
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -26,7 +26,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.AnotherFakeApi()
|
||||
body = petstore_api.Client() # Client | client model
|
||||
|
||||
try:
|
||||
try:
|
||||
# To test special tags
|
||||
api_response = api_instance.test_special_tags(body)
|
||||
pprint(api_response)
|
||||
|
||||
@@ -22,7 +22,7 @@ Method | HTTP request | Description
|
||||
|
||||
Test serialization of outer boolean types
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -34,7 +34,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
body = petstore_api.OuterBoolean() # OuterBoolean | Input boolean as post body (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
@@ -69,7 +69,7 @@ No authorization required
|
||||
|
||||
Test serialization of object with outer number type
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -81,7 +81,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
@@ -116,7 +116,7 @@ No authorization required
|
||||
|
||||
Test serialization of outer number types
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -128,7 +128,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
body = petstore_api.OuterNumber() # OuterNumber | Input number as post body (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
@@ -163,7 +163,7 @@ No authorization required
|
||||
|
||||
Test serialization of outer string types
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -175,7 +175,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
body = petstore_api.OuterString() # OuterString | Input string as post body (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
@@ -210,7 +210,7 @@ To test \"client\" model
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -222,7 +222,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
body = petstore_api.Client() # Client | client model
|
||||
|
||||
try:
|
||||
try:
|
||||
# To test \"client\" model
|
||||
api_response = api_instance.test_client_model(body)
|
||||
pprint(api_response)
|
||||
@@ -258,7 +258,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -288,7 +288,7 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
||||
password = 'password_example' # str | None (optional)
|
||||
param_callback = 'param_callback_example' # str | None (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||
except ApiException as e:
|
||||
@@ -336,7 +336,7 @@ To test enum parameters
|
||||
|
||||
To test enum parameters
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -355,7 +355,7 @@ enum_query_string = '-efg' # str | Query parameter enum test (string) (optional)
|
||||
enum_query_integer = 56 # int | Query parameter enum test (double) (optional)
|
||||
enum_query_double = 1.2 # float | Query parameter enum test (double) (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
# To test enum parameters
|
||||
api_instance.test_enum_parameters(enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string, enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double)
|
||||
except ApiException as e:
|
||||
@@ -397,7 +397,7 @@ test inline additionalProperties
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -409,7 +409,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.FakeApi()
|
||||
param = NULL # object | request body
|
||||
|
||||
try:
|
||||
try:
|
||||
# test inline additionalProperties
|
||||
api_instance.test_inline_additional_properties(param)
|
||||
except ApiException as e:
|
||||
@@ -444,7 +444,7 @@ test json serialization of form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -457,7 +457,7 @@ api_instance = petstore_api.FakeApi()
|
||||
param = 'param_example' # str | field1
|
||||
param2 = 'param2_example' # str | field2
|
||||
|
||||
try:
|
||||
try:
|
||||
# test json serialization of form data
|
||||
api_instance.test_json_form_data(param, param2)
|
||||
except ApiException as e:
|
||||
|
||||
@@ -12,7 +12,7 @@ Method | HTTP request | Description
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -30,7 +30,7 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
||||
body = petstore_api.Client() # Client | client model
|
||||
|
||||
try:
|
||||
try:
|
||||
# To test class name in snake case
|
||||
api_response = api_instance.test_classname(body)
|
||||
pprint(api_response)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**map_map_of_string** | [**dict(str, dict(str, str))**](dict.md) | | [optional]
|
||||
**map_map_of_string** | **dict(str, dict(str, str))** | | [optional]
|
||||
**map_of_enum_string** | **dict(str, str)** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
@@ -21,7 +21,7 @@ Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -37,7 +37,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||
|
||||
try:
|
||||
try:
|
||||
# Add a new pet to the store
|
||||
api_instance.add_pet(body)
|
||||
except ApiException as e:
|
||||
@@ -72,7 +72,7 @@ Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -89,7 +89,7 @@ api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
pet_id = 789 # int | Pet id to delete
|
||||
api_key = 'api_key_example' # str | (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
# Deletes a pet
|
||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||
except ApiException as e:
|
||||
@@ -125,7 +125,7 @@ Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -141,7 +141,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
||||
|
||||
try:
|
||||
try:
|
||||
# Finds Pets by status
|
||||
api_response = api_instance.find_pets_by_status(status)
|
||||
pprint(api_response)
|
||||
@@ -177,7 +177,7 @@ Finds Pets by tags
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -193,7 +193,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
tags = ['tags_example'] # list[str] | Tags to filter by
|
||||
|
||||
try:
|
||||
try:
|
||||
# Finds Pets by tags
|
||||
api_response = api_instance.find_pets_by_tags(tags)
|
||||
pprint(api_response)
|
||||
@@ -229,7 +229,7 @@ Find pet by ID
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -247,7 +247,7 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
pet_id = 789 # int | ID of pet to return
|
||||
|
||||
try:
|
||||
try:
|
||||
# Find pet by ID
|
||||
api_response = api_instance.get_pet_by_id(pet_id)
|
||||
pprint(api_response)
|
||||
@@ -283,7 +283,7 @@ Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -299,7 +299,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||
|
||||
try:
|
||||
try:
|
||||
# Update an existing pet
|
||||
api_instance.update_pet(body)
|
||||
except ApiException as e:
|
||||
@@ -334,7 +334,7 @@ Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -352,7 +352,7 @@ pet_id = 789 # int | ID of pet that needs to be updated
|
||||
name = 'name_example' # str | Updated name of the pet (optional)
|
||||
status = 'status_example' # str | Updated status of the pet (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
# Updates a pet in the store with form data
|
||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||
except ApiException as e:
|
||||
@@ -389,7 +389,7 @@ uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -407,7 +407,7 @@ pet_id = 789 # int | ID of pet to update
|
||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||
file = '/path/to/file.txt' # file | file to upload (optional)
|
||||
|
||||
try:
|
||||
try:
|
||||
# uploads an image
|
||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||
pprint(api_response)
|
||||
|
||||
@@ -17,7 +17,7 @@ Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -29,7 +29,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.StoreApi()
|
||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||
|
||||
try:
|
||||
try:
|
||||
# Delete purchase order by ID
|
||||
api_instance.delete_order(order_id)
|
||||
except ApiException as e:
|
||||
@@ -64,7 +64,7 @@ Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -81,7 +81,7 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
||||
|
||||
try:
|
||||
try:
|
||||
# Returns pet inventories by status
|
||||
api_response = api_instance.get_inventory()
|
||||
pprint(api_response)
|
||||
@@ -114,7 +114,7 @@ Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -126,7 +126,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.StoreApi()
|
||||
order_id = 789 # int | ID of pet that needs to be fetched
|
||||
|
||||
try:
|
||||
try:
|
||||
# Find purchase order by ID
|
||||
api_response = api_instance.get_order_by_id(order_id)
|
||||
pprint(api_response)
|
||||
@@ -162,7 +162,7 @@ Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -174,7 +174,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.StoreApi()
|
||||
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
||||
|
||||
try:
|
||||
try:
|
||||
# Place an order for a pet
|
||||
api_response = api_instance.place_order(body)
|
||||
pprint(api_response)
|
||||
|
||||
@@ -21,7 +21,7 @@ Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -33,7 +33,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = petstore_api.User() # User | Created user object
|
||||
|
||||
try:
|
||||
try:
|
||||
# Create user
|
||||
api_instance.create_user(body)
|
||||
except ApiException as e:
|
||||
@@ -68,7 +68,7 @@ Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -80,7 +80,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_array_input(body)
|
||||
except ApiException as e:
|
||||
@@ -115,7 +115,7 @@ Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -127,7 +127,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.UserApi()
|
||||
body = [petstore_api.User()] # list[User] | List of user object
|
||||
|
||||
try:
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_list_input(body)
|
||||
except ApiException as e:
|
||||
@@ -162,7 +162,7 @@ Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -174,7 +174,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.UserApi()
|
||||
username = 'username_example' # str | The name that needs to be deleted
|
||||
|
||||
try:
|
||||
try:
|
||||
# Delete user
|
||||
api_instance.delete_user(username)
|
||||
except ApiException as e:
|
||||
@@ -209,7 +209,7 @@ Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -221,7 +221,7 @@ from pprint import pprint
|
||||
api_instance = petstore_api.UserApi()
|
||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try:
|
||||
try:
|
||||
# Get user by user name
|
||||
api_response = api_instance.get_user_by_name(username)
|
||||
pprint(api_response)
|
||||
@@ -257,7 +257,7 @@ Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -270,7 +270,7 @@ api_instance = petstore_api.UserApi()
|
||||
username = 'username_example' # str | The user name for login
|
||||
password = 'password_example' # str | The password for login in clear text
|
||||
|
||||
try:
|
||||
try:
|
||||
# Logs user into the system
|
||||
api_response = api_instance.login_user(username, password)
|
||||
pprint(api_response)
|
||||
@@ -307,7 +307,7 @@ Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -318,7 +318,7 @@ from pprint import pprint
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.UserApi()
|
||||
|
||||
try:
|
||||
try:
|
||||
# Logs out current logged in user session
|
||||
api_instance.logout_user()
|
||||
except ApiException as e:
|
||||
@@ -350,7 +350,7 @@ Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```python
|
||||
from __future__ import print_function
|
||||
import time
|
||||
@@ -363,7 +363,7 @@ api_instance = petstore_api.UserApi()
|
||||
username = 'username_example' # str | name that need to be deleted
|
||||
body = petstore_api.User() # User | Updated user object
|
||||
|
||||
try:
|
||||
try:
|
||||
# Updated user
|
||||
api_instance.update_user(username, body)
|
||||
except ApiException as e:
|
||||
|
||||
Reference in New Issue
Block a user