summaryrefslogtreecommitdiff
path: root/swiftclient
diff options
context:
space:
mode:
authorZhijunWei <wzj334965317@outlook.com>2018-12-28 23:04:37 +0800
committerZhijunWei <wzj334965317@outlook.com>2019-01-03 13:09:22 +0800
commit2ff36fde575fa6987ee5954f526ad6c9460633a5 (patch)
tree1166328403d7c4d69f5e3df8d12c159264b9e886 /swiftclient
parent4e4f57a5fc5e5f025816eb1672abfea020b208a0 (diff)
downloadpython-swiftclient-2ff36fde575fa6987ee5954f526ad6c9460633a5.tar.gz
Update hacking version
1. update hacking version to latest 2. fix pep8 failed Change-Id: Ifc3bfeff4038c93d8c8cf2c9d7814c3003e73504
Diffstat (limited to 'swiftclient')
-rw-r--r--swiftclient/client.py14
-rw-r--r--swiftclient/service.py26
-rwxr-xr-xswiftclient/shell.py5
3 files changed, 23 insertions, 22 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index c9efc79..6a2b43b 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -248,8 +248,8 @@ def encode_meta_headers(headers):
value = encode_utf8(value)
header = header.lower()
- if (isinstance(header, six.string_types)
- and header.startswith(USER_METADATA_TYPE)):
+ if (isinstance(header, six.string_types) and
+ header.startswith(USER_METADATA_TYPE)):
header = encode_utf8(header)
ret[header] = value
@@ -706,9 +706,9 @@ def get_auth(auth_url, user, key, **kwargs):
if kwargs.get('tenant_name'):
os_options['tenant_name'] = kwargs['tenant_name']
- if not (os_options.get('tenant_name') or os_options.get('tenant_id')
- or os_options.get('project_name')
- or os_options.get('project_id')):
+ if not (os_options.get('tenant_name') or os_options.get('tenant_id') or
+ os_options.get('project_name') or
+ os_options.get('project_id')):
if auth_version in AUTH_VERSIONS_V2:
raise ClientException('No tenant specified')
raise ClientException('No project name or project id specified.')
@@ -1659,8 +1659,8 @@ class Connection(object):
self.force_auth_retry = force_auth_retry
def close(self):
- if (self.http_conn and isinstance(self.http_conn, tuple)
- and len(self.http_conn) > 1):
+ if (self.http_conn and isinstance(self.http_conn, tuple) and
+ len(self.http_conn) > 1):
conn = self.http_conn[1]
conn.close()
self.http_conn = None
diff --git a/swiftclient/service.py b/swiftclient/service.py
index eedad46..71c36ec 100644
--- a/swiftclient/service.py
+++ b/swiftclient/service.py
@@ -424,8 +424,8 @@ class _SwiftReader(object):
'{1} != {2}'.format(
self._path, etag, self._expected_md5))
- if (self._content_length is not None
- and self._actual_read != self._content_length):
+ if (self._content_length is not None and
+ self._actual_read != self._content_length):
raise SwiftError('Error downloading {0}: read_length != '
'content_length, {1:d} != {2:d}'.format(
self._path, self._actual_read,
@@ -1244,8 +1244,8 @@ class SwiftService(object):
bytes_read = obj_body.bytes_read()
if fp is not None:
fp.close()
- if ('x-object-meta-mtime' in headers and not no_file
- and not options['ignore_mtime']):
+ if ('x-object-meta-mtime' in headers and not no_file and
+ not options['ignore_mtime']):
try:
mtime = float(headers['x-object-meta-mtime'])
except ValueError:
@@ -2036,8 +2036,8 @@ class SwiftService(object):
new_slo_manifest_paths = set()
segment_size = int(0 if options['segment_size'] is None
else options['segment_size'])
- if (options['changed'] or options['skip_identical']
- or not options['leave_segments']):
+ if (options['changed'] or options['skip_identical'] or
+ not options['leave_segments']):
try:
headers = conn.head_object(container, obj)
is_slo = config_true_value(
@@ -2058,9 +2058,9 @@ class SwiftService(object):
cl = int(headers.get('content-length'))
mt = headers.get('x-object-meta-mtime')
- if (path is not None and options['changed']
- and cl == getsize(path)
- and mt == put_headers['x-object-meta-mtime']):
+ if (path is not None and options['changed'] and
+ cl == getsize(path) and
+ mt == put_headers['x-object-meta-mtime']):
res.update({
'success': True,
'status': 'skipped-changed'
@@ -2095,8 +2095,8 @@ class SwiftService(object):
# a segment job if we're reading from a stream - we may fail if we
# go over the single object limit, but this gives us a nice way
# to create objects from memory
- if (path is not None and segment_size
- and (getsize(path) > segment_size)):
+ if (path is not None and segment_size and
+ (getsize(path) > segment_size)):
res['large_object'] = True
seg_container = container + '_segments'
if options['segment_container']:
@@ -2425,8 +2425,8 @@ class SwiftService(object):
# Cancel the remaining container deletes, but yield
# any pending results
- if (not cancelled and options['fail_fast']
- and not res['success']):
+ if (not cancelled and options['fail_fast'] and
+ not res['success']):
cancelled = True
def _bulk_delete_page_size(self, objects):
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index 9ca28b1..9ea5e95 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -1462,8 +1462,9 @@ def st_bash_completion(parser, args, thread_manager, return_parser=False):
return
else:
fn_commands = [fn for fn in globals().keys()
- if fn.startswith('st_') and not fn.endswith('_options')
- and not fn.endswith('_help')]
+ if fn.startswith('st_') and
+ not fn.endswith('_options') and
+ not fn.endswith('_help')]
subparsers = parser.add_subparsers()
subcommands = {}