Skip to content

Commit 67e3bf5

Browse files
authored
Fixes kwargs typos, removes E501s (#5552)
1 parent 2001119 commit 67e3bf5

File tree

26 files changed

+1862
-788
lines changed

26 files changed

+1862
-788
lines changed

modules/openapi-generator/src/main/resources/python/api.mustache

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import re # noqa: F401
1010
import six
1111

1212
from {{packageName}}.api_client import ApiClient
13-
from {{packageName}}.exceptions import (
13+
from {{packageName}}.exceptions import ( # noqa: F401
1414
ApiTypeError,
1515
ApiValueError
1616
)
@@ -99,20 +99,36 @@ class {{classname}}(object):
9999
"""
100100

101101
{{#servers.0}}
102-
local_var_hosts = [{{#servers}}'{{{url}}}'{{^-last}}, {{/-last}}{{/servers}}] # noqa: E501
102+
local_var_hosts = [
103+
{{#servers}}
104+
'{{{url}}}'{{^-last}},{{/-last}}
105+
{{/servers}}
106+
]
103107
local_var_host = local_var_hosts[0]
104108
if kwargs.get('_host_index'):
105-
if int(kwags.get('_host_index')) < 0 or int(kawgs.get('_host_index')) >= len(local_var_hosts):
106-
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
107-
local_var_host = local_var_hosts[int(kwargs.get('_host_index'))]
109+
_host_index = int(kwargs.get('_host_index'))
110+
if _host_index < 0 or _host_index >= len(local_var_hosts):
111+
raise ApiValueError(
112+
"Invalid host index. Must be 0 <= index < %s"
113+
% len(local_var_host)
114+
)
115+
local_var_host = local_var_hosts[_host_index]
108116
{{/servers.0}}
109117
local_var_params = locals()
110118

111-
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
112-
all_params.append('async_req')
113-
all_params.append('_return_http_data_only')
114-
all_params.append('_preload_content')
115-
all_params.append('_request_timeout')
119+
all_params = [
120+
{{#allParams}}
121+
'{{paramName}}'{{#hasMore}},{{/hasMore}}
122+
{{/allParams}}
123+
]
124+
all_params.extend(
125+
[
126+
'async_req',
127+
'_return_http_data_only',
128+
'_preload_content',
129+
'_request_timeout'
130+
]
131+
)
116132

117133
for key, val in six.iteritems(local_var_params['kwargs']):
118134
if key not in all_params{{#servers.0}} and key != "_host_index"{{/servers.0}}:

samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919

2020
from petstore_api.api_client import ApiClient
21-
from petstore_api.exceptions import (
21+
from petstore_api.exceptions import ( # noqa: F401
2222
ApiTypeError,
2323
ApiValueError
2424
)
@@ -88,11 +88,17 @@ def call_123_test_special_tags_with_http_info(self, body, **kwargs): # noqa: E5
8888

8989
local_var_params = locals()
9090

91-
all_params = ['body'] # noqa: E501
92-
all_params.append('async_req')
93-
all_params.append('_return_http_data_only')
94-
all_params.append('_preload_content')
95-
all_params.append('_request_timeout')
91+
all_params = [
92+
'body'
93+
]
94+
all_params.extend(
95+
[
96+
'async_req',
97+
'_return_http_data_only',
98+
'_preload_content',
99+
'_request_timeout'
100+
]
101+
)
96102

97103
for key, val in six.iteritems(local_var_params['kwargs']):
98104
if key not in all_params:

0 commit comments

Comments
 (0)