Esempio n. 1
0
    def get_rendered_transfer(self, step=None, steps=None):
        if step is None:
            step = self.step
        if steps is None:
            steps = self.steps

        if steps <= 0:
            return '%s: -' % self.transfer_label
        total = filesizeformat(float(steps))
        if step <= 0:
            transferred = '-'
        else:
            transferred = filesizeformat(float(step))
        return '%s: %s / %s' % (self.transfer_label, transferred, total)
Esempio n. 2
0
    def get_rendered_transfer(self, step=None, steps=None):
        if step is None:
            step = self.step
        if steps is None:
            steps = self.steps

        if steps <= 0:
            return '%s: -' % self.transfer_label
        total = filesizeformat(float(steps))
        if step <= 0:
            transferred = '-'
        else:
            transferred = filesizeformat(float(step))
        return '%s: %s / %s' % (self.transfer_label, transferred, total)
Esempio n. 3
0
 def get_rendered_speed(self, step=None, total_seconds=None):
     if step is None:
         step = self.step
     if total_seconds is None:
         total_seconds = get_total_seconds(self.get_total_time())
     if step <= 0 or total_seconds <= 0:
         speed = '-'
     else:
         speed = filesizeformat(float(step) / total_seconds)
     return '%s: %s/s' % (self.speed_label, speed)
Esempio n. 4
0
 def get_rendered_speed(self, step=None, total_seconds=None):
     if step is None:
         step = self.step
     if total_seconds is None:
         total_seconds = self.get_total_time().total_seconds()
     if step <= 0 or total_seconds <= 0:
         speed = '-'
     else:
         speed = filesizeformat(float(step) / total_seconds)
     return '%s: %s/s' % (self.speed_label, speed)
Esempio n. 5
0
 def test_kilobytes(self):
     self.assertEqual(filesizeformat(1024 * 2), '2 KB')
Esempio n. 6
0
 def test_kilobytes(self):
     assert filesizeformat(1024 * 2) == '2 KB'
Esempio n. 7
0
 def test_bytes(self):
     assert filesizeformat(10) == '10 B'
Esempio n. 8
0
 def test_that_function_respects_sep_parameter(self):
     assert filesizeformat(1, '') == '1B'
Esempio n. 9
0
 def test_gigabytes(self):
     assert filesizeformat(1024 * 1024 * 1024 * 12.92) == '12.92 GB'
Esempio n. 10
0
 def test_megabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 2.3), '2.3 MB')
Esempio n. 11
0
 def test_that_function_respects_sep_paramtere(self):
     self.assertEqual(filesizeformat(1, ''), '1B')
Esempio n. 12
0
 def test_bytes(self):
     self.assertEqual(filesizeformat(10), '10 B')
Esempio n. 13
0
 def test_that_function_respects_sep_paramtere(self):
     self.assertEqual(filesizeformat(1, ''), '1B')
Esempio n. 14
0
 def test_gigabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 1024 * 12.92),
                      '12.92 GB')
Esempio n. 15
0
 def test_megabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 2.3), '2.3 MB')
Esempio n. 16
0
 def test_gigabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 1024 * 12.92), '12.92 GB')
Esempio n. 17
0
 def test_megabytes(self):
     assert filesizeformat(1024 * 1024 * 2.3) == '2.3 MB'
Esempio n. 18
0
 def test_bytes(self):
     self.assertEqual(filesizeformat(10), '10 B')
Esempio n. 19
0
 def test_kilobytes(self):
     self.assertEqual(filesizeformat(1024 * 2), '2 KB')