mirror of https://github.com/python/cpython
Fix terse mode for printing tuple packfactor and to avoid zero division
This commit is contained in:
parent
09bf3e310b
commit
83c81448b1
|
@ -87,10 +87,16 @@ def process(filename):
|
||||||
print string.ljust(vin.format, 8),
|
print string.ljust(vin.format, 8),
|
||||||
print string.rjust(`vin.width`, 4),
|
print string.rjust(`vin.width`, 4),
|
||||||
print string.rjust(`vin.height`, 4),
|
print string.rjust(`vin.height`, 4),
|
||||||
|
if type(vin.packfactor) == type(()):
|
||||||
|
xpf, ypf = vin.packfactor
|
||||||
|
s = string.rjust(`xpf`, 2) + ',' + \
|
||||||
|
string.rjust(`ypf`, 2)
|
||||||
|
else:
|
||||||
s = string.rjust(`vin.packfactor`, 2)
|
s = string.rjust(`vin.packfactor`, 2)
|
||||||
if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \
|
if type(vin.packfactor) == type(0) and \
|
||||||
|
vin.format not in ('rgb', 'jpeg') and \
|
||||||
(vin.width/vin.packfactor) % 4 <> 0:
|
(vin.width/vin.packfactor) % 4 <> 0:
|
||||||
s = s + '!'
|
s = s + '! '
|
||||||
else:
|
else:
|
||||||
s = s + ' '
|
s = s + ' '
|
||||||
print s,
|
print s,
|
||||||
|
@ -144,7 +150,8 @@ def process(filename):
|
||||||
|
|
||||||
if terse:
|
if terse:
|
||||||
print string.rjust(`n`, 6),
|
print string.rjust(`n`, 6),
|
||||||
print string.rjust(`int(n*10000.0/t)*0.1`, 5)
|
if t: print string.rjust(`int(n*10000.0/t)*0.1`, 5),
|
||||||
|
print
|
||||||
else:
|
else:
|
||||||
print 'Total', n, 'frames in', t*0.001, 'sec.',
|
print 'Total', n, 'frames in', t*0.001, 'sec.',
|
||||||
if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec',
|
if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec',
|
||||||
|
|
Loading…
Reference in New Issue