[Python-checkins] python/dist/src/Tools/scripts trace.py,1.11,1.12
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
2002年12月11日 13:43:15 -0800
Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv6880
Modified Files:
trace.py
Log Message:
Correct buggy module docstring.
Replace use of homebrew boolean with True/False.
Reflow lots more long lines.
Index: trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** trace.py 11 Dec 2002 21:28:32 -0000 1.11
--- trace.py 11 Dec 2002 21:43:13 -0000 1.12
***************
*** 42,46 ****
trace.run(coverage.globaltrace, 'main()')
# make a report, telling it where you want output
! trace.print_results(show_missing=1)
"""
--- 42,47 ----
trace.run(coverage.globaltrace, 'main()')
# make a report, telling it where you want output
! r = trace.results()
! r.write_results(show_missing=1)
"""
***************
*** 52,58 ****
import pickle
- true = 1
- false = None
-
# DEBUG_MODE=1 # make this true to get printouts which help you understand what's going on
--- 53,56 ----
***************
*** 148,152 ****
class CoverageResults:
! def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None):
self.counts = counts
if self.counts is None:
--- 146,151 ----
class CoverageResults:
! def __init__(self, counts=None, calledfuncs=None, infile=None,
! outfile=None):
self.counts = counts
if self.counts is None:
***************
*** 164,168 ****
thingie = pickle.load(open(self.infile, 'r'))
if type(thingie) is types.DictType:
! # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001年10月24日
self.update(self.__class__(thingie))
elif type(thingie) is types.TupleType and len(thingie) == 2:
--- 163,169 ----
thingie = pickle.load(open(self.infile, 'r'))
if type(thingie) is types.DictType:
! # backwards compatibility for old trace.py after
! # Zooko touched it but before calledfuncs --Zooko
! # 2001年10月24日
self.update(self.__class__(thingie))
elif type(thingie) is types.TupleType and len(thingie) == 2:
***************
*** 172,176 ****
pass
except pickle.UnpicklingError:
! # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001年10月24日
self.update(self.__class__(marshal.load(open(self.infile))))
--- 173,178 ----
pass
except pickle.UnpicklingError:
! # backwards compatibility for old trace.py before
! # Zooko touched it --Zooko 2001年10月24日
self.update(self.__class__(marshal.load(open(self.infile))))
***************
*** 183,187 ****
for key in other_counts.keys():
! if key != 'calledfuncs': # backwards compatibility for abortive attempt to stuff calledfuncs into self.counts, by Zooko --Zooko 2001年10月24日
counts[key] = counts.get(key, 0) + other_counts[key]
--- 185,192 ----
for key in other_counts.keys():
! if key != 'calledfuncs':
! # backwards compatibility for abortive attempt to
! # stuff calledfuncs into self.counts, by Zooko
! # --Zooko 2001年10月24日
counts[key] = counts.get(key, 0) + other_counts[key]
***************
*** 398,409 ****
class Trace:
! def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None):
"""
! @param count true iff it should count number of times each line is executed
! @param trace true iff it should print out each line that is being counted
! @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace'
@param ignoremods a list of the names of modules to ignore
! @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of
! @param infile file from which to read stored counts to be added into the results
@param outfile file in which to write the results
"""
--- 403,422 ----
class Trace:
! def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(),
! ignoredirs=(), infile=None, outfile=None):
"""
! @param count true iff it should count number of times each
! line is executed
! @param trace true iff it should print out each line that is
! being counted
! @param countfuncs true iff it should just output a list of
! (filename, modulename, funcname,) for functions
! that were called at least once; This overrides
! `count' and `trace'
@param ignoremods a list of the names of modules to ignore
! @param ignoredirs a list of the names of directories to ignore
! all of the (recursive) contents of
! @param infile file from which to read stored counts to be
! added into the results
@param outfile file in which to write the results
"""
***************
*** 507,511 ****
filename, lineno, funcname, context, lineindex = \
inspect.getframeinfo(frame, 1)
! key = (filename, lineno,)
self.counts[key] = self.counts.get(key, 0) + 1
--- 520,524 ----
filename, lineno, funcname, context, lineindex = \
inspect.getframeinfo(frame, 1)
! key = filename, lineno
self.counts[key] = self.counts.get(key, 0) + 1
***************
*** 606,610 ****
coverdir = None
summary = 0
! listfuncs = false
for opt, val in opts:
--- 619,623 ----
coverdir = None
summary = 0
! listfuncs = False
for opt, val in opts:
***************
*** 618,622 ****
if opt == "-l" or opt == "--listfuncs":
! listfuncs = true
continue
--- 631,635 ----
if opt == "-l" or opt == "--listfuncs":
! listfuncs = True
continue