@@ -25,8 +25,8 @@ simple as ::
2525
2626 python -m trace --count -C . somefile.py ...
2727
28- The above will execute :file: `somefile.py ` and generate annotated listings of all
29- Python modules imported during the execution into the current directory.
28+ The above will execute :file: `somefile.py ` and generate annotated listings of
29+ all Python modules imported during the execution into the current directory.
3030
3131.. program :: trace
3232
@@ -41,19 +41,19 @@ Python modules imported during the execution into the current directory.
4141Main options
4242^^^^^^^^^^^^
4343
44- At least one of the following options must be specified when invoking :mod: ` trace `.
45- The :option: `--listfuncs <-l> ` option is mutually exclusive with the
46- :option: `--trace <-t> ` and :option: `--counts <-c> ` options . When :option: ` --listfuncs <-l> `
47- is provided, neither :option: `--counts <-c > ` nor :option: `--trace <-t > ` are accepted,
48- and vice versa.
44+ At least one of the following options must be specified when invoking
45+ :mod: ` trace `. The :option: `--listfuncs <-l> ` option is mutually exclusive with
46+ the :option: `--trace <-t> ` and :option: `--counts <-c> ` options . When
47+ :option: `--listfuncs <-l > ` is provided, neither :option: `--counts <-c > ` nor
48+ :option: ` --trace <-t> ` are accepted, and vice versa.
4949
5050.. program :: trace
5151
5252.. cmdoption :: -c, --count
5353
5454 Produce a set of annotated listing files upon program completion that shows
55- how many times each statement was executed.
56- See also :option: `--coverdir <-C> `, :option: `--file <-f> `,
55+ how many times each statement was executed. See also
56+ :option: `--coverdir <-C> `, :option: `--file <-f> ` and
5757 :option: `--no-report <-R> ` below.
5858
5959.. cmdoption :: -t, --trace
@@ -67,7 +67,8 @@ and vice versa.
6767.. cmdoption :: -r, --report
6868
6969 Produce an annotated list from an earlier program run that used the
70- :option: `--count <-c> ` and :option: `--file <-f> ` option. Do not execute any code.
70+ :option: `--count <-c> ` and :option: `--file <-f> ` option. This does not
71+ execute any code.
7172
7273.. cmdoption :: -T, --trackcalls
7374
@@ -80,12 +81,12 @@ Modifiers
8081
8182.. cmdoption :: -f, --file=<file>
8283
83- Name of a file to accumulate counts over several tracing runs. Should be used
84- with the :option: `--count <-c> ` option.
84+ Name of a file to accumulate counts over several tracing runs. Should be
85+ used with the :option: `--count <-c> ` option.
8586
8687.. cmdoption :: -C, --coverdir=<dir>
8788
88- Directory where the report files go. The coverage report for
89+ Directory where the report files go. The coverage report for
8990 ``package.module `` is written to file :file: `{ dir } /{ package } /{ module } .cover `.
9091
9192.. cmdoption :: -m, --missing
@@ -106,7 +107,7 @@ Modifiers
106107
107108.. cmdoption :: -g, --timing
108109
109- Prefix each line with the time since the program started. Only used while
110+ Prefix each line with the time since the program started. Only used while
110111 tracing.
111112
112113Filters
@@ -118,8 +119,8 @@ These options may be repeated multiple times.
118119
119120.. cmdoption :: --ignore-module=<mod>
120121
121- Ignore each of the given module names and its submodules (if it is a package).
122- The argument can be a list of names separated by a comma.
122+ Ignore each of the given module names and its submodules (if it is a
123+ package). The argument can be a list of names separated by a comma.
123124
124125.. cmdoption :: --ignore-dir=<dir>
125126
@@ -131,56 +132,61 @@ These options may be repeated multiple times.
131132Programmatic Interface
132133----------------------
133134
134- .. class :: Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None, timing=False)
135+ .. class :: Trace(count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(),\
136+ ignoredirs=(), infile=None, outfile=None, timing=False)
135137
136- Create an object to trace execution of a single statement or expression. All
137- parameters are optional. *count * enables counting of line numbers. *trace *
138- enables line execution tracing. *countfuncs * enables listing of the functions
139- called during the run. *countcallers * enables call relationship tracking.
140- *ignoremods * is a list of modules or packages to ignore. *ignoredirs * is a list
141- of directories whose modules or packages should be ignored. *infile * is the
142- name of the file from which to read stored count information. *outfile * is
143- the name of the file in which to write updated count information. *timing *
144- enables a timestamp relative to when tracing was started to be displayed.
138+ Create an object to trace execution of a single statement or expression. All
139+ parameters are optional. *count * enables counting of line numbers. *trace *
140+ enables line execution tracing. *countfuncs * enables listing of the
141+ functions called during the run. *countcallers * enables call relationship
142+ tracking. *ignoremods * is a list of modules or packages to ignore.
143+ *ignoredirs * is a list of directories whose modules or packages should be
144+ ignored. *infile * is the name of the file from which to read stored count
145+ information. *outfile * is the name of the file in which to write updated
146+ count information. *timing * enables a timestamp relative to when tracing was
147+ started to be displayed.
145148
146- .. method :: Trace. run(cmd)
149+ .. method :: run(cmd)
147150
148- Execute the command and gather statistics from the execution with
149- the current tracing parameters.
150- * cmd * must be a string or code object, suitable for passing into :func: `exec `.
151+ Execute the command and gather statistics from the execution with
152+ the current tracing parameters. * cmd * must be a string or code object,
153+ suitable for passing into :func: `exec `.
151154
152- .. method :: Trace. runctx(cmd, globals=None, locals=None)
155+ .. method :: runctx(cmd, globals=None, locals=None)
153156
154- Execute the command and gather statistics from the execution with
155- the current tracing parameters, in the defined global and local environments.
156- If not defined, *globals * and *locals * default to empty dictionaries.
157+ Execute the command and gather statistics from the execution with the
158+ current tracing parameters, in the defined global and local
159+ environments. If not defined, *globals * and *locals * default to empty
160+ dictionaries.
157161
158- .. method :: Trace. runfunc(func, *args, **kwds)
162+ .. method :: runfunc(func, *args, **kwds)
159163
160- Call *func * with the given arguments under control of the :class: `Trace ` object
161- with the current tracing parameters.
164+ Call *func * with the given arguments under control of the :class: `Trace `
165+ object with the current tracing parameters.
162166
163- .. method :: Trace. results()
167+ .. method :: results()
164168
165- Return a :class: `CoverageResults ` object that contains the cumulative results
166- of all previous calls to ``run ``, ``runctx `` and ``runfunc `` for the given
167- :class: `Trace ` instance. Does not reset the accumulated trace results.
169+ Return a :class: `CoverageResults ` object that contains the cumulative
170+ results of all previous calls to ``run ``, ``runctx `` and ``runfunc ``
171+ for the given :class: `Trace ` instance. Does not reset the accumulated
172+ trace results.
168173
169174.. class :: CoverageResults
170175
171- A container for coverage results, created by :meth: `Trace.results `. Should not
172- be created directly by the user.
176+ A container for coverage results, created by :meth: `Trace.results `. Should
177+ not be created directly by the user.
173178
174- .. method :: CoverageResults. update(other)
179+ .. method :: update(other)
175180
176- Merge in data from another :class: `CoverageResults ` object.
181+ Merge in data from another :class: `CoverageResults ` object.
177182
178- .. method :: CoverageResults. write_results(show_missing=True, summary=False, coverdir=None)
183+ .. method :: write_results(show_missing=True, summary=False, coverdir=None)
179184
180- Write coverage results. Set *show_missing * to show lines that had no hits.
181- Set *summary * to include in the output the coverage summary per module. *coverdir *
182- specifies the directory into which the coverage result files will be output.
183- If ``None ``, the results for each source file are placed in its directory.
185+ Write coverage results. Set *show_missing * to show lines that had no
186+ hits. Set *summary * to include in the output the coverage summary per
187+ module. *coverdir * specifies the directory into which the coverage
188+ result files will be output. If ``None ``, the results for each source
189+ file are placed in its directory.
184190
185191A simple example demonstrating the use of the programmatic interface::
186192
0 commit comments