f r ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m ZddlZdZGddZdZd ZGd dZd Zd Zdd ZdZGddZdZedkr edSdS)TraceCoverageResultsN) monotonicz#pragma NO COVERceZdZddZdZdS)_IgnoreNc|stnt||_|sgn d|D|_ddi|_dS)NcLg|]!}tj|"S)ospathnormpath.0ds ,/opt/alt/python311/lib64/python3.11/trace.py z$_Ignore.__init__..Hs8*9*9*9./+-'*:*:1*=*=*9*9*9z)set_mods_dirs_ignore)selfmodulesdirss r__init__z_Ignore.__init__FsX");SUUUs7|| #9RR*9*937*9*9*9 #Q( rc\||jvr |j|S||jvr d|j|<dS|jD]'}||dzr d|j|<dS(| d|j|<dS|jD]1}||tjzr d|j|<dS2d|j|<dS)Nr.r)rr startswithrr sep)rfilename modulenamemodrs rnamesz _Ignore.namesLs  % %< + +  # #'(DL $1:  C$$S3Y// +, Z(qq   '(DL $1  A""1rv:.. +, Z(qq  $% Z qrNN)__name__ __module__ __qualname__rr$r rrrrEs7)))) )))))rrc tj|}tj|\}}|SN)r r basenamesplitext)r baser!exts r_modnamer/ws86 7  D ! !DG$$T**MHc Orc tj|}d}tjD]{}tj|}||rE|t |tjkr"t |t |kr|}||r|t |dzd}n|}tj|\}}|tjd}tj r |tj d}tj |\}}| dS)Nrr) r r normcasesysrlenr splitdrivereplacealtsepr,lstrip)r comparepathlongestdirr-driver!r.s r _fullmodnamer=~s36'""4((KGxgs##  ! !# & & ;s3xx+@BF+J+J3xx#g,,&&CLL1$%%&'$$T**KE4 << $ $D y,||BIs++G$$T**MHc ??3  rc6eZdZ d dZdZdZd dZd dZdS) rNc||_|ji|_|j|_||_|ji|_|j|_||_|ji|_|j|_||_||_|jr t|jd5}tj |\}}}dddn #1swxYwY| | |||dS#tttf$r1}td|jd|t jYd}~dSd}~wwxYwdS)Nrb)callerszSkipping counts file : file)countscopycounter calledfuncsrAinfileoutfileopenpickleloadupdate __class__OSErrorEOFError ValueErrorprintr3stderr)rrErHrIrArJferrs rrzCoverageResults.__init__s ; DK{'')) &   #!D +0022 < DL|((**   ; N N$+t,,B39;q>>0FKBBBBBBBBBBBBBBB DNN6;NPPQQQQQXz2 N N N)-cc;BE*NNNNNNNNNN N  N Ns<0D"C* D"*C..D"1C.2.D""E*9&E%%E*cX |do|dS)N<>)rendswith)rr!s ris_ignored_filenamez#CoverageResults.is_ignored_filenames0 ""3''BH,=,=c,B,BBrc |j}|j}|j}|j}|j}|j}|D]$}||d||z||<%|D]}d||<|D]}d||<dSNrr)rErHrAget) rotherrErHrA other_countsother_calledfuncs other_callerskeys rrNzCoverageResults.updates<& ,| !-  A AC **S!,,|C/@@F3KK$ ! !C K     CGCLL  rTFc t |jrRttd|j}t|D]\}}}td|d|d||jrttddx}} t|jD]o\\} } } \} }}| |kr#ttd| d| }d} | | kr| | krtd| | } td | d | d |d |pi}|jD]2\}}||ix}||<|j||f||<3i}|D]}\}}||r|d r |dd }|Ltj tj |}t|}n'|}tj|dt|}|rt!|}ni}t#j|}tj ||dz}t)|d5}t+j|j\}}dddn #1swxYwY||||||\}}|r |rt3d|z|z }||||f||<|rH|rFtdt|D]'}||\}}}}td||z(|jr t)|jd5} t7j|j|j|jf| dddddS#1swxYwYdS#t:$r)}!td|!zt<jYd}!~!dSd}!~!wwxYwdS)Nzfunctions called:z filename: z, modulename: , funcname: zcalling relationships:r1z***z -->z rz -> z.pycT)exist_okz.coverr@dzlines cov% module (path)z%5d %3d%% %s (%s)wbrz"Can't save counts files because %srC) rHrSsortedrArEr^itemsr[rZr r dirnameabspathr/makedirsr=_find_executable_linenos linecachegetlinesjoinrKtokenizedetect_encodingreadlinewrite_results_fileintrJrLdumprPr3rT)"r show_missingsummarycoverdircallsr!r"funcnamelastfile lastcfilepfilepmodpfunccfilecmodcfuncper_filelineno lines_hitsumscountr;lnotabsource coverpathfpencoding_n_hitsn_linespercentmrUrVs" r write_resultszCoverageResults.write_resultss    < GGG % & & &$E28-- < <.*h"((JJJ:<<<< < I GGG * + + +#% %Hydl++ I I<%%u';tUH$$GGG%...$H "IE>>i5&8&8'5))) %IdddEEE444GHHHH $  @ @ Hf-5\\(B-G-G GI* $ Xv,> ?If  '~~// J JOHe''11   (( )#CRC=goobgooh&?&?@@%h//  C$////)(33  1(;;'11F S*x*?@@Ih%% D&6r{CC ! D D D D D D D D D D D D D D D"55i6 M !1&&&&&&&&&&&&&&&&&&&&& S S S:S@szRRRRRRRRRR S  S SsN$J  J J *N?)M5( N5M99N<M9=N N5 N00N5c6 t|d|}n:#t$r-}td|d|dtjYd}~dSd}~wwxYwd}d} |5t |d D]\} } | |vr)|d || z| d z } |d z }n=| |vr$t| vr|d |d z }n|d || d  dddn #1swxYwY| |fS)Nwrztrace: Could not open z for writing: z - skippingrC)rrrrz%5d: z>>>>>> z ) rKrPrSr3rT enumeratewritePRAGMA_NOCOVER expandtabs) rr linesrrrrJrVrrrlines rrvz"CoverageResults.write_results_file(s5 4x888GG    E26$$=DGJ P P P P44444    2 2 )% 3 3 2 2 Y&&MM'If,="=>>>aKFqLGGv%%n.D.DMM),,,qLGGMM),,, dooa001111 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2"ws' A "AA B)D  DD)NNNNN)TFNr*)r&r'r(rr[rNrrvr rrrrs=A'+NNNN4CCC $YSYSYSYSvrcR i}tj|D]\}}||vrd||<|S)Nr)disfindlinestarts)codestrslinenosrrs r_find_lines_from_coderHsBDG'--  6   GFO Nrc t||}|jD]9}tj|r#|t ||:|Sr*)r co_constsinspectiscoderN _find_lines)rrrcs rrrRs[F#D$//G^11 >!   1 NN;q$// 0 0 0 NrcN i}tj}t||5}tj|j}|D]O\}}}} } |tjkr5|tjkr%|\} } | \} }t| | dzD]}d||<|}P dddn #1swxYwY|S)Nrr)tokenINDENTrKrsgenerate_tokensruSTRINGrange)r!rr prev_ttyperUtokttypetstrstartendrslinescolelineecolis r _find_stringsr^s AJ h * * * a&qz22-0   )E4T $$--"'KE4"%KE4"5%!)44!! !JJ                 HsA,BB!Bcl tj|5}|}|j}dddn #1swxYwYn:#t$r-}t d|d|t jicYd}~Sd}~wwxYwt||d}t||}t||S)NzNot printing coverage data for rBrCexec) rsrKreadrrPrSr3rTcompilerr)r!rUprogrrVrrs rrorousK ]8 $ $ "6688DzH " " " " " " " " " " " " " " "  !)3307:z C C C C  46 * *D 8 , ,D tT " ""s=A ? A AA AA B"A=7B=Bc`eZdZ ddZdZddZd Zd Zd Zd Z d Z dZ dZ dZ dZdS)rrrr NFc  ||_||_t|||_i|_i|_d|_||_i|_i|_ i|_ d|_ | rt|_ |r|j |_dS|r|j|_dS|r|r|j|_|j|_dS|r|j|_|j|_dS|r|j|_|j|_dSd|_dSr])rIrJrignorerEpathtobasename donothingtrace _calledfuncs_callers _caller_cache start_time_timeglobaltrace_trackcallers globaltraceglobaltrace_countfuncsglobaltrace_ltlocaltrace_trace_and_count localtracelocaltrace_tracelocaltrace_count) rrr countfuncs countcallers ignoremods ignoredirsrIrJtimings rrzTrace.__init__s "  j*55       &#ggDO  #B6~ +  t/ 0 0 0 L) * * * ) gv & & &> ) T""""4((((( ) )4> ) T""""4(((( )s B2B9cd}|jstj|j ||i|}|jstjdn!#|jstjdwwxYw|Sr*)rr3rr)rfuncargskwresults rrunfuncz Trace.runfuncs~ + L) * * * #T4&2&&F> # T"""> # T"""" # s AA&c<|j}|j}|rt|}nd}|j}d}||jvr|j| |j|}nd|j|<dt j|D}t|dkrdt j|dD}t|dkrNdt j|dD} t| dkr| dj}||j|<||d|}|||fS)Nc:g|]}tj||Sr )r isfunction)rrUs rrz1Trace.file_module_function_of..s73331#.q113Q333rrc<g|]}t|t|Sr ) isinstancerrs rrz1Trace.file_module_function_of..s6555q *1d 3 35555rrc2g|]}t|d|S) __bases__)hasattr)rrs rrz1Trace.file_module_function_of..s6???Q&-a&=&=?q???rr) f_code co_filenamer/co_namergc get_referrersr4r&) rframerr!r"r}clsnamefuncsdictsclassess rfile_module_function_ofzTrace.file_module_function_ofs_|#  !(++JJJ< 4% % %!$'3,T2'+D t $33 0 6 6333E 5zzQ55B$4U1X$>$>555u::????"*:58*D*D???G7||q((")!*"5 4;*40  ")''884HX--rc |dkr=||}||j}d|j||f<dSdSNcallr)rf_backr)rrwhyarg this_func parent_funcs rrzTrace.globaltrace_trackcallerssX  &==44U;;I66u|DDK67DM; 2 3 3 3 =rcV |dkr!||}d|j|<dSdSr)rr)rrrrrs rrzTrace.globaltrace_countfuncss?  &==44U;;I+,D i ( ( ( =rc |dkr|j}|jdd}|rZt|}|E|j||}|s*|jrtd|d|j|j SdSdSdSdS)Nr__file__z --- modulename: re) r f_globalsr^r/rr$rrSrr)rrrrrr!r" ignore_its rrzTrace.globaltrace_lts &==tj d?fd@dA|j D|_ fdB|jD|_|j r]|j s| dCt|j |j D}||j|j|jSt'|j|j|j|jgs| dE|jr#|js|jr| dF|jr|js| dG|j| dHt3|j|j|j|j|j |j|j |j |jI } |jrVddl}|j}||\} } } | jg|jt@_!dJ| j| j"| j#| ddK} n|jg|jt@_!tHj%&|jt@j%d<tOj(|j5} tS| *|jdL} dddn #1swxYwY|jdJdddM} |+| | | nL#tX$r4}tAj-dNt@j!ddO|Yd}~nd}~wt\$rYnwxYw|/}|j0s(||j|j|jdSdS)PNrz --versionversionz trace 2.0)actionrz Main optionsz(One of these (or --report) must be givenz-cz--count store_truezCount the number of times each line is executed and write the counts to .cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)rhelpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz --listfuncszKeep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz --trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits. Modifiersz-rz--reportzGenerate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz --no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)rz-Cz --coverdirzDirectory where the report files go. The coverage report for . will be written to file //.coverz-mz --missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz --summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingFilterszCan be specified multiple timesz--ignore-moduleappendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)rdefaultrz --ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).z--moduleFzTrace a module. progname?zfile to run as main program)nargsr argumentszarguments to the programstdlib platstdlibctjtj|}|dd}tj|S)Nz$prefixz $exec_prefix)r r expanduser expandvarsr6r )s _exec_prefix_prefixs rparse_ignore_dirzmain..parse_ignore_dirsa G  rw11!44 5 5 IIi ) ) 1 1., O Ow"""rcfg|].}|dD]}|/S),)splitstrip)rrr#s rrzmain..sWOOOOO:=))++OOOOrcjg|]/}|tjD] }|0Sr )r2r pathsep)rrr,r/s rrzmain..s_NNN9L9LNN45('**NNNNrz-r/--report requires -f/--file)rIrJzLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3progname is missing: required with the main options)rrrrrIrJrr)r&r  __package__ __loader____spec__ __cached__r)r r&r6r9zCannot run file z because: )1argparseArgumentParser add_argumentadd_argument_groupadd_mutually_exclusive_group REMAINDER parse_args ignore_dir sysconfigget_path ignore_modulereportrDerrorrrmissingrzr{anyrr listfuncs trackcallsr#rrmodulerunpy_get_module_detailsrr&r3argvparentloaderr r rlio open_coderrrrPexit SystemExitr no_report)r:parsergrp_grpoptsrtrL module_namemod_namemod_specrglobsrrVr-r.r/s @@@rmainr_QsQOOO  $ $ & &F  I{KKK  # #N 6 8 8CT9\&''' T9\FHHHT=EFFFT>,7888  # #K 0 0C  + + - -DdJ|    dM,GHHHT8>@@@T<2333T;|T;|=>>>T:l+,,,  # #I - / /C&x!"""^HbGHHH  </111  #.000  8+=+---     D 8$X.. ),77 ###### OO#'#5OOODNNNN $NNNDO {Py ; LL9 : : :!DIFFF$$T\4<OOO  DJH I I5 4 5 5 5 ~Q4:QQ OPPP |LDJL JKKK } JKKK dj$*?t7Ii  5 5 5A ;  LLL-K','@'@'M'M $Hh(:4>:CH& ,'&o$" EE 77CH'//$-88CHQKdm,, Arwwyy$-@@ A A A A A A A A A A A A A A A!M&#" E ue$$$$ HHH SXa[[[##FGGGGGGGG      iikkG >IdlDL$-HHHHHIIsC CT )S TSTS&T U *T== U  U rr*)__all__rQrpr r3rBrrsrrrrLtimerrrrrr/r=rrrrrorr_r&r rrrbs<( % &    #######00000000d   8llllllll\       . # # #L6L6L6L6L6L6L6L6\PIPIPId ZDFFFFFr