tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
M\¬Qc@s¸dZddlZddlZddlZddlZddlZddlZddlZddlZddl    Z    ddl
Z
yddl Z e Z Wne k
r³ddl Z nXyddlZWn#e k
réejZd„ZnXd„Zd„Zd„ZdZejdƒZd    dd
„ƒYZd „Zd „Zd dd„ƒYZd„Zd„Zd„Zd„Zddd„ƒYZd„Zdd„Z!e"dkr´e!ƒndS(sªprogram/module to trace Python program or function execution
 
Sample use, command line:
  trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
  trace.py -t --ignore-dir '$prefix' spam.py eggs
  trace.py --trackcalls spam.py eggs
 
Sample use, programmatically
  import sys
 
  # create a Trace object, telling it what to ignore, and whether to
  # do tracing or line-counting or both.
  tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], trace=0,
                    count=1)
  # run the new command using the given tracer
  tracer.run('main()')
  # make a report, placing output in /tmp
  r = tracer.results()
  r.write_results(show_missing=True, coverdir="/tmp")
iÿÿÿÿNcCstjdƒdS(N(tsystsettracetNone(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt _unsettraceHscCstj|ƒtj|ƒdS(N(t    threadingRR(tfunc((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt    _settraceKs cCstjdƒtjdƒdS(N(RRRR(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyROs cCs|jdtjdƒdS(Ns    Usage: %s [OPTIONS] <file> [ARGS]
 
Meta-options:
--help                Display this help then exit.
--version             Output version information then exit.
 
Otherwise, exactly one of the following three options must be given:
-t, --trace           Print each line to sys.stdout before it is executed.
-c, --count           Count the number of times each line is executed
                      and write the counts to <module>.cover for each
                      module executed, in the module's directory.
                      See also `--coverdir', `--file', `--no-report' below.
-l, --listfuncs       Keep track of which functions are executed at least
                      once and write the results to sys.stdout after the
                      program exits.
-T, --trackcalls      Keep track of caller/called pairs and write the
                      results to sys.stdout after the program exits.
-r, --report          Generate a report from a counts file; do not execute
                      any code.  `--file' must specify the results file to
                      read, which must have been created in a previous run
                      with `--count --file=FILE'.
 
Modifiers:
-f, --file=<file>     File to accumulate counts over several runs.
-R, --no-report       Do not generate the coverage report files.
                      Useful if you want to accumulate over several runs.
-C, --coverdir=<dir>  Directory where the report files.  The coverage
                      report for <package>.<module> is written to file
                      <dir>/<package>/<module>.cover.
-m, --missing         Annotate executable lines that were not executed
                      with '>>>>>> '.
-s, --summary         Write a brief summary on stdout for each file.
                      (Can only be used with --count or --report.)
-g, --timing          Prefix each line with the time since the program started.
                      Only used while tracing.
 
Filters, may be repeated multiple times:
--ignore-module=<mod> Ignore the given module(s) and its submodules
                      (if it is a package).  Accepts comma separated
                      list of module names
--ignore-dir=<dir>    Ignore files in the given directory (multiple
                      directories can be joined by os.pathsep).
i(twriteRtargv(toutfile((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytusageSs*s#pragma NO COVERs ^\s*(#.*)?$tIgnorecBs eZddd„Zd„ZRS(cCsM|p    g|_|pg|_ttjj|jƒ|_idd6|_dS(Nis<string>(t_modst_dirstmaptostpathtnormpatht_ignore(tselftmodulestdirs((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt__init__†scCsñ||jkr|j|Sxk|jD]`}||krGd|j|<dSt|ƒ}||| kr$||dkr$d|j|<dSq$W|dkr¥d|j|<dSx8|jD]-}|j|tjƒr¯d|j|<dSq¯Wd|j|<dS(Nit.i(RR tlenRR t
startswithRtsep(Rtfilenamet
modulenametmodtntd((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytnamess&          N(t__name__t
__module__RRR (((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR …scCs.tjj|ƒ}tjj|ƒ\}}|S(s-Return a plausible module name for the patch.(RRtbasenametsplitext(RtbaseRtext((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytmodnameºscCs tjj|ƒ}d}xotjD]d}tjj|ƒ}|j|ƒr"|t|ƒtjkr"t|ƒt|ƒkr†|}q†q"q"W|r§|t|ƒd}n|}tjj|ƒ\}}|jtjdƒ}tj    rû|jtj    dƒ}ntjj
|ƒ\}}|j dƒS(s,Return a plausible module name for the path.tiR( RRtnormcaseRRRRt
splitdrivetreplacetaltsepR$tlstrip(Rt comparepathtlongesttdirR%tdriveRR&((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt fullmodnameÁs (    tCoverageResultscBsDeZdddddd„Zd„Zeedd„Zd„ZRS(cCsA||_|jdkr$i|_n|jjƒ|_||_|jdkrZi|_n|jjƒ|_||_|jdkri|_n|jjƒ|_||_||_|jr=yDtj    t
|jdƒƒ\}}}|j |j |||ƒƒWq=t ttfk
r9}tjd|j|fIJq=XndS(NtrbsSkipping counts file %r: %s(tcountsRtcopytcountert calledfuncstcallerstinfileR    tpickletloadtopentupdatet    __class__tIOErrortEOFErrort
ValueErrorRtstderr(RR5R8R:R9R    terr((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyRÞs*                           $ 
c    Cs±|j}|j}|j}|j}|j}|j}x2|jƒD]$}|j|dƒ||||<qCWx|jƒD]}d||<qxWx|jƒD]}d||<q™WdS(s.Merge in the data from another CoverageResultsiiN(R5R8R9tkeystget(    RtotherR5R8R9t other_countstother_calledfuncst other_callerstkey((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR>øs                        "cCs¥|jrWHdGH|jjƒ}|jƒx,|D]!\}}}d|||fGHq/Wn|jrHdGH|jjƒ}|jƒd}}    x‘|D]†\\}
} } \} }}|
|kr×HdG|
GdGH|
}d}    n| |
kr|    | krdG| GH| }    nd| | ||fGHqWni}xN|jjƒD]=\}}|j|iƒ}||<|j||f||<q3Wi}x^|jƒD]P\}}|dkr¥q‡n|jd    ƒrºq‡n|jdƒrÖ|d  }n|dkrt
j j t
j j |ƒƒ}t|ƒ}n4|}t
j j|ƒs7t
j|ƒnt|ƒ}|rXt|ƒ}ni}tj|ƒ}t
j j||d ƒ}|j||||ƒ\}}|r‡|r‡d||}||||f||<q‡q‡W|r9|r9|jƒ}|jƒdGHx4|D])}||\}}}}d||GHq    Wn|jr¡y5tj|j|j|jft|jdƒdƒWq¡tk
r}tjd|IJq¡XndS(s!
        @param coverdir
        sfunctions called:s*filename: %s, modulename: %s, funcname: %sscalling relationships:R(s***s  -->s    %s.%s -> %s.%ss<string>s    <doctest s.pycs.pyoiÿÿÿÿs.coveridslines   cov%   module   (path)s%5d   %3d%%   %s   (%s)twbis"Can't save counts files because %sN(s.pycs.pyo(R8REtsortR9R5RFt    iteritemsRtendswithRRRtdirnametabspathR'texiststmakedirsR2tfind_executable_linenost    linecachetgetlinestjointwrite_results_fileR    R;tdumpR=R@RRC(Rt show_missingtsummarytcoverdirtcallsRRtfuncnametlastfilet    lastcfiletpfiletpmodtpfunctcfiletcmodtcfunctper_filetlinenot    lines_hittsumstcountR0tlnotabtsourcet    coverpathtn_hitstn_linestpercenttmodstmRD((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt write_results
s„    
    
 
%                      
     c Cs<yt|dƒ}Wn+tk
r@}tjd||fIJd    SXd}d}xØt|ƒD]Ê\}    }
|    d} | |kr¨|jd|| ƒ|d7}|d7}nbtj|
ƒrÇ|jdƒnC| |krýt||    krý|jdƒ|d7}n |jdƒ|j||    j    dƒƒqZW|j
ƒ||fS(
s'Return a coverage results file in path.tws2trace: Could not open %r for writing: %s- skippingiis%5d: s       s>>>>>> i(ii( R=R@RRCt    enumerateRtrx_blanktmatchtPRAGMA_NOCOVERt
expandtabstclose( RRtlinesRlRiR    RDRpRotitlineRh((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyRXes.
 
 
 
N(    R!R"RRR>tTruetFalseRtRX(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR3Ýs
        [cCsCi}x6tj|ƒD]%\}}||krd||<qqW|S(s:Return dict where keys are lines in the line number table.i(tdistfindlinestarts(tcodetstrstlinenost_Rh((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytfind_lines_from_code‰s
 cCsOt||ƒ}x9|jD].}tj|ƒr|jt||ƒƒqqW|S(s<Return lineno dict for all code objects reachable from code.(R‡t    co_conststinspecttiscodeR>t
find_lines(RƒR„R…tc((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR‹“s
cCs¿i}tj}t|ƒ}x“tj|jƒD]\}}}}}|tjkr§|tjkr§|\}    }
|\} } x(t|    | dƒD]} d|| <qWq§n|}q.W|jƒ|S(sÄReturn a dict of possible docstring positions.
 
    The dict maps line numbers to strings.  There is an entry for
    line that contains only a string or a part of a triple-quoted
    string.
    i(    ttokentINDENTR=ttokenizetgenerate_tokenstreadlinetSTRINGtrangeR{(RRt
prev_ttypetftttypettstrtstarttendR~tslinetscoltelinetecolR}((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt find_stringsŸs     (  
 
cCsryt|dƒjƒ}Wn+tk
rF}tjd||fIJiSXt||dƒ}t|ƒ}t||ƒS(sAReturn dict where keys are line numbers in the line number table.trUs%Not printing coverage data for %r: %stexec(R=treadR@RRCtcompileRžR‹(RtprogRDRƒR„((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyRT¶s
  tTracec
Bs•eZdddddddded„    Zd„Zddd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „ZRS(iic
 
Cs-||_||_t||ƒ|_i|_i|_i|_d|_||_i|_    i|_
i|_ d|_ |    rtjƒ|_ n|r¢|j|_n‡|r·|j|_nr|rÞ|rÞ|j|_|j|_nK|rÿ|j|_|j|_n*|r |j|_|j|_n    d|_dS(sx
        @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
        @param timing true iff timing information be displayed
        iiN(R:R    R tignoreR5tblabbedtpathtobasenamet    donothingttracet _calledfuncst_callerst _caller_cacheRt
start_timettimetglobaltrace_trackcallerst globaltracetglobaltrace_countfuncstglobaltrace_lttlocaltrace_trace_and_countt
localtracetlocaltrace_tracetlocaltrace_count(
RRkR©t
countfuncst countcallerst
ignoremodst
ignoredirsR:R    ttiming((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyRÃs8                                                cCs,ddl}|j}|j|||ƒdS(Niÿÿÿÿ(t__main__t__dict__trunctx(RtcmdR¼tdict((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytrunös     cBsl|dkri}n|dkr*i}n|jsCe|jƒnz|||UWd|jsgeƒnXdS(N(RR¨RR°R(RR¿tglobalstlocals((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR¾ûs                cOsVd}|js"tj|jƒnz|||Ž}Wd|jsQtjdƒnX|S(N(RR¨RRR°(RRtargstkwtresult((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytrunfuncs        c Csž|j}|j}|r't|ƒ}nd}|j}d}||jkrq|j|dk    rr|j|}qrnd|j|<gtj|ƒD]}tj    |ƒrŽ|^qŽ}t
|ƒdkrrgtj|dƒD]}    t |    t ƒrÕ|    ^qÕ}
t
|
ƒdkrrgtj|
dƒD]} t | dƒr| ^q} t
| ƒdkro| dj}||j|<qoqrn|dk    r‘d||f}n|||fS(Niit    __bases__s%s.%s(tf_codet co_filenameR'Rtco_nameR¬tgct get_referrersR‰t
isfunctionRt
isinstanceRÀthasattrR!( RtframeRƒRRR^tclsnameR•tfuncsRtdictsRŒtclasses((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytfile_module_function_ofs2               cCsG|dkrC|j|ƒ}|j|jƒ}d|j||f<ndS(skHandler for call events.
 
        Adds information about who called who to the self._callers dict.
        tcalliN(RÖtf_backR«(RRÑtwhytargt    this_funct parent_func((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR¯:s cCs/|dkr+|j|ƒ}d|j|<ndS(soHandler for call events.
 
        Adds (filename, modulename, funcname) to the self._calledfuncs dict.
        R×iN(RÖRª(RRÑRÙRÚRÛ((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR±Es cCs™|dkr•|j}|jjddƒ}|rŽt|ƒ}|dk    r’|jj||ƒ}|s‹|jrd||jfGHn|j    Sq’q•dSndS(s’Handler for call events.
 
        If the code block being entered is to be ignored, returns `None',
        else returns self.localtrace.
        R×t__file__s! --- modulename: %s, funcname: %sN(
RÉt    f_globalsRFRR'R¥R R©RËR´(RRÑRÙRÚRƒRRt    ignore_it((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR²Ns            cCs§|dkr |jj}|j}||f}|jj|dƒd|j|<|jrndtjƒ|jGntjj    |ƒ}d||t
j ||ƒfGn|j S(NR~iis%.2fs
%s(%d): %s( RÉRÊtf_linenoR5RFR­R®RRR#RUtgetlineR´(RRÑRÙRÚRRhRKtbname((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR³es                cCs{|dkrt|jj}|j}|jrBdtjƒ|jGntjj|ƒ}d||tj    ||ƒfGn|j
S(NR~s%.2fs
%s(%d): %s( RÉRÊRàR­R®RRR#RURáR´(RRÑRÙRÚRRhRâ((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyRµts              cCsW|dkrP|jj}|j}||f}|jj|dƒd|j|<n|jS(NR~ii(RÉRÊRàR5RFR´(RRÑRÙRÚRRhRK((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR¶s        #c
Cs1t|jd|jd|jd|jd|jƒS(NR:R    R8R9(R3R5R:R    RªR«(R((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytresults‰s        ((N(R!R"RR€RRÁR¾RÇRÖR¯R±R²R³RµR¶Rã(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyR¤Âs   1            )                            cCs2tjjdtjd|fƒtjdƒdS(Ns%s: %s
ii(RRCRRtexit(tmsg((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt    _err_exits!cCs:ddl}|dkr$tj}nyP|j|dddddddd    d
d d d dddddgƒ\}}Wn_|jk
rÕ}tjjdtjd|fƒtjjdtjdƒtjdƒnXd}d}d}d}d}    d}
g} g} d} d}t}t}t}xø|D]ð\}}|dkr`t    tj
ƒtjdƒn|dkrŒtj
jdƒtjdƒn|dks¤|dkr°t }q+n|dksÈ|dkrÔt }q+n|dksì|dkrøt }q+n|dks|d krd}q+n|d!ks4|d"kr@d}q+n|d#ksX|d$krdd}q+n|d%ks||d&krˆd}q+n|d'ks |d(kr¬|}    q+n|d)ksÄ|d*krÐd}
q+n|d+ksè|d,krô|} q+n|d-ks |d.krd}q+n|d/krWx*|j d0ƒD]}| j |jƒƒq4Wq+n|d1kr+x¯|j tjƒD]›}tjj|ƒ}|jd2tjjtjd3d4tjd5 ƒƒ}|jd6tjjtjd3d4tjd5 ƒƒ}tjj|ƒ}| j |ƒqvWq+q+q+W|r>|s1|r>td7ƒn|pY|pY|pY|pY|sitd8ƒn|r‚|r‚td9ƒn|rœ|     rœtd:ƒn|rÁt|ƒdkrÁtd;ƒn|røtd<|    d=|    ƒ}|j|
d
|d>| ƒn>|t_|d}tjj |ƒdtjd<t||d?|d@|dA| dB| d<|    d=|    d|ƒ}yft|ƒ}t|j ƒ|dCƒ}WdQXi|dD6dEdF6ddG6ddH6}|j!|||ƒWn>t"k
r÷}tdItjd|fƒnt#k
rnX|j$ƒ}|s6|j|
d
|d>| ƒndS(JNiÿÿÿÿistcrRf:d:msC:lTgthelptversionR©Rktreports    no-reportR[sfile=tmissingsignore-module=s ignore-dir=s    coverdir=t    listfuncst
trackcallsR»s%s: %s
is%Try `%s --help' for more information
s--helps    --versions
trace 2.0
s-Ts --trackcallss-ls --listfuncss-gs--timings-ts--traces-cs--counts-rs--reports-Rs --no-reports-fs--files-ms    --missings-Cs
--coverdirs-ss    --summarys--ignore-modulet,s --ignore-dirs$prefixtlibtpythonis $exec_prefixs8cannot specify both --listfuncs and (--trace or --count)sLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallss,cannot specify both --report and --no-reports--report requires a --filesmissing name of file to runR:R    R\R·R¸R¹RºR RÝR¼R!t __package__t
__cached__sCannot run file %r because: %s(%tgetoptRRRterrorRCRRäR€R
tstdoutRtsplittappendtstripRtpathsepRt
expandvarsR+RWtprefixRèt exec_prefixRRæRR3RtR¤R=R¢R¡R¾R@t
SystemExitRã(RRòtoptst    prog_argvRåR©RkRét    no_reportt counts_fileRêtignore_modulest ignore_dirsR\R[RëR¸R»topttvalRtsRãtprognametttfpRƒtglobsRD((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pytmain“sô        !                         
 
  R¼((((#t__doc__RURtreRR®RRR‰RÌRtcPickleR;t ImportErrorRRRRR
RyR¢RwR R'R2R3R‡R‹RžRTR¤RæRR
R!(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/trace.pyt<module>1sL           
                   -5        ¬    
            Í     Ÿ