Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
B

‡xJ¶©9Òã@sjdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZeeƒZgZ
dZGdd„dƒZGdd„deƒZGdd	„d	ƒZd
d„Zdd
„Zdd„Zd5dd„Zd6dd„Zd7dd„Zdd„Zdd„ZGdd„dƒZdd„Zdd „Zd!d"„ZGd#d$„d$ƒZGd%d&„d&ƒZd8d(d)„Z d9d+d,„Z!d-d.„Z"e #¡Z$e #¡Z%d/Z&d:d1d2„Z'd3d4„Z(dS);z'Control of and utilities for debugging.éN)Úisolate_modulec@sBeZdZdZdZdd„Zdd„Zdd„Zej	d	d
„ƒZ
dd„Zd
S)ÚDebugControlz!Control and output for debugging.FcCsRt|ƒt|_d|_g}| d¡r,| t¡tj|| d¡|d|_	|j	j
|_dS)z4Configure the options and output file for debugging.FÚpidÚprocess)Úshow_processÚfiltersN)ÚlistÚFORCED_DEBUGÚoptionsÚsuppress_callersÚshouldÚappendÚadd_pid_and_tidÚDebugOutputFileÚget_oneÚoutputÚoutfileÚ
raw_output)Úselfr
rr©rú/build/wlanpi-profiler-7IIg1Q/wlanpi-profiler-1.0.11/debian/wlanpi-profiler/opt/wlanpi-profiler/lib/python3.7/site-packages/coverage/debug.pyÚ__init__"s


zDebugControl.__init__cCsd|j›d|j›dS)Nz<DebugControl options=z raw_output=ú>)r
r)rrrrÚ__repr__1szDebugControl.__repr__cCs|dkr|jrdS||jkS)z@Decide whether to output debug information in category `option`.ÚcallersF)rr
)rÚoptionrrrr4szDebugControl.shouldccs$|j}d|_z
dVWd||_XdS)z;A context manager to prevent call stacks from being logged.TN)r)rÚoldrrrÚwithout_callers:s

zDebugControl.without_callerscCst|j |d¡| d¡rNt ¡ddj d¡}|dk	rN|j d|›d¡| d¡rft|jdd|j ¡dS)	zhWrite a line of debug output.

        `msg` is the line to write. A newline will be appended.

        Ú
rérNzself: r)ÚoutÚskip)	rÚwriterÚinspectÚstackÚf_localsÚgetÚdump_stack_framesÚflush)rÚmsgZcaller_selfrrrr"Ds

zDebugControl.writeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úshow_repr_attrrrrÚ
contextlibÚcontextmanagerrr"rrrrrs
rcs(eZdZdZ‡fdd„Zdd„Z‡ZS)ÚDebugControlStringz8A `DebugControl` that writes to a StringIO, for testing.cstƒ |t ¡¡dS)N)ÚsuperrÚioÚStringIO)rr
)Ú	__class__rrrVszDebugControlString.__init__cCs
|j ¡S)z,Get the output text from the `DebugControl`.)rÚgetvalue)rrrrÚ
get_outputYszDebugControlString.get_output)r*r+r,r-rr7Ú
__classcell__rr)r5rr1Tsr1c@seZdZdZdd„ZdS)ÚNoDebuggingzBA replacement for DebugControl that will never try to do anything.cCsdS)z'Should we write debug messages?  Never.Fr)rrrrrr`szNoDebugging.shouldN)r*r+r,r-rrrrrr9^sr9cCsd d|d¡S)zMake a nice header string.z
--{:-<60s}ú )Úformat)ÚlabelrrrÚinfo_headeresr=c#s¤t|ƒ}|sdSd‰t‡fdd„|Dƒƒs.t‚xp|D]h\}}|gkrHd}t|tttfƒrŒdˆ|f}x6|D]}dˆd||fVd	}qjWq4d
ˆ||fVq4WdS)z¦Produce a sequence of formatted lines from info.

    `info` is a sequence of pairs (label, data).  The produced lines are
    nicely formatted, ready to print.

    Néc3s|]\}}t|ƒˆkVqdS)N)Úlen)Ú.0ÚlÚ_)Ú	label_lenrrú	<genexpr>usz!info_formatter.<locals>.<genexpr>z-none-z%*s:z%*s %srÚz%*s: %s)rÚallÚAssertionErrorÚ
isinstanceÚsetÚtuple)Úinfor<ÚdataÚprefixÚer)rCrÚinfo_formatterjs

rOcCs2| t|ƒ¡xt|ƒD]}| d|¡qWdS)z.Write a sequence of (label,data) pairs nicely.z %sN)r"r=rO)ÚwriterÚheaderrKÚlinerrrÚwrite_formatted_info‚srScCs&t ¡||d…}d dd„|Dƒ¡S)aReturn a string summarizing the call stack.

    The string is multi-line, with one line per stack frame. Each line shows
    the function name, the file name, and the line number:

        ...
        start_import_stop : /Users/ned/coverage/trunk/tests/coveragetest.py @95
        import_local_file : /Users/ned/coverage/trunk/tests/coveragetest.py @81
        import_local_file : /Users/ned/coverage/trunk/coverage/backward.py @159
        ...

    `limit` is the number of frames to include, defaulting to all of them.

    `skip` is the number of frames to skip, so that debugging functions can
    call this and not be included in the result.

    éÿÿÿÿrcss(|] }d|d|d|dfVqdS)z%30s : %s:%déréNr)r@ÚtrrrrDœszshort_stack.<locals>.<genexpr>)r#r$Újoin)Úlimitr!r$rrrÚshort_stack‰srZcCs.|ptj}| t||dd¡| d¡dS)z:Print a summary of the stack to stdout, or someplace else.r)rYr!rN)ÚsysÚstdoutr"rZ)rYr r!rrrr'Ÿs
r'é2cCst ¡}||_| |¡S)z(`repr(text)`, but limited to `numchars`.)ÚreprlibÚReprÚ	maxstringÚrepr)ÚtextÚnumcharsÚrrrrÚclipped_repr¦srecCs.d}x tdddƒD]}|||?N}qW|d@S)z-Given a 64-bit id, make a shorter 16-bit one.ré@éiÿÿ)Úrange)Zid64Zid16ÚoffsetrrrÚshort_id­srjcCs.tt ¡ƒd›}t ¡d›d|›d|›}|S)z.A filter to add pid and tid to debug messages.Z04xZ5dÚ.z: )rjÚ_threadÚ	get_identÚosÚgetpid)rbÚtidrrrrµsrc@s eZdZdZddgZdd„ZdS)ÚSimpleReprMixinz'A mixin implementing a simple __repr__.Úsimple_repr_ignorez$coverage.object_idcs@‡fdd„ˆj ¡Dƒ}djˆjjtˆƒd dd„|Dƒ¡dS)Nc3s8|]0\}}t|ddƒrt|ƒs|ˆjkr||fVqdS)r.TN)ÚgetattrÚcallablerr)r@ÚkÚv)rrrrDÃsz+SimpleReprMixin.__repr__.<locals>.<genexpr>z<{klass} @0x{id:x} {attrs}>r:css |]\}}|›d|›VqdS)ú=Nr)r@rurvrrrrDËs)ÚklassÚidÚattrs)Ú__dict__Úitemsr;r5r*ryrX)rZ
show_attrsr)rrrÁs
zSimpleReprMixin.__repr__N)r*r+r,r-rrrrrrrrq½srqcCsjt|tƒrdd„| ¡DƒSt|ttfƒr@t|ƒdd„|DƒƒSt|dƒrbtdd„|j ¡DƒƒS|SdS)z>Turn things which are nearly dict/list/etc into dict/list/etc.cSsi|]\}}t|ƒ|“qSr)Úsimplify)r@ruÚvvrrrú
<dictcomp>Òszsimplify.<locals>.<dictcomp>css|]}t|ƒVqdS)N)r})r@r~rrrrDÔszsimplify.<locals>.<genexpr>r{cSsi|]\}}|d|“qS)rkr)r@rurvrrrrÖsN)	rHÚdictr|rrJÚtypeÚhasattrr}r{)rvrrrr}Ïs

r}cCst t|ƒ¡dS)zEDebug helper to pretty-print data, including SimpleNamespace objects.N)Úpprintr})rvrrrÚppÛsr„cCsd| ¡}|t|ƒd…}|}x>|D]6}g}x"| ¡D]}| ||ƒ ¡¡q4Wd |¡}q"W||S)zëRun `text` through a series of filters.

    `filters` is a list of functions. Each takes a string and returns a
    string.  Each is run in turn.

    Returns: the final string that results after all of the filters have
    run.

    Nr)Úrstripr?Ú
splitlinesÚextendrX)rbrZ
clean_textÚendingÚfnÚlinesrRrrrÚfilter_textás

r‹c@s eZdZdZdd„Zdd„ZdS)Ú
CwdTrackerz*A class to add cwd info to debug messages.cCs
d|_dS)N)Úcwd)rrrrrøszCwdTracker.__init__cCs,t ¡}||jkr(d|›d|}||_|S)z#Add a cwd message for each new cwd.zcwd is now r)rnÚgetcwdr)rrbrrrrÚfilterûs

zCwdTracker.filterN)r*r+r,r-rrrrrrrŒösrŒc@s:eZdZdZdd„ZdZedd	d
„ƒZdd„Zd
d„Z	dS)rz9A file-like object that includes pid and cwd information.cCsˆ||_||_t|ƒ|_|jr„|j dtƒj¡| dtj	›d¡| d 
ttddƒ¡¡tt
dƒr„| dt
 ¡›dt
 ¡›d¡dS)	NrzNew process: executable: rzNew process: cmd: {!r}
ÚargvÚgetppidzNew process: pid: z, parent pid: )rrrrÚinsertrŒrr"r[Ú
executabler;rsr‚rnror‘)rrrrrrrrs

zDebugOutputFile.__init__z'$coverage.debug.DebugOutputFile.the_oneNTrFcCs”|dk	r||||ƒStj |jd¡\}}|dks4|r|dkrttj dt¡}|dkr^tt|ƒ}n|rnt|dƒ}ntj	}||||ƒ}||ftj|j<|S)a\Get a DebugOutputFile.

        If `fileobj` is provided, then a new DebugOutputFile is made with it.

        If `fileobj` isn't provided, then a file is chosen
        (COVERAGE_DEBUG_FILE, or stderr), and a process-wide singleton
        DebugOutputFile is made.

        `show_process` controls whether the debug file adds process-level
        information, and filters is a list of other message filters to apply.

        `filters` are the text filters to apply to the stream to annotate with
        pids, etc.

        If `interim` is true, then a future `get_one` can replace this one.

        N)NTZCOVERAGE_DEBUG_FILE)r\ÚstderrÚa)
r[Úmodulesr&ÚSYS_MOD_NAMErnÚenvironÚFORCED_DEBUG_FILErsÚopenr”)ÚclsÚfileobjrrÚinterimZthe_oneZ
is_interimZdebug_file_namerrrrszDebugOutputFile.get_onecCs"|j t||jƒ¡|j ¡dS)z9Just like file.write, but filter through all our filters.N)rr"r‹rr()rrbrrrr"=szDebugOutputFile.writecCs|j ¡dS)zFlush our file.N)rr()rrrrr(BszDebugOutputFile.flush)NTrF)
r*r+r,r-rr—Úclassmethodrr"r(rrrrrs(rFcCs.tjdd}| |d¡|r*t|dddS)z.Write a log message as forcefully as possible.T)rrr)r r!N)rrr"r')r)r$r rrrÚlogGsrŸrcs‡‡‡fdd„}|S)z2A class decorator to apply a decorator to methods.cs^xXt |tj¡D]F\}}||jkr$q|dkr<ˆs<| d¡r<q|ˆkrFqt||ˆ|ƒƒqW|S)NrrB)r#Ú
getmembersÚ	isroutiner{Ú
startswithÚsetattr)r›ÚnameÚmeth)ÚbutnotÚ	decoratorÚprivaterrÚ
_decoratorQs
z$decorate_methods.<locals>._decoratorr)r§r¦r¨r©r)r¦r§r¨rÚdecorate_methodsOsrªcst ˆ¡‡fdd„ƒ}|S)z;A function decorator to stop in the debugger for each call.cs"ddl}tjt_| ¡ˆ||ŽS)Nr)Úpudbr[Ú
__stdout__r\Ú	set_trace)ÚargsÚkwargsr«)ÚfuncrrÚ_wrapperaszbreak_in_pudb.<locals>._wrapper)Ú	functoolsÚwraps)r°r±r)r°rÚ
break_in_pudb_sr´z$coverage.object_idTcs‡‡‡fdd„}|S)z:A method decorator to debug-log each call to the function.cs t ˆ¡‡‡‡‡fdd„ƒ}|S)Nc
sHt|tdƒ}|dkr:t ¡d›dttƒd›}t|t|ƒd}ˆršd tt	|ƒ¡}d dd„| 
¡Dƒ¡}|d7}||7}|rŠ|rŠ|d7}||7}|d	7}ˆrÄ|d
7}|d dd„tƒ ¡Dƒ¡7}tt
ƒ}|›d|d›dˆj›|›d
}tjdd |¡ˆ|f|ž|Ž}	ˆrD|›d|d›dˆj›d|	›d
}tjdd |¡|	S)NZ08dr:Z04drEz, css|]}dj|ŽVqdS)z{}={!r}N)r;)r@ÚitemrrrrDzszCshow_calls.<locals>._decorator.<locals>._wrapper.<locals>.<genexpr>ú(ú)z @ z; css|]}t|ƒVqdS)N)Ú_clean_stack_line)r@rArrrrDƒsrT)rz return )rsÚOBJ_ID_ATTRrnroÚnextÚOBJ_IDSr£rXÚmaprar|rZr†ÚCALLSr*rrr")
rr®r¯ÚoidÚextraZeargsZekwargsZcallidr)Úret)r°Ú	show_argsÚshow_returnÚ
show_stackrrr±qs2 z0show_calls.<locals>._decorator.<locals>._wrapper)r²r³)r°r±)rÁrÂrÃ)r°rr©pszshow_calls.<locals>._decoratorr)rÁrÃrÂr©r)rÁrÂrÃrÚ
show_callsnsrÄcCsP| ¡}| tj t¡dd¡}| tj tj¡dd¡}| tjdd¡}|S)z6Simplify some paths in a stack trace, for compactness.ú/rE)ÚstripÚreplacernÚpathÚdirnameÚ__file__r[rM)Úsrrrr¸s
r¸)Nr)NNr)r])F)rF)TFF))r-r/r²r#r3Ú	itertoolsrnrƒr^r[rlZ
coverage.miscrr	r™rr1r9r=rOrSrZr'rerjrrqr}r„r‹rŒrrŸrªr´Úcountr»r½r¹rÄr¸rrrrÚ<module>sN7



C


"