Skip to content

Commit

Permalink
style: Format code with google style
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Jan 10, 2017
1 parent 7d99a59 commit dd6876c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions qingstor/qsctl/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def validate_bucket(cls, bucket):
current_bucket = cls.client.Bucket(bucket, cls.bucket_map[bucket])
resp = current_bucket.head()
if resp.status_code != HTTP_OK:
print("Error: Please check if you have "
"enough permission to access it." % bucket)
print("Error: Please check if you have enough"
" permission to access bucket <%s>." % bucket)
sys.exit(-1)

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions qingstor/qsctl/commands/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def upload_file(cls, options):
else:
key = prefix
if os.path.isfile(options.source_path):
if cls.confirm_key_upload(options, options.source_path, bucket, key):
if cls.confirm_key_upload(options, options.source_path, bucket,
key):
cls.send_local_file(options.source_path, bucket, key)
elif options.source_path == '-':
cls.send_data_from_stdin(bucket, key)
Expand Down Expand Up @@ -273,7 +274,6 @@ def send_data_from_stdin(cls, bucket, key):
else:
print("Error: Failed to upload file '%s'" % '-')


@classmethod
def send_file(cls, local_path, bucket, key):
with open(local_path, "rb") as data:
Expand Down
8 changes: 3 additions & 5 deletions tests/commands/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ def test_upload_file(self):
def test_upload_file_from_stdin(self):
# Create a large file(~8MB)
with open("tmp/large_file", 'w') as f:
f.seek(8*1024*1024)
f.seek(8 * 1024 * 1024)
f.write("just for testing")
options = MockOptions(
source_path="-",
dest_path="qs://" + test_bucket1,
exclude=None,
include=None,
force=True
)
force=True)
with open("tmp/large_file", 'rb') as f:
with patch("qingstor.qsctl.utils.sys.stdin", f):
self.Transfer.upload_file(options)
Expand All @@ -98,8 +97,7 @@ def test_upload_file_from_stdin(self):
dest_path="qs://" + test_bucket1,
exclude=None,
include=None,
force=True
)
force=True)
with open("tmp/small_file", 'rb') as f:
with patch("qingstor.qsctl.utils.sys.stdin", f):
self.Transfer.upload_file(options)
Expand Down

0 comments on commit dd6876c

Please sign in to comment.