Ejemplo n.º 1
0
def _image_show(image, human_readable=False, max_column_width=80):
    # Flatten image properties dict for display
    info = copy.deepcopy(image._info)
    if human_readable:
        info['size'] = utils.make_size_human_readable(info['size'])
    for (k, v) in six.iteritems(info.pop('properties')):
        info['Property \'%s\'' % k] = v

    utils.print_dict(info, max_column_width=max_column_width)
Ejemplo n.º 2
0
def _image_show(image, human_readable=False, max_column_width=80):
    # Flatten image properties dict for display
    info = copy.deepcopy(image._info)
    if human_readable:
        info["size"] = utils.make_size_human_readable(info["size"])
    for (k, v) in six.iteritems(info.pop("properties")):
        info["Property '%s'" % k] = v

    utils.print_dict(info, max_column_width=max_column_width)
Ejemplo n.º 3
0
def _image_show(image, human_readable=False):
    # Flatten image properties dict for display
    info = copy.deepcopy(image._info)
    if human_readable:
        info['size'] = utils.make_size_human_readable(info['size'])
    for (k, v) in info.pop('properties').iteritems():
        info['Property \'%s\'' % k] = v

    utils.print_dict(info)
Ejemplo n.º 4
0
 def test_make_size_human_readable(self):
     self.assertEqual("106B", utils.make_size_human_readable(106))
     self.assertEqual("1000kB", utils.make_size_human_readable(1024000))
     self.assertEqual("1MB", utils.make_size_human_readable(1048576))
     self.assertEqual("1.4GB", utils.make_size_human_readable(1476395008))
     self.assertEqual("9.3MB", utils.make_size_human_readable(9761280))
     self.assertEqual("0B", utils.make_size_human_readable(None))
Ejemplo n.º 5
0
 def test_make_size_human_readable(self):
     self.assertEqual("106B", utils.make_size_human_readable(106))
     self.assertEqual("1000kB", utils.make_size_human_readable(1024000))
     self.assertEqual("1MB", utils.make_size_human_readable(1048576))
     self.assertEqual("1.4GB", utils.make_size_human_readable(1476395008))
     self.assertEqual("9.3MB", utils.make_size_human_readable(9761280))
     self.assertEqual("0B", utils.make_size_human_readable(None))
Ejemplo n.º 6
0
 def convert_size(image):
     image.size = utils.make_size_human_readable(image.size)
     return image
Ejemplo n.º 7
0
 def convert_size(image):
     image.size = utils.make_size_human_readable(image.size)
     return image