Blacken openstackclient.api · openstack/python-openstackclient@a6f81a7 · GitHub
Skip to content

Commit a6f81a7

Browse files
committed
Blacken openstackclient.api
Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I1df5bc4c35f02147fe5ac5b4073f0e01e7d51c2f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 7d80f9e commit a6f81a7

10 files changed

Lines changed: 113 additions & 162 deletions

File tree

openstackclient/api/api.py

Lines changed: 9 additions & 48 deletions

openstackclient/api/compute_v2.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# TODO(dtroyer): Mingrate this to osc-lib
2323
class InvalidValue(Exception):
2424
"""An argument value is not valid: wrong type, out of range, etc"""
25+
2526
message = "Supplied value is not valid"
2627

2728

@@ -291,11 +292,7 @@ def host_list(
291292
return self.list(url)["hosts"]
292293

293294
def host_set(
294-
self,
295-
host=None,
296-
status=None,
297-
maintenance_mode=None,
298-
**params
295+
self, host=None, status=None, maintenance_mode=None, **params
299296
):
300297
"""Modify host properties
301298
@@ -576,7 +573,7 @@ def security_group_set(
576573
value=security_group,
577574
)
578575
if security_group is not None:
579-
for (k, v) in params.items():
576+
for k, v in params.items():
580577
# Only set a value if it is already present
581578
if k in security_group:
582579
security_group[k] = v

openstackclient/api/image_v1.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ def _munge_url(self):
3333
self.endpoint = self.endpoint + self._endpoint_suffix
3434

3535
def image_list(
36-
self,
37-
detailed=False,
38-
public=False,
39-
private=False,
40-
**filter
36+
self, detailed=False, public=False, private=False, **filter
4137
):
4238
"""Get available images
4339

openstackclient/api/object_store_v1.py

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ def __init__(self, **kwargs):
3636
super(APIv1, self).__init__(**kwargs)
3737

3838
def container_create(
39-
self,
40-
container=None,
41-
public=False,
42-
storage_policy=None
39+
self, container=None, public=False, storage_policy=None
4340
):
4441
"""Create a container
4542
@@ -62,7 +59,8 @@ def container_create(
6259
headers['x-storage-policy'] = storage_policy
6360

6461
response = self.create(
65-
urllib.parse.quote(container), method='PUT', headers=headers)
62+
urllib.parse.quote(container), method='PUT', headers=headers
63+
)
6664

6765
data = {
6866
'account': self._find_account_id(),
@@ -192,9 +190,7 @@ def container_show(
192190
data = {
193191
'account': self._find_account_id(),
194192
'container': container,
195-
'object_count': response.headers.get(
196-
'x-container-object-count'
197-
),
193+
'object_count': response.headers.get('x-container-object-count'),
198194
'bytes_used': response.headers.get('x-container-bytes-used'),
199195
'storage_policy': response.headers.get('x-storage-policy'),
200196
}
@@ -208,8 +204,9 @@ def container_show(
208204
if 'x-container-sync-key' in response.headers:
209205
data['sync_key'] = response.headers.get('x-container-sync-key')
210206

211-
properties = self._get_properties(response.headers,
212-
'x-container-meta-')
207+
properties = self._get_properties(
208+
response.headers, 'x-container-meta-'
209+
)
213210
if properties:
214211
data['properties'] = properties
215212

@@ -228,8 +225,9 @@ def container_unset(
228225
properties to remove from the container
229226
"""
230227

231-
headers = self._unset_properties(properties,
232-
'X-Remove-Container-Meta-%s')
228+
headers = self._unset_properties(
229+
properties, 'X-Remove-Container-Meta-%s'
230+
)
233231
if headers:
234232
self.create(urllib.parse.quote(container), headers=headers)
235233

@@ -259,8 +257,10 @@ def object_create(
259257
# object's name in the container.
260258
object_name_str = name if name else object
261259

262-
full_url = "%s/%s" % (urllib.parse.quote(container),
263-
urllib.parse.quote(object_name_str))
260+
full_url = "%s/%s" % (
261+
urllib.parse.quote(container),
262+
urllib.parse.quote(object_name_str),
263+
)
264264
with io.open(object, 'rb') as f:
265265
response = self.create(
266266
full_url,
@@ -293,8 +293,10 @@ def object_delete(
293293
if container is None or object is None:
294294
return
295295

296-
self.delete("%s/%s" % (urllib.parse.quote(container),
297-
urllib.parse.quote(object)))
296+
self.delete(
297+
"%s/%s"
298+
% (urllib.parse.quote(container), urllib.parse.quote(object))
299+
)
298300

299301
def object_list(
300302
self,
@@ -394,8 +396,8 @@ def object_save(
394396

395397
response = self._request(
396398
'GET',
397-
"%s/%s" % (urllib.parse.quote(container),
398-
urllib.parse.quote(object)),
399+
"%s/%s"
400+
% (urllib.parse.quote(container), urllib.parse.quote(object)),
399401
stream=True,
400402
)
401403
if response.status_code == 200:
@@ -429,9 +431,11 @@ def object_set(
429431

430432
headers = self._set_properties(properties, 'X-Object-Meta-%s')
431433
if headers:
432-
self.create("%s/%s" % (urllib.parse.quote(container),
433-
urllib.parse.quote(object)),
434-
headers=headers)
434+
self.create(
435+
"%s/%s"
436+
% (urllib.parse.quote(container), urllib.parse.quote(object)),
437+
headers=headers,
438+
)
435439

436440
def object_unset(
437441
self,
@@ -451,9 +455,11 @@ def object_unset(
451455

452456
headers = self._unset_properties(properties, 'X-Remove-Object-Meta-%s')
453457
if headers:
454-
self.create("%s/%s" % (urllib.parse.quote(container),
455-
urllib.parse.quote(object)),
456-
headers=headers)
458+
self.create(
459+
"%s/%s"
460+
% (urllib.parse.quote(container), urllib.parse.quote(object)),
461+
headers=headers,
462+
)
457463

458464
def object_show(
459465
self,
@@ -473,9 +479,11 @@ def object_show(
473479
if container is None or object is None:
474480
return {}
475481

476-
response = self._request('HEAD', "%s/%s" %
477-
(urllib.parse.quote(container),
478-
urllib.parse.quote(object)))
482+
response = self._request(
483+
'HEAD',
484+
"%s/%s"
485+
% (urllib.parse.quote(container), urllib.parse.quote(object)),
486+
)
479487

480488
data = {
481489
'account': self._find_account_id(),
@@ -484,9 +492,7 @@ def object_show(
484492
'content-type': response.headers.get('content-type'),
485493
}
486494
if 'content-length' in response.headers:
487-
data['content-length'] = response.headers.get(
488-
'content-length'
489-
)
495+
data['content-length'] = response.headers.get('content-length')
490496
if 'last-modified' in response.headers:
491497
data['last-modified'] = response.headers.get('last-modified')
492498
if 'etag' in response.headers:
@@ -549,8 +555,9 @@ def account_unset(
549555
properties to remove from the account
550556
"""
551557

552-
headers = self._unset_properties(properties,
553-
'X-Remove-Account-Meta-%s')
558+
headers = self._unset_properties(
559+
properties, 'X-Remove-Account-Meta-%s'
560+
)
554561
if headers:
555562
self.create("", headers=headers)
556563

@@ -596,5 +603,5 @@ def _get_properties(self, headers, header_tag):
596603
properties = {}
597604
for k, v in headers.items():
598605
if k.lower().startswith(header_tag):
599-
properties[k[len(header_tag):]] = v
606+
properties[k[len(header_tag) :]] = v
600607
return properties

openstackclient/tests/unit/api/fakes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747

4848

4949
class TestSession(utils.TestCase):
50-
5150
BASE_URL = 'https://api.example.com:1234/vX'
5251

5352
def setUp(self):

openstackclient/tests/unit/api/test_api.py

Lines changed: 0 additions & 4 deletions

0 commit comments

Comments
 (0)