Sitelet https://github.com/openstack/python-swiftclient/commit/553e34ebfe891fe234abd722ceeba0809775a175
Skip to content

Commit 553e34e

Browse files
committed
Improve formatting for billions of objects
Change-Id: If8aa08c4c8c8ad6ca2c861602baf1eefa8642a8a
1 parent bcf19d4 commit 553e34e

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎swiftclient/shell.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def _print_stats(options, stats, human):
552552
datestamp = '????-??-?? ??:??:??'
553553
if not options['totals']:
554554
output_manager.print_msg(
555-
"%5s %s %s %s", count, byte_str,
555+
"%12s %s %s %s", count, byte_str,
556556
datestamp, item_name)
557557
else: # list container contents
558558
subdir = item.get('subdir')
@@ -584,7 +584,7 @@ def _print_stats(options, stats, human):
584584
if options['long'] or human:
585585
if not container:
586586
output_manager.print_msg(
587-
"%5s %s", prt_bytes(total_count, True),
587+
"%12s %s", prt_bytes(total_count, True),
588588
prt_bytes(total_bytes, human))
589589
else:
590590
output_manager.print_msg(

‎test/unit/test_shell.py‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,10 @@ def test_list_account_long(self, connection):
475475
mock.call(marker='container', prefix=None, headers={})]
476476
connection.return_value.get_account.assert_has_calls(calls)
477477

478-
self.assertEqual(output.out,
479-
' 0 0 1970-01-01 00:00:01 container\n'
480-
' 0 0\n')
478+
self.assertEqual(
479+
output.out,
480+
' 0 0 1970-01-01 00:00:01 container\n'
481+
' 0 0\n')
481482

482483
# Now test again, this time without returning metadata
483484
connection.return_value.head_container.return_value = {}
@@ -495,9 +496,10 @@ def test_list_account_long(self, connection):
495496
mock.call(marker='container', prefix=None, headers={})]
496497
connection.return_value.get_account.assert_has_calls(calls)
497498

498-
self.assertEqual(output.out,
499-
' 0 0 ????-??-?? ??:??:?? container\n'
500-
' 0 0\n')
499+
self.assertEqual(
500+
output.out,
501+
' 0 0 ????-??-?? ??:??:?? container\n'
502+
' 0 0\n')
501503

502504
def test_list_account_totals_error(self):
503505
# No --lh provided: expect info message about incorrect --totals use
@@ -523,7 +525,7 @@ def test_list_account_totals(self, connection):
523525
swiftclient.shell.main(argv)
524526
calls = [mock.call(marker='', prefix=None, headers={})]
525527
connection.return_value.get_account.assert_has_calls(calls)
526-
self.assertEqual(output.out, ' 6 3\n')
528+
self.assertEqual(output.out, ' 6 3\n')
527529

528530
@mock.patch('swiftclient.service.Connection')
529531
def test_list_container(self, connection):

0 commit comments

Comments
 (0)