mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Whitespace normalization.
This commit is contained in:
parent
cd84b92f08
commit
f9cc594096
15 changed files with 563 additions and 577 deletions
|
@ -775,4 +775,3 @@ class SimpleComplexArithmetic(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -407,4 +407,3 @@ class Recursion(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
* Incorporate the changes made by (see Inbox)
|
* Incorporate the changes made by (see Inbox)
|
||||||
* Add number range option using srange()
|
* Add number range option using srange()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class ArgumentOption(Option):
|
||||||
""" Option that takes an argument.
|
""" Option that takes an argument.
|
||||||
|
|
||||||
An optional default argument can be given.
|
An optional default argument can be given.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self,name,help=None,default=None):
|
def __init__(self,name,help=None,default=None):
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class Application:
|
||||||
values = None # Dictionary of passed options (or default values)
|
values = None # Dictionary of passed options (or default values)
|
||||||
# indexed by the options name, e.g. '-h'
|
# indexed by the options name, e.g. '-h'
|
||||||
files = None # List of passed filenames
|
files = None # List of passed filenames
|
||||||
optionlist = None # List of passed options
|
optionlist = None # List of passed options
|
||||||
|
|
||||||
def __init__(self,argv=None):
|
def __init__(self,argv=None):
|
||||||
|
|
||||||
|
@ -318,15 +318,15 @@ class Application:
|
||||||
|
|
||||||
# Init .arguments list
|
# Init .arguments list
|
||||||
self.arguments = argv[1:]
|
self.arguments = argv[1:]
|
||||||
|
|
||||||
# Setup Option mapping
|
# Setup Option mapping
|
||||||
self.option_map = option_dict(self.options)
|
self.option_map = option_dict(self.options)
|
||||||
|
|
||||||
# Append preset options
|
# Append preset options
|
||||||
for option in self.preset_options:
|
for option in self.preset_options:
|
||||||
if not self.option_map.has_key(option.name):
|
if not self.option_map.has_key(option.name):
|
||||||
self.add_option(option)
|
self.add_option(option)
|
||||||
|
|
||||||
# Init .files list
|
# Init .files list
|
||||||
self.files = []
|
self.files = []
|
||||||
|
|
||||||
|
@ -336,12 +336,12 @@ class Application:
|
||||||
rc = self.startup()
|
rc = self.startup()
|
||||||
if rc is not None:
|
if rc is not None:
|
||||||
raise SystemExit,rc
|
raise SystemExit,rc
|
||||||
|
|
||||||
# Parse command line
|
# Parse command line
|
||||||
rc = self.parse()
|
rc = self.parse()
|
||||||
if rc is not None:
|
if rc is not None:
|
||||||
raise SystemExit,rc
|
raise SystemExit,rc
|
||||||
|
|
||||||
# Start application
|
# Start application
|
||||||
rc = self.main()
|
rc = self.main()
|
||||||
if rc is None:
|
if rc is None:
|
||||||
|
@ -375,7 +375,7 @@ class Application:
|
||||||
|
|
||||||
Note that this has to be done *before* .parse() is being
|
Note that this has to be done *before* .parse() is being
|
||||||
executed.
|
executed.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.options.append(option)
|
self.options.append(option)
|
||||||
self.option_map[option.name] = option
|
self.option_map[option.name] = option
|
||||||
|
@ -481,10 +481,10 @@ class Application:
|
||||||
|
|
||||||
This may modify filelist in place. A typical application
|
This may modify filelist in place. A typical application
|
||||||
is checking that at least n files are given.
|
is checking that at least n files are given.
|
||||||
|
|
||||||
If this method returns anything other than None, the
|
If this method returns anything other than None, the
|
||||||
process is terminated with the return value as exit code.
|
process is terminated with the return value as exit code.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -554,19 +554,19 @@ class Application:
|
||||||
""" This may process the files list in place.
|
""" This may process the files list in place.
|
||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Short option handler
|
# Short option handler
|
||||||
def handle_h(self,arg):
|
def handle_h(self,arg):
|
||||||
|
|
||||||
self.help()
|
self.help()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def handle_v(self, value):
|
def handle_v(self, value):
|
||||||
|
|
||||||
""" Turn on verbose output.
|
""" Turn on verbose output.
|
||||||
"""
|
"""
|
||||||
self.verbose = 1
|
self.verbose = 1
|
||||||
|
|
||||||
# Handlers for long options have two underscores in their name
|
# Handlers for long options have two underscores in their name
|
||||||
def handle__help(self,arg):
|
def handle__help(self,arg):
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ class Application:
|
||||||
it is None, 0 is assumed (meaning OK). Unhandled
|
it is None, 0 is assumed (meaning OK). Unhandled
|
||||||
exceptions are reported with exit status code 1 (see
|
exceptions are reported with exit status code 1 (see
|
||||||
__init__ for further details).
|
__init__ for further details).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ def _test():
|
||||||
header = 'Test Application'
|
header = 'Test Application'
|
||||||
version = __version__
|
version = __version__
|
||||||
options = [Option('-v','verbose')]
|
options = [Option('-v','verbose')]
|
||||||
|
|
||||||
def handle_v(self,arg):
|
def handle_v(self,arg):
|
||||||
print 'VERBOSE, Yeah !'
|
print 'VERBOSE, Yeah !'
|
||||||
|
|
||||||
|
|
|
@ -562,4 +562,3 @@ class ForLoops(Test):
|
||||||
l1 = range(1000)
|
l1 = range(1000)
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -93,70 +93,70 @@ class DictWithStringKeys(Test):
|
||||||
d['jkl'] = 4
|
d['jkl'] = 4
|
||||||
d['mno'] = 5
|
d['mno'] = 5
|
||||||
d['pqr'] = 6
|
d['pqr'] = 6
|
||||||
|
|
||||||
d['abc']
|
d['abc']
|
||||||
d['def']
|
d['def']
|
||||||
d['ghi']
|
d['ghi']
|
||||||
d['jkl']
|
d['jkl']
|
||||||
d['mno']
|
d['mno']
|
||||||
d['pqr']
|
d['pqr']
|
||||||
|
|
||||||
d['abc'] = 1
|
d['abc'] = 1
|
||||||
d['def'] = 2
|
d['def'] = 2
|
||||||
d['ghi'] = 3
|
d['ghi'] = 3
|
||||||
d['jkl'] = 4
|
d['jkl'] = 4
|
||||||
d['mno'] = 5
|
d['mno'] = 5
|
||||||
d['pqr'] = 6
|
d['pqr'] = 6
|
||||||
|
|
||||||
d['abc']
|
d['abc']
|
||||||
d['def']
|
d['def']
|
||||||
d['ghi']
|
d['ghi']
|
||||||
d['jkl']
|
d['jkl']
|
||||||
d['mno']
|
d['mno']
|
||||||
d['pqr']
|
d['pqr']
|
||||||
|
|
||||||
d['abc'] = 1
|
d['abc'] = 1
|
||||||
d['def'] = 2
|
d['def'] = 2
|
||||||
d['ghi'] = 3
|
d['ghi'] = 3
|
||||||
d['jkl'] = 4
|
d['jkl'] = 4
|
||||||
d['mno'] = 5
|
d['mno'] = 5
|
||||||
d['pqr'] = 6
|
d['pqr'] = 6
|
||||||
|
|
||||||
d['abc']
|
d['abc']
|
||||||
d['def']
|
d['def']
|
||||||
d['ghi']
|
d['ghi']
|
||||||
d['jkl']
|
d['jkl']
|
||||||
d['mno']
|
d['mno']
|
||||||
d['pqr']
|
d['pqr']
|
||||||
|
|
||||||
d['abc'] = 1
|
d['abc'] = 1
|
||||||
d['def'] = 2
|
d['def'] = 2
|
||||||
d['ghi'] = 3
|
d['ghi'] = 3
|
||||||
d['jkl'] = 4
|
d['jkl'] = 4
|
||||||
d['mno'] = 5
|
d['mno'] = 5
|
||||||
d['pqr'] = 6
|
d['pqr'] = 6
|
||||||
|
|
||||||
d['abc']
|
d['abc']
|
||||||
d['def']
|
d['def']
|
||||||
d['ghi']
|
d['ghi']
|
||||||
d['jkl']
|
d['jkl']
|
||||||
d['mno']
|
d['mno']
|
||||||
d['pqr']
|
d['pqr']
|
||||||
|
|
||||||
d['abc'] = 1
|
d['abc'] = 1
|
||||||
d['def'] = 2
|
d['def'] = 2
|
||||||
d['ghi'] = 3
|
d['ghi'] = 3
|
||||||
d['jkl'] = 4
|
d['jkl'] = 4
|
||||||
d['mno'] = 5
|
d['mno'] = 5
|
||||||
d['pqr'] = 6
|
d['pqr'] = 6
|
||||||
|
|
||||||
d['abc']
|
d['abc']
|
||||||
d['def']
|
d['def']
|
||||||
d['ghi']
|
d['ghi']
|
||||||
d['jkl']
|
d['jkl']
|
||||||
d['mno']
|
d['mno']
|
||||||
d['pqr']
|
d['pqr']
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
d = {}
|
d = {}
|
||||||
|
@ -182,70 +182,70 @@ class DictWithFloatKeys(Test):
|
||||||
d[4.567] = 4
|
d[4.567] = 4
|
||||||
d[5.678] = 5
|
d[5.678] = 5
|
||||||
d[6.789] = 6
|
d[6.789] = 6
|
||||||
|
|
||||||
d[1.234]
|
d[1.234]
|
||||||
d[2.345]
|
d[2.345]
|
||||||
d[3.456]
|
d[3.456]
|
||||||
d[4.567]
|
d[4.567]
|
||||||
d[5.678]
|
d[5.678]
|
||||||
d[6.789]
|
d[6.789]
|
||||||
|
|
||||||
d[1.234] = 1
|
d[1.234] = 1
|
||||||
d[2.345] = 2
|
d[2.345] = 2
|
||||||
d[3.456] = 3
|
d[3.456] = 3
|
||||||
d[4.567] = 4
|
d[4.567] = 4
|
||||||
d[5.678] = 5
|
d[5.678] = 5
|
||||||
d[6.789] = 6
|
d[6.789] = 6
|
||||||
|
|
||||||
d[1.234]
|
d[1.234]
|
||||||
d[2.345]
|
d[2.345]
|
||||||
d[3.456]
|
d[3.456]
|
||||||
d[4.567]
|
d[4.567]
|
||||||
d[5.678]
|
d[5.678]
|
||||||
d[6.789]
|
d[6.789]
|
||||||
|
|
||||||
d[1.234] = 1
|
d[1.234] = 1
|
||||||
d[2.345] = 2
|
d[2.345] = 2
|
||||||
d[3.456] = 3
|
d[3.456] = 3
|
||||||
d[4.567] = 4
|
d[4.567] = 4
|
||||||
d[5.678] = 5
|
d[5.678] = 5
|
||||||
d[6.789] = 6
|
d[6.789] = 6
|
||||||
|
|
||||||
d[1.234]
|
d[1.234]
|
||||||
d[2.345]
|
d[2.345]
|
||||||
d[3.456]
|
d[3.456]
|
||||||
d[4.567]
|
d[4.567]
|
||||||
d[5.678]
|
d[5.678]
|
||||||
d[6.789]
|
d[6.789]
|
||||||
|
|
||||||
d[1.234] = 1
|
d[1.234] = 1
|
||||||
d[2.345] = 2
|
d[2.345] = 2
|
||||||
d[3.456] = 3
|
d[3.456] = 3
|
||||||
d[4.567] = 4
|
d[4.567] = 4
|
||||||
d[5.678] = 5
|
d[5.678] = 5
|
||||||
d[6.789] = 6
|
d[6.789] = 6
|
||||||
|
|
||||||
d[1.234]
|
d[1.234]
|
||||||
d[2.345]
|
d[2.345]
|
||||||
d[3.456]
|
d[3.456]
|
||||||
d[4.567]
|
d[4.567]
|
||||||
d[5.678]
|
d[5.678]
|
||||||
d[6.789]
|
d[6.789]
|
||||||
|
|
||||||
d[1.234] = 1
|
d[1.234] = 1
|
||||||
d[2.345] = 2
|
d[2.345] = 2
|
||||||
d[3.456] = 3
|
d[3.456] = 3
|
||||||
d[4.567] = 4
|
d[4.567] = 4
|
||||||
d[5.678] = 5
|
d[5.678] = 5
|
||||||
d[6.789] = 6
|
d[6.789] = 6
|
||||||
|
|
||||||
d[1.234]
|
d[1.234]
|
||||||
d[2.345]
|
d[2.345]
|
||||||
d[3.456]
|
d[3.456]
|
||||||
d[4.567]
|
d[4.567]
|
||||||
d[5.678]
|
d[5.678]
|
||||||
d[6.789]
|
d[6.789]
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
d = {}
|
d = {}
|
||||||
|
@ -271,70 +271,70 @@ class DictWithIntegerKeys(Test):
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
d[6] = 6
|
d[6] = 6
|
||||||
|
|
||||||
d[1]
|
d[1]
|
||||||
d[2]
|
d[2]
|
||||||
d[3]
|
d[3]
|
||||||
d[4]
|
d[4]
|
||||||
d[5]
|
d[5]
|
||||||
d[6]
|
d[6]
|
||||||
|
|
||||||
d[1] = 1
|
d[1] = 1
|
||||||
d[2] = 2
|
d[2] = 2
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
d[6] = 6
|
d[6] = 6
|
||||||
|
|
||||||
d[1]
|
d[1]
|
||||||
d[2]
|
d[2]
|
||||||
d[3]
|
d[3]
|
||||||
d[4]
|
d[4]
|
||||||
d[5]
|
d[5]
|
||||||
d[6]
|
d[6]
|
||||||
|
|
||||||
d[1] = 1
|
d[1] = 1
|
||||||
d[2] = 2
|
d[2] = 2
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
d[6] = 6
|
d[6] = 6
|
||||||
|
|
||||||
d[1]
|
d[1]
|
||||||
d[2]
|
d[2]
|
||||||
d[3]
|
d[3]
|
||||||
d[4]
|
d[4]
|
||||||
d[5]
|
d[5]
|
||||||
d[6]
|
d[6]
|
||||||
|
|
||||||
d[1] = 1
|
d[1] = 1
|
||||||
d[2] = 2
|
d[2] = 2
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
d[6] = 6
|
d[6] = 6
|
||||||
|
|
||||||
d[1]
|
d[1]
|
||||||
d[2]
|
d[2]
|
||||||
d[3]
|
d[3]
|
||||||
d[4]
|
d[4]
|
||||||
d[5]
|
d[5]
|
||||||
d[6]
|
d[6]
|
||||||
|
|
||||||
d[1] = 1
|
d[1] = 1
|
||||||
d[2] = 2
|
d[2] = 2
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
d[6] = 6
|
d[6] = 6
|
||||||
|
|
||||||
d[1]
|
d[1]
|
||||||
d[2]
|
d[2]
|
||||||
d[3]
|
d[3]
|
||||||
d[4]
|
d[4]
|
||||||
d[5]
|
d[5]
|
||||||
d[6]
|
d[6]
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
d = {}
|
d = {}
|
||||||
|
@ -360,7 +360,7 @@ class SimpleDictManipulation(Test):
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
|
|
||||||
x = d[0]
|
x = d[0]
|
||||||
x = d[1]
|
x = d[1]
|
||||||
x = d[2]
|
x = d[2]
|
||||||
|
@ -388,7 +388,7 @@ class SimpleDictManipulation(Test):
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
|
|
||||||
x = d[0]
|
x = d[0]
|
||||||
x = d[1]
|
x = d[1]
|
||||||
x = d[2]
|
x = d[2]
|
||||||
|
@ -416,7 +416,7 @@ class SimpleDictManipulation(Test):
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
|
|
||||||
x = d[0]
|
x = d[0]
|
||||||
x = d[1]
|
x = d[1]
|
||||||
x = d[2]
|
x = d[2]
|
||||||
|
@ -444,7 +444,7 @@ class SimpleDictManipulation(Test):
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
|
|
||||||
x = d[0]
|
x = d[0]
|
||||||
x = d[1]
|
x = d[1]
|
||||||
x = d[2]
|
x = d[2]
|
||||||
|
@ -472,7 +472,7 @@ class SimpleDictManipulation(Test):
|
||||||
d[3] = 3
|
d[3] = 3
|
||||||
d[4] = 4
|
d[4] = 4
|
||||||
d[5] = 5
|
d[5] = 5
|
||||||
|
|
||||||
x = d[0]
|
x = d[0]
|
||||||
x = d[1]
|
x = d[1]
|
||||||
x = d[2]
|
x = d[2]
|
||||||
|
@ -500,4 +500,3 @@ class SimpleDictManipulation(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class TryRaiseExcept(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TryExcept(Test):
|
class TryExcept(Test):
|
||||||
|
|
||||||
|
@ -677,5 +677,3 @@ class TryExcept(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class SecondImport(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SecondPackageImport(Test):
|
class SecondPackageImport(Test):
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class SecondPackageImport(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class SecondSubmoduleImport(Test):
|
class SecondSubmoduleImport(Test):
|
||||||
|
|
||||||
version = 0.1
|
version = 0.1
|
||||||
|
@ -136,4 +136,3 @@ class SecondSubmoduleImport(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,3 @@ class CreateInstances(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class SimpleListManipulation(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
x = l[0]
|
x = l[0]
|
||||||
x = l[1]
|
x = l[1]
|
||||||
x = l[2]
|
x = l[2]
|
||||||
|
@ -46,7 +46,7 @@ class SimpleListManipulation(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
x = l[0]
|
x = l[0]
|
||||||
x = l[1]
|
x = l[1]
|
||||||
x = l[2]
|
x = l[2]
|
||||||
|
@ -67,7 +67,7 @@ class SimpleListManipulation(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
x = l[0]
|
x = l[0]
|
||||||
x = l[1]
|
x = l[1]
|
||||||
x = l[2]
|
x = l[2]
|
||||||
|
@ -88,7 +88,7 @@ class SimpleListManipulation(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
x = l[0]
|
x = l[0]
|
||||||
x = l[1]
|
x = l[1]
|
||||||
x = l[2]
|
x = l[2]
|
||||||
|
@ -109,7 +109,7 @@ class SimpleListManipulation(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
x = l[0]
|
x = l[0]
|
||||||
x = l[1]
|
x = l[1]
|
||||||
x = l[2]
|
x = l[2]
|
||||||
|
@ -190,11 +190,11 @@ class SmallLists(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
l[:3] = [1,2,3]
|
l[:3] = [1,2,3]
|
||||||
m = l[:-1]
|
m = l[:-1]
|
||||||
m = l[1:]
|
m = l[1:]
|
||||||
|
|
||||||
l[-1:] = [4,5,6]
|
l[-1:] = [4,5,6]
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
|
@ -212,11 +212,11 @@ class SmallLists(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
l[:3] = [1,2,3]
|
l[:3] = [1,2,3]
|
||||||
m = l[:-1]
|
m = l[:-1]
|
||||||
m = l[1:]
|
m = l[1:]
|
||||||
|
|
||||||
l[-1:] = [4,5,6]
|
l[-1:] = [4,5,6]
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
|
@ -234,11 +234,11 @@ class SmallLists(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
l[:3] = [1,2,3]
|
l[:3] = [1,2,3]
|
||||||
m = l[:-1]
|
m = l[:-1]
|
||||||
m = l[1:]
|
m = l[1:]
|
||||||
|
|
||||||
l[-1:] = [4,5,6]
|
l[-1:] = [4,5,6]
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
|
@ -256,11 +256,11 @@ class SmallLists(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
l[:3] = [1,2,3]
|
l[:3] = [1,2,3]
|
||||||
m = l[:-1]
|
m = l[:-1]
|
||||||
m = l[1:]
|
m = l[1:]
|
||||||
|
|
||||||
l[-1:] = [4,5,6]
|
l[-1:] = [4,5,6]
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
|
@ -278,15 +278,14 @@ class SmallLists(Test):
|
||||||
l[3] = 3
|
l[3] = 3
|
||||||
l[4] = 4
|
l[4] = 4
|
||||||
l[5] = 5
|
l[5] = 5
|
||||||
|
|
||||||
l[:3] = [1,2,3]
|
l[:3] = [1,2,3]
|
||||||
m = l[:-1]
|
m = l[:-1]
|
||||||
m = l[1:]
|
m = l[1:]
|
||||||
|
|
||||||
l[-1:] = [4,5,6]
|
l[-1:] = [4,5,6]
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
l = []
|
l = []
|
||||||
|
|
||||||
|
|
|
@ -943,4 +943,3 @@ class BuiltinMethodLookup(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -81,7 +81,7 @@ class ConcatStrings(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CompareStrings(Test):
|
class CompareStrings(Test):
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class CompareStrings(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CompareInternedStrings(Test):
|
class CompareInternedStrings(Test):
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ class CompareInternedStrings(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CreateStringsWithConcat(Test):
|
class CreateStringsWithConcat(Test):
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ class CreateStringsWithConcat(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StringSlicing(Test):
|
class StringSlicing(Test):
|
||||||
|
|
||||||
|
@ -334,45 +334,45 @@ class StringSlicing(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
|
|
||||||
s[50:]
|
s[50:]
|
||||||
s[:25]
|
s[:25]
|
||||||
s[50:55]
|
s[50:55]
|
||||||
s[-1:]
|
s[-1:]
|
||||||
s[:1]
|
s[:1]
|
||||||
s[2:]
|
s[2:]
|
||||||
s[11:-11]
|
s[11:-11]
|
||||||
|
|
||||||
s[50:]
|
s[50:]
|
||||||
s[:25]
|
s[:25]
|
||||||
s[50:55]
|
s[50:55]
|
||||||
s[-1:]
|
s[-1:]
|
||||||
s[:1]
|
s[:1]
|
||||||
s[2:]
|
s[2:]
|
||||||
s[11:-11]
|
s[11:-11]
|
||||||
|
|
||||||
s[50:]
|
s[50:]
|
||||||
s[:25]
|
s[:25]
|
||||||
s[50:55]
|
s[50:55]
|
||||||
s[-1:]
|
s[-1:]
|
||||||
s[:1]
|
s[:1]
|
||||||
s[2:]
|
s[2:]
|
||||||
s[11:-11]
|
s[11:-11]
|
||||||
|
|
||||||
s[50:]
|
s[50:]
|
||||||
s[:25]
|
s[:25]
|
||||||
s[50:55]
|
s[50:55]
|
||||||
s[-1:]
|
s[-1:]
|
||||||
s[:1]
|
s[:1]
|
||||||
s[2:]
|
s[2:]
|
||||||
s[11:-11]
|
s[11:-11]
|
||||||
|
|
||||||
s[50:]
|
s[50:]
|
||||||
s[:25]
|
s[:25]
|
||||||
s[50:55]
|
s[50:55]
|
||||||
s[-1:]
|
s[-1:]
|
||||||
s[:1]
|
s[:1]
|
||||||
s[2:]
|
s[2:]
|
||||||
s[11:-11]
|
s[11:-11]
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
|
@ -560,5 +560,3 @@ if hasattr('', 'lower'):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
s = data[i % len_data]
|
s = data[i % len_data]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ class TupleSlicing(Test):
|
||||||
t = tuple(range(100))
|
t = tuple(range(100))
|
||||||
|
|
||||||
for j in r:
|
for j in r:
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class SmallTuples(Test):
|
class SmallTuples(Test):
|
||||||
|
@ -362,4 +362,3 @@ class SmallTuples(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ConcatUnicode(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CompareUnicode(Test):
|
class CompareUnicode(Test):
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class CompareUnicode(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CreateUnicodeWithConcat(Test):
|
class CreateUnicodeWithConcat(Test):
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class CreateUnicodeWithConcat(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class UnicodeSlicing(Test):
|
class UnicodeSlicing(Test):
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ class UnicodeSlicing(Test):
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
### String methods
|
### String methods
|
||||||
|
|
||||||
class UnicodeMappings(Test):
|
class UnicodeMappings(Test):
|
||||||
|
@ -318,7 +318,7 @@ class UnicodeMappings(Test):
|
||||||
t = join(map(unichr,range(100)),'')
|
t = join(map(unichr,range(100)),'')
|
||||||
u = join(map(unichr,range(500)),'')
|
u = join(map(unichr,range(500)),'')
|
||||||
v = join(map(unichr,range(1000)),'')
|
v = join(map(unichr,range(1000)),'')
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
|
|
||||||
s.lower()
|
s.lower()
|
||||||
|
@ -375,7 +375,7 @@ class UnicodeMappings(Test):
|
||||||
t = join(map(unichr,range(100)),'')
|
t = join(map(unichr,range(100)),'')
|
||||||
u = join(map(unichr,range(500)),'')
|
u = join(map(unichr,range(500)),'')
|
||||||
v = join(map(unichr,range(1000)),'')
|
v = join(map(unichr,range(1000)),'')
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ class UnicodePredicates(Test):
|
||||||
|
|
||||||
data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
|
data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
|
||||||
len_data = len(data)
|
len_data = len(data)
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
s = data[i % len_data]
|
s = data[i % len_data]
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ class UnicodePredicates(Test):
|
||||||
|
|
||||||
data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
|
data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
|
||||||
len_data = len(data)
|
len_data = len(data)
|
||||||
|
|
||||||
for i in xrange(self.rounds):
|
for i in xrange(self.rounds):
|
||||||
s = data[i % len_data]
|
s = data[i % len_data]
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
|
||||||
__version__ = '1.3'
|
__version__ = '1.3'
|
||||||
|
|
||||||
#
|
#
|
||||||
# NOTE: Use xrange for all test loops unless you want to face
|
# NOTE: Use xrange for all test loops unless you want to face
|
||||||
# a 20MB process !
|
# a 20MB process !
|
||||||
#
|
#
|
||||||
# All tests should have rounds set to values so that a run()
|
# All tests should have rounds set to values so that a run()
|
||||||
|
@ -85,7 +85,7 @@ class Test:
|
||||||
# for comparisons of benchmark runs - tests with unequal version
|
# for comparisons of benchmark runs - tests with unequal version
|
||||||
# number will not get compared.
|
# number will not get compared.
|
||||||
version = 1.0
|
version = 1.0
|
||||||
|
|
||||||
# The number of abstract operations done in each round of the
|
# The number of abstract operations done in each round of the
|
||||||
# test. An operation is the basic unit of what you want to
|
# test. An operation is the basic unit of what you want to
|
||||||
# measure. The benchmark will output the amount of run-time per
|
# measure. The benchmark will output the amount of run-time per
|
||||||
|
@ -129,7 +129,7 @@ class Test:
|
||||||
""" Run the test in two phases: first calibrate, then
|
""" Run the test in two phases: first calibrate, then
|
||||||
do the actual test. Be careful to keep the calibration
|
do the actual test. Be careful to keep the calibration
|
||||||
timing low w/r to the test timing.
|
timing low w/r to the test timing.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
test = self.test
|
test = self.test
|
||||||
calibrate = self.calibrate
|
calibrate = self.calibrate
|
||||||
|
@ -144,7 +144,7 @@ class Test:
|
||||||
offset = offset + t
|
offset = offset + t
|
||||||
offset = offset / cruns
|
offset = offset / cruns
|
||||||
# now the real thing
|
# now the real thing
|
||||||
t = clock()
|
t = clock()
|
||||||
test()
|
test()
|
||||||
t = clock() - t
|
t = clock() - t
|
||||||
self.last_timing = (t-offset,t,offset)
|
self.last_timing = (t-offset,t,offset)
|
||||||
|
@ -152,32 +152,32 @@ class Test:
|
||||||
|
|
||||||
def calibrate(self):
|
def calibrate(self):
|
||||||
|
|
||||||
""" Calibrate the test.
|
""" Calibrate the test.
|
||||||
|
|
||||||
This method should execute everything that is needed to
|
This method should execute everything that is needed to
|
||||||
setup and run the test - except for the actual operations
|
setup and run the test - except for the actual operations
|
||||||
that you intend to measure. pybench uses this method to
|
that you intend to measure. pybench uses this method to
|
||||||
measure the test implementation overhead.
|
measure the test implementation overhead.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return
|
return
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
|
|
||||||
""" Run the test.
|
""" Run the test.
|
||||||
|
|
||||||
The test needs to run self.rounds executing
|
The test needs to run self.rounds executing
|
||||||
self.operations number of operations each.
|
self.operations number of operations each.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# do some tests
|
# do some tests
|
||||||
return
|
return
|
||||||
|
|
||||||
def stat(self):
|
def stat(self):
|
||||||
|
|
||||||
""" Returns two value: average time per run and average per
|
""" Returns two value: average time per run and average per
|
||||||
operation.
|
operation.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
runs = len(self.times)
|
runs = len(self.times)
|
||||||
if runs == 0:
|
if runs == 0:
|
||||||
|
@ -210,7 +210,7 @@ class Benchmark:
|
||||||
roundtime = 0 # Average round time
|
roundtime = 0 # Average round time
|
||||||
version = None # Benchmark version number (see __init__)
|
version = None # Benchmark version number (see __init__)
|
||||||
# as float x.yy
|
# as float x.yy
|
||||||
starttime = None # Benchmark start time
|
starttime = None # Benchmark start time
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ class Benchmark:
|
||||||
print
|
print
|
||||||
self.roundtime = (clock() - roundtime) / self.rounds
|
self.roundtime = (clock() - roundtime) / self.rounds
|
||||||
print
|
print
|
||||||
|
|
||||||
def print_stat(self, compare_to=None, hidenoise=0):
|
def print_stat(self, compare_to=None, hidenoise=0):
|
||||||
|
|
||||||
if not compare_to:
|
if not compare_to:
|
||||||
|
@ -380,7 +380,7 @@ python pybench.py -s p15 -c p14
|
||||||
hidenoise = self.values['-d']
|
hidenoise = self.values['-d']
|
||||||
warp = self.values['-w']
|
warp = self.values['-w']
|
||||||
nogc = self.values['--no-gc']
|
nogc = self.values['--no-gc']
|
||||||
|
|
||||||
# Switch off GC
|
# Switch off GC
|
||||||
if nogc:
|
if nogc:
|
||||||
try:
|
try:
|
||||||
|
@ -407,7 +407,7 @@ python pybench.py -s p15 -c p14
|
||||||
compare_to = bench
|
compare_to = bench
|
||||||
except IOError:
|
except IOError:
|
||||||
print '* Error opening/reading file',compare_to
|
print '* Error opening/reading file',compare_to
|
||||||
compare_to = None
|
compare_to = None
|
||||||
|
|
||||||
if show_bench:
|
if show_bench:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue