Skip to content

Commit e538a90

Browse files
committed
Add pre-commit hook
1 parent a5d89ab commit e538a90

File tree

95 files changed

+4290
-2206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4290
-2206
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 19.3b0
4+
hooks:
5+
- id: black

patch_api/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from patch_api.exceptions import ApiValueError
3333
from patch_api.exceptions import ApiKeyError
3434
from patch_api.exceptions import ApiException
35+
3536
# import models into sdk package
3637
from patch_api.models.allocation import Allocation
3738
from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest
@@ -56,6 +57,9 @@
5657
from patch_api.models.order import Order
5758
from patch_api.models.order_list_response import OrderListResponse
5859
from patch_api.models.order_response import OrderResponse
60+
from patch_api.models.organization import Organization
61+
from patch_api.models.organization_list_response import OrganizationListResponse
62+
from patch_api.models.organization_response import OrganizationResponse
5963
from patch_api.models.photo import Photo
6064
from patch_api.models.photo_response import PhotoResponse
6165
from patch_api.models.preference import Preference
@@ -69,4 +73,3 @@
6973
from patch_api.models.standard_list_response import StandardListResponse
7074
from patch_api.models.update_offset_request import UpdateOffsetRequest
7175
from patch_api.models.update_project_request import UpdateProjectRequest
72-

patch_api/api/estimates_api.py

Lines changed: 106 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
import six
2020

2121
from patch_api.api_client import ApiClient
22-
from patch_api.exceptions import ( # noqa: F401
23-
ApiTypeError,
24-
ApiValueError
25-
)
22+
from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401
2623

2724

2825
class EstimatesApi(object):
@@ -37,7 +34,9 @@ def __init__(self, api_client=None):
3734
api_client = ApiClient()
3835
self.api_client = api_client
3936

40-
def create_mass_estimate(self, create_mass_estimate_request, **kwargs): # noqa: E501
37+
def create_mass_estimate(
38+
self, create_mass_estimate_request, **kwargs
39+
): # noqa: E501
4140
"""Create an estimate based on mass of CO2 # noqa: E501
4241
4342
Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501
@@ -59,10 +58,14 @@ def create_mass_estimate(self, create_mass_estimate_request, **kwargs): # noqa:
5958
If the method is called asynchronously,
6059
returns the request thread.
6160
"""
62-
kwargs['_return_http_data_only'] = True
63-
return self.create_mass_estimate_with_http_info(create_mass_estimate_request, **kwargs) # noqa: E501
64-
65-
def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kwargs): # noqa: E501
61+
kwargs["_return_http_data_only"] = True
62+
return self.create_mass_estimate_with_http_info(
63+
create_mass_estimate_request, **kwargs
64+
) # noqa: E501
65+
66+
def create_mass_estimate_with_http_info(
67+
self, create_mass_estimate_request, **kwargs
68+
): # noqa: E501
6669
"""Create an estimate based on mass of CO2 # noqa: E501
6770
6871
Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501
@@ -89,30 +92,32 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw
8992

9093
local_var_params = locals()
9194

92-
all_params = [
93-
'create_mass_estimate_request'
94-
]
95+
all_params = ["create_mass_estimate_request"]
9596
all_params.extend(
9697
[
97-
'async_req',
98-
'_return_http_data_only',
99-
'_preload_content',
100-
'_request_timeout'
98+
"async_req",
99+
"_return_http_data_only",
100+
"_preload_content",
101+
"_request_timeout",
101102
]
102103
)
103104

104-
for key, val in six.iteritems(local_var_params['kwargs']):
105+
for key, val in six.iteritems(local_var_params["kwargs"]):
105106
if key not in all_params:
106107
raise ApiTypeError(
107108
"Got an unexpected keyword argument '%s'"
108109
" to method create_mass_estimate" % key
109110
)
110111
local_var_params[key] = val
111-
del local_var_params['kwargs']
112+
del local_var_params["kwargs"]
112113
# verify the required parameter 'create_mass_estimate_request' is set
113-
if self.api_client.client_side_validation and ('create_mass_estimate_request' not in local_var_params or # noqa: E501
114-
local_var_params['create_mass_estimate_request'] is None): # noqa: E501
115-
raise ApiValueError("Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`") # noqa: E501
114+
if self.api_client.client_side_validation and (
115+
"create_mass_estimate_request" not in local_var_params
116+
or local_var_params["create_mass_estimate_request"] is None # noqa: E501
117+
): # noqa: E501
118+
raise ApiValueError(
119+
"Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`"
120+
) # noqa: E501
116121

117122
collection_formats = {}
118123

@@ -126,34 +131,42 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw
126131
local_var_files = {}
127132

128133
body_params = None
129-
if 'create_mass_estimate_request' in local_var_params:
130-
body_params = local_var_params['create_mass_estimate_request']
134+
if "create_mass_estimate_request" in local_var_params:
135+
body_params = local_var_params["create_mass_estimate_request"]
131136
# HTTP header `Accept`
132-
header_params['Accept'] = self.api_client.select_header_accept(
133-
['application/json']) # noqa: E501
137+
header_params["Accept"] = self.api_client.select_header_accept(
138+
["application/json"]
139+
) # noqa: E501
134140

135141
# HTTP header `Content-Type`
136-
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
137-
['application/json']) # noqa: E501
142+
header_params[
143+
"Content-Type"
144+
] = self.api_client.select_header_content_type( # noqa: E501
145+
["application/json"]
146+
) # noqa: E501
138147

139148
# Authentication setting
140-
auth_settings = ['bearer_auth'] # noqa: E501
149+
auth_settings = ["bearer_auth"] # noqa: E501
141150

142151
return self.api_client.call_api(
143-
'/v1/estimates/mass', 'POST',
152+
"/v1/estimates/mass",
153+
"POST",
144154
path_params,
145155
query_params,
146156
header_params,
147157
body=body_params,
148158
post_params=form_params,
149159
files=local_var_files,
150-
response_type='EstimateResponse', # noqa: E501
160+
response_type="EstimateResponse", # noqa: E501
151161
auth_settings=auth_settings,
152-
async_req=local_var_params.get('async_req'),
153-
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
154-
_preload_content=local_var_params.get('_preload_content', True),
155-
_request_timeout=local_var_params.get('_request_timeout'),
156-
collection_formats=collection_formats)
162+
async_req=local_var_params.get("async_req"),
163+
_return_http_data_only=local_var_params.get(
164+
"_return_http_data_only"
165+
), # noqa: E501
166+
_preload_content=local_var_params.get("_preload_content", True),
167+
_request_timeout=local_var_params.get("_request_timeout"),
168+
collection_formats=collection_formats,
169+
)
157170

158171
def retrieve_estimate(self, id, **kwargs): # noqa: E501
159172
"""Retrieves an estimate # noqa: E501
@@ -177,7 +190,7 @@ def retrieve_estimate(self, id, **kwargs): # noqa: E501
177190
If the method is called asynchronously,
178191
returns the request thread.
179192
"""
180-
kwargs['_return_http_data_only'] = True
193+
kwargs["_return_http_data_only"] = True
181194
return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501
182195

183196
def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
@@ -207,36 +220,37 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
207220

208221
local_var_params = locals()
209222

210-
all_params = [
211-
'id'
212-
]
223+
all_params = ["id"]
213224
all_params.extend(
214225
[
215-
'async_req',
216-
'_return_http_data_only',
217-
'_preload_content',
218-
'_request_timeout'
226+
"async_req",
227+
"_return_http_data_only",
228+
"_preload_content",
229+
"_request_timeout",
219230
]
220231
)
221232

222-
for key, val in six.iteritems(local_var_params['kwargs']):
233+
for key, val in six.iteritems(local_var_params["kwargs"]):
223234
if key not in all_params:
224235
raise ApiTypeError(
225236
"Got an unexpected keyword argument '%s'"
226237
" to method retrieve_estimate" % key
227238
)
228239
local_var_params[key] = val
229-
del local_var_params['kwargs']
240+
del local_var_params["kwargs"]
230241
# verify the required parameter 'id' is set
231-
if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501
232-
local_var_params['id'] is None): # noqa: E501
233-
raise ApiValueError("Missing the required parameter `id` when calling `retrieve_estimate`") # noqa: E501
242+
if self.api_client.client_side_validation and (
243+
"id" not in local_var_params or local_var_params["id"] is None # noqa: E501
244+
): # noqa: E501
245+
raise ApiValueError(
246+
"Missing the required parameter `id` when calling `retrieve_estimate`"
247+
) # noqa: E501
234248

235249
collection_formats = {}
236250

237251
path_params = {}
238-
if 'id' in local_var_params:
239-
path_params['id'] = local_var_params['id'] # noqa: E501
252+
if "id" in local_var_params:
253+
path_params["id"] = local_var_params["id"] # noqa: E501
240254

241255
query_params = []
242256

@@ -247,27 +261,32 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
247261

248262
body_params = None
249263
# HTTP header `Accept`
250-
header_params['Accept'] = self.api_client.select_header_accept(
251-
['application/json']) # noqa: E501
264+
header_params["Accept"] = self.api_client.select_header_accept(
265+
["application/json"]
266+
) # noqa: E501
252267

253268
# Authentication setting
254-
auth_settings = ['bearer_auth'] # noqa: E501
269+
auth_settings = ["bearer_auth"] # noqa: E501
255270

256271
return self.api_client.call_api(
257-
'/v1/estimates/{id}', 'GET',
272+
"/v1/estimates/{id}",
273+
"GET",
258274
path_params,
259275
query_params,
260276
header_params,
261277
body=body_params,
262278
post_params=form_params,
263279
files=local_var_files,
264-
response_type='EstimateResponse', # noqa: E501
280+
response_type="EstimateResponse", # noqa: E501
265281
auth_settings=auth_settings,
266-
async_req=local_var_params.get('async_req'),
267-
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
268-
_preload_content=local_var_params.get('_preload_content', True),
269-
_request_timeout=local_var_params.get('_request_timeout'),
270-
collection_formats=collection_formats)
282+
async_req=local_var_params.get("async_req"),
283+
_return_http_data_only=local_var_params.get(
284+
"_return_http_data_only"
285+
), # noqa: E501
286+
_preload_content=local_var_params.get("_preload_content", True),
287+
_request_timeout=local_var_params.get("_request_timeout"),
288+
collection_formats=collection_formats,
289+
)
271290

272291
def retrieve_estimates(self, **kwargs): # noqa: E501
273292
"""Retrieves a list of estimates # noqa: E501
@@ -291,7 +310,7 @@ def retrieve_estimates(self, **kwargs): # noqa: E501
291310
If the method is called asynchronously,
292311
returns the request thread.
293312
"""
294-
kwargs['_return_http_data_only'] = True
313+
kwargs["_return_http_data_only"] = True
295314
return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501
296315

297316
def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
@@ -321,34 +340,34 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
321340

322341
local_var_params = locals()
323342

324-
all_params = [
325-
'page'
326-
]
343+
all_params = ["page"]
327344
all_params.extend(
328345
[
329-
'async_req',
330-
'_return_http_data_only',
331-
'_preload_content',
332-
'_request_timeout'
346+
"async_req",
347+
"_return_http_data_only",
348+
"_preload_content",
349+
"_request_timeout",
333350
]
334351
)
335352

336-
for key, val in six.iteritems(local_var_params['kwargs']):
353+
for key, val in six.iteritems(local_var_params["kwargs"]):
337354
if key not in all_params:
338355
raise ApiTypeError(
339356
"Got an unexpected keyword argument '%s'"
340357
" to method retrieve_estimates" % key
341358
)
342359
local_var_params[key] = val
343-
del local_var_params['kwargs']
360+
del local_var_params["kwargs"]
344361

345362
collection_formats = {}
346363

347364
path_params = {}
348365

349366
query_params = []
350-
if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
351-
query_params.append(('page', local_var_params['page'])) # noqa: E501
367+
if (
368+
"page" in local_var_params and local_var_params["page"] is not None
369+
): # noqa: E501
370+
query_params.append(("page", local_var_params["page"])) # noqa: E501
352371

353372
header_params = {}
354373

@@ -357,24 +376,29 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
357376

358377
body_params = None
359378
# HTTP header `Accept`
360-
header_params['Accept'] = self.api_client.select_header_accept(
361-
['application/json']) # noqa: E501
379+
header_params["Accept"] = self.api_client.select_header_accept(
380+
["application/json"]
381+
) # noqa: E501
362382

363383
# Authentication setting
364-
auth_settings = ['bearer_auth'] # noqa: E501
384+
auth_settings = ["bearer_auth"] # noqa: E501
365385

366386
return self.api_client.call_api(
367-
'/v1/estimates', 'GET',
387+
"/v1/estimates",
388+
"GET",
368389
path_params,
369390
query_params,
370391
header_params,
371392
body=body_params,
372393
post_params=form_params,
373394
files=local_var_files,
374-
response_type='EstimateListResponse', # noqa: E501
395+
response_type="EstimateListResponse", # noqa: E501
375396
auth_settings=auth_settings,
376-
async_req=local_var_params.get('async_req'),
377-
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
378-
_preload_content=local_var_params.get('_preload_content', True),
379-
_request_timeout=local_var_params.get('_request_timeout'),
380-
collection_formats=collection_formats)
397+
async_req=local_var_params.get("async_req"),
398+
_return_http_data_only=local_var_params.get(
399+
"_return_http_data_only"
400+
), # noqa: E501
401+
_preload_content=local_var_params.get("_preload_content", True),
402+
_request_timeout=local_var_params.get("_request_timeout"),
403+
collection_formats=collection_formats,
404+
)

0 commit comments

Comments
 (0)