mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
This commit is contained in:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
|
|
@ -18,7 +18,7 @@ def test_scaled_msg(scale, name):
|
|||
x = localCF(longStr).digest()
|
||||
end = time.time()
|
||||
|
||||
print ('%2.2f' % (end-start)), "seconds", iterations, "x", len(longStr), "bytes", name
|
||||
print(('%2.2f' % (end-start)), "seconds", iterations, "x", len(longStr), "bytes", name)
|
||||
|
||||
def test_create():
|
||||
start = time.time()
|
||||
|
|
@ -26,7 +26,7 @@ def test_create():
|
|||
d = creatorFunc()
|
||||
end = time.time()
|
||||
|
||||
print ('%2.2f' % (end-start)), "seconds", '[20000 creations]'
|
||||
print(('%2.2f' % (end-start)), "seconds", '[20000 creations]')
|
||||
|
||||
def test_zero():
|
||||
start = time.time()
|
||||
|
|
@ -34,7 +34,7 @@ def test_zero():
|
|||
x = creatorFunc().digest()
|
||||
end = time.time()
|
||||
|
||||
print ('%2.2f' % (end-start)), "seconds", '[20000 "" digests]'
|
||||
print(('%2.2f' % (end-start)), "seconds", '[20000 "" digests]')
|
||||
|
||||
|
||||
|
||||
|
|
@ -46,33 +46,33 @@ hName = sys.argv[1]
|
|||
if hName in ('_md5', '_sha'):
|
||||
exec('import '+hName)
|
||||
exec('creatorFunc = '+hName+'.new')
|
||||
print "testing speed of old", hName, "legacy interface"
|
||||
print("testing speed of old", hName, "legacy interface")
|
||||
elif hName == '_hashlib' and len(sys.argv) > 3:
|
||||
import _hashlib
|
||||
exec('creatorFunc = _hashlib.%s' % sys.argv[2])
|
||||
print "testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2])
|
||||
print("testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2]))
|
||||
elif hName == '_hashlib' and len(sys.argv) == 3:
|
||||
import _hashlib
|
||||
exec('creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2])
|
||||
print "testing speed of _hashlib.new(%r)" % sys.argv[2]
|
||||
print("testing speed of _hashlib.new(%r)" % sys.argv[2])
|
||||
elif hasattr(hashlib, hName) and callable(getattr(hashlib, hName)):
|
||||
creatorFunc = getattr(hashlib, hName)
|
||||
print "testing speed of hashlib."+hName, getattr(hashlib, hName)
|
||||
print("testing speed of hashlib."+hName, getattr(hashlib, hName))
|
||||
else:
|
||||
exec("creatorFunc = lambda x=hashlib.new : x(%r)" % hName)
|
||||
print "testing speed of hashlib.new(%r)" % hName
|
||||
print("testing speed of hashlib.new(%r)" % hName)
|
||||
|
||||
try:
|
||||
test_create()
|
||||
except ValueError:
|
||||
print
|
||||
print "pass argument(s) naming the hash to run a speed test on:"
|
||||
print " '_md5' and '_sha' test the legacy builtin md5 and sha"
|
||||
print " '_hashlib' 'openssl_hName' 'fast' tests the builtin _hashlib"
|
||||
print " '_hashlib' 'hName' tests builtin _hashlib.new(shaFOO)"
|
||||
print " 'hName' tests the hashlib.hName() implementation if it exists"
|
||||
print " otherwise it uses hashlib.new(hName)."
|
||||
print
|
||||
print()
|
||||
print("pass argument(s) naming the hash to run a speed test on:")
|
||||
print(" '_md5' and '_sha' test the legacy builtin md5 and sha")
|
||||
print(" '_hashlib' 'openssl_hName' 'fast' tests the builtin _hashlib")
|
||||
print(" '_hashlib' 'hName' tests builtin _hashlib.new(shaFOO)")
|
||||
print(" 'hName' tests the hashlib.hName() implementation if it exists")
|
||||
print(" otherwise it uses hashlib.new(hName).")
|
||||
print()
|
||||
raise
|
||||
|
||||
test_zero()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue