HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.7/__pycache__/inspect.cpython-37.pyc
B

{ao@sdZdZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlmZddlmZmZeZx"ejD]\ZZeede<qWdZdd	Zd
dZ dd
Z!ddZ"ddZ#e$edrddZ%nddZ%e$edr.ddZ&nddZ&ddZ'ddZ(ddZ)d d!Z*d"d#Z+d$d%Z,d&d'Z-d(d)Z.d*d+Z/d,d-Z0d.d/Z1d0d1Z2d2d3Z3d4d5Z4dd6d7Z5ed8d9Z6d:d;Z7d<d=Z8dd>d?d@Z9dAdBZ:dCdDZ;dEdFZ<dGdHZ=dIdJZ>dKdLZ?dMdNZ@dOdPZAddQdRZBiZCiZDddSdTZEdUdVZFdWdXZGGdYdZdZeHZIGd[d\d\ZJd]d^ZKd_d`ZLdadbZMdcddZNddfdgZOedhdiZPdjdkZQdldmZRedndoZSdpdqZTedrdsZUdtduZVedvdwZWdxdyZXddzd{ZYd|d}ZZdddd~iie[ddddddddeYfddZ\e[ddddddfddZ]ddZ^ddZ_ddZ`eddZaddZbeddZcdddZdddZeeddecjfZgdddZhdddZiddZjdddZkdddZlemZnddZoddZpddZqddZrddZsenfddZtdZudZvdZwdZxddZyddZzdZ{dZ|dZ}dZ~ddZddÄZeejZeejZeejdZeeeejfZddƄZdddȄZddʄZdd̄Zdd΄ZddЄZdd҄ZdddՄZdddׄZddلZdddڜdd܄ZGddބdރZGdddZGdddejZejZejZejZejZejZededededediZejZGdddZGdddZGdddZddddZddZedkredS(aGet useful information from live Python objects.

This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.

Here are some of the useful functions provided by this module:

    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
        isroutine() - check object types
    getmembers() - get members of an object that satisfy a given condition

    getfile(), getsourcefile(), getsource() - find an object's source code
    getdoc(), getcomments() - get documentation on an object
    getmodule() - determine the module that an object came from
    getclasstree() - arrange classes so as to represent their hierarchy

    getargvalues(), getcallargs() - get info about function arguments
    getfullargspec() - same, with support for Python 3 features
    formatargvalues() - format an argument spec
    getouterframes(), getinnerframes() - get info about frames
    currentframe() - get the current stack frame
    stack(), trace() - get info about frames on the stack or in a traceback

    signature() - get a Signature object for the callable
)zKa-Ping Yee <ping@lfw.org>z'Yury Selivanov <yselivanov@sprymix.com>N)
attrgetter)
namedtupleOrderedDictZCO_icCst|tjS)zReturn true if the object is a module.

    Module objects provide these attributes:
        __cached__      pathname to byte compiled file
        __doc__         documentation string
        __file__        filename (missing for built-in modules))
isinstancetypes
ModuleType)objectr	/usr/lib/python3.7/inspect.pyismodule?srcCs
t|tS)zReturn true if the object is a class.

    Class objects provide these attributes:
        __doc__         documentation string
        __module__      name of module in which this class was defined)rtype)rr	r	r
isclassHsr
cCst|tjS)a_Return true if the object is an instance method.

    Instance method objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this method was defined
        __func__        function object containing implementation of method
        __self__        instance to which this method is bound)rr
MethodType)rr	r	r
ismethodPsrcCs:t|st|st|rdSt|}t|do8t|dS)aReturn true if the object is a method descriptor.

    But not if ismethod() or isclass() or isfunction() are true.

    This is new in Python 2.2, and, for example, is true of int.__add__.
    An object passing this test has a __get__ attribute but not a __set__
    attribute, but beyond that the set of attributes varies.  __name__ is
    usually sensible, and __doc__ often is.

    Methods implemented via descriptors that also pass one of the other
    tests return false from the ismethoddescriptor() test, simply because
    the other tests promise more -- you can, e.g., count on having the
    __func__ attribute (etc) when an object passes ismethod().F__get____set__)r
r
isfunctionrhasattr)rtpr	r	r
ismethoddescriptorZsrcCs8t|st|st|rdSt|}t|do6t|dS)aReturn true if the object is a data descriptor.

    Data descriptors have both a __get__ and a __set__ attribute.  Examples are
    properties (defined in Python) and getsets and members (defined in C).
    Typically, data descriptors will also have __name__ and __doc__ attributes
    (properties, getsets, and members have both of these attributes), but this
    is not guaranteed.Frr)r
rrrr)rrr	r	r
isdatadescriptornsrMemberDescriptorTypecCst|tjS)zReturn true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.)rrr)rr	r	r
ismemberdescriptor~srcCsdS)zReturn true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.Fr	)rr	r	r
rsGetSetDescriptorTypecCst|tjS)zReturn true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.)rrr)rr	r	r
isgetsetdescriptorsrcCsdS)zReturn true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.Fr	)rr	r	r
rscCst|tjS)a(Return true if the object is a user-defined function.

    Function objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this function was defined
        __code__        code object containing compiled function bytecode
        __defaults__    tuple of any default values for arguments
        __globals__     global namespace in which this function was defined
        __annotations__ dict of parameter annotations
        __kwdefaults__  dict of keyword only parameters with defaults)rrFunctionType)rr	r	r
rsrcCs tt|st|o|jjt@S)zReturn true if the object is a user-defined generator function.

    Generator function objects provide the same attributes as functions.
    See help(isfunction) for a list of attributes.)boolrr__code__co_flagsZCO_GENERATOR)rr	r	r
isgeneratorfunctionsrcCs tt|st|o|jjt@S)zuReturn true if the object is a coroutine function.

    Coroutine functions are defined with "async def" syntax.
    )rrrrrZCO_COROUTINE)rr	r	r
iscoroutinefunctionsr cCs tt|st|o|jjt@S)zReturn true if the object is an asynchronous generator function.

    Asynchronous generator functions are defined with "async def"
    syntax and have "yield" expressions in their body.
    )rrrrrZCO_ASYNC_GENERATOR)rr	r	r
isasyncgenfunctionsr!cCst|tjS)z7Return true if the object is an asynchronous generator.)rrAsyncGeneratorType)rr	r	r

isasyncgensr#cCst|tjS)aReturn true if the object is a generator.

    Generator objects provide these attributes:
        __iter__        defined to support iteration over container
        close           raises a new GeneratorExit exception inside the
                        generator to terminate the iteration
        gi_code         code object
        gi_frame        frame object or possibly None once the generator has
                        been exhausted
        gi_running      set to 1 when generator is executing, 0 otherwise
        next            return the next item from the container
        send            resumes the generator and "sends" a value that becomes
                        the result of the current yield-expression
        throw           used to raise an exception inside the generator)rr
GeneratorType)rr	r	r
isgeneratorsr%cCst|tjS)z)Return true if the object is a coroutine.)rr
CoroutineType)rr	r	r
iscoroutinesr'cCs6t|tjp4t|tjr(t|jjt@p4t|tj	j
S)z?Return true if object can be passed to an ``await`` expression.)rrr&r$rgi_coderZCO_ITERABLE_COROUTINEcollectionsabc	Awaitable)rr	r	r
isawaitablesr,cCst|tjS)abReturn true if the object is a traceback.

    Traceback objects provide these attributes:
        tb_frame        frame object at this level
        tb_lasti        index of last attempted instruction in bytecode
        tb_lineno       current line number in Python source code
        tb_next         next inner traceback object (called by this level))rr
TracebackType)rr	r	r
istracebacksr.cCst|tjS)a`Return true if the object is a frame object.

    Frame objects provide these attributes:
        f_back          next outer frame object (this frame's caller)
        f_builtins      built-in namespace seen by this frame
        f_code          code object being executed in this frame
        f_globals       global namespace seen by this frame
        f_lasti         index of last attempted instruction in bytecode
        f_lineno        current line number in Python source code
        f_locals        local namespace seen by this frame
        f_trace         tracing function for this frame, or None)rr	FrameType)rr	r	r
isframesr0cCst|tjS)aEReturn true if the object is a code object.

    Code objects provide these attributes:
        co_argcount         number of arguments (not including *, ** args
                            or keyword only arguments)
        co_code             string of raw compiled bytecode
        co_cellvars         tuple of names of cell variables
        co_consts           tuple of constants used in the bytecode
        co_filename         name of file in which this code object was created
        co_firstlineno      number of first line in Python source code
        co_flags            bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
                            | 16=nested | 32=generator | 64=nofree | 128=coroutine
                            | 256=iterable_coroutine | 512=async_generator
        co_freevars         tuple of names of free variables
        co_kwonlyargcount   number of keyword only arguments (not including ** arg)
        co_lnotab           encoded mapping of line numbers to bytecode indices
        co_name             name with which this code object was defined
        co_names            tuple of names of local variables
        co_nlocals          number of local variables
        co_stacksize        virtual machine stack space required
        co_varnames         tuple of names of arguments and local variables)rrCodeType)rr	r	r
iscodesr2cCst|tjS)a,Return true if the object is a built-in function or method.

    Built-in functions and methods provide these attributes:
        __doc__         documentation string
        __name__        original name of this function or method
        __self__        instance to which a method is bound, or None)rrBuiltinFunctionType)rr	r	r
	isbuiltinsr4cCs t|pt|pt|pt|S)z<Return true if the object is any kind of function or method.)r4rrr)rr	r	r
	isroutinesr5cCst|tsdS|jt@rdStt|tjs0dSt|dr>dSx&|j	D]\}}t
|ddrJdSqJWx@|jD]6}x0t
|ddD] }t
||d}t
|ddrdSqWqnWdS)z:Return true if the object is an abstract base class (ABC).FT__abstractmethods____isabstractmethod__r	N)rr	__flags__TPFLAGS_IS_ABSTRACT
issubclassr*ABCMetar__dict__itemsgetattr	__bases__)rnamevaluebaser	r	r

isabstract$s"


rCc	Cs$t|r|ft|}nd}g}t}t|}yBx<|jD]2}x,|jD]\}}t|tj	rH|
|qHWq8WWntk
rYnXx|D]}	yt||	}
|	|krtWn:tk
rx$|D]}|	|jkr|j|	}
PqWwYnX|r||
r|
|	|
f|
|	qW|jddd|S)zReturn all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.r	cSs|dS)Nrr	)Zpairr	r	r
<lambda>ezgetmembers.<locals>.<lambda>)key)r
getmrosetdirr?r<r=rrDynamicClassAttributeappendAttributeErrorr>addsort)rZ	predicatemroresults	processednamesrBkvrFrAr	r	r

getmembers<s:




rU	Attributezname kind defining_class objectcCsht|}tt|}tdd|D}|f|}||}t|}x:|D]2}x,|jD]\}}t|tjrV|	|qVWqFWg}	t
}
x|D]}d}d}
d}||
kry|dkrtdt||}
Wn"tk
r}zWdd}~XYnXt|
d|}||krd}d}x(|D] }t||d}||
kr|}qWxH|D]@}y|
||}Wntk
rhw:YnX||
kr:|}q:W|dk	r|}x4|D],}||jkr|j|}||kr|}PqW|dkrq|
dk	r|
n|}t|ttjfrd}|}nFt|ttjfrd}|}n*t|tr.d	}|}nt|r>d
}nd}|		t|||||
|qW|	S)aNReturn list of attribute-descriptor tuples.

    For each name in dir(cls), the return list contains a 4-tuple
    with these elements:

        0. The name (a string).

        1. The kind of attribute this is, one of these strings:
               'class method'    created via classmethod()
               'static method'   created via staticmethod()
               'property'        created via property()
               'method'          any other flavor of method or descriptor
               'data'            not a method

        2. The class which defined this attribute (a class).

        3. The object as obtained by calling getattr; if this fails, or if the
           resulting object does not live anywhere in the class' mro (including
           metaclasses) then the object is looked up in the defining class's
           dict (found by walking the mro).

    If one of the items in dir(cls) is stored in the metaclass it will now
    be discovered and not have None be listed as the class in which it was
    defined.  Any items whose home class cannot be discovered are skipped.
    css|]}|ttfkr|VqdS)N)rr).0clsr	r	r
	<genexpr>sz'classify_class_attrs.<locals>.<genexpr>Nr<z)__dict__ is special, don't want the proxy__objclass__z
static methodzclass methodpropertymethoddata)rGrtuplerIr<r=rrrJrKrH	Exceptionr>__getattr__rLstaticmethodBuiltinMethodTypeclassmethodClassMethodDescriptorTyper[r5rVrM)rXrOZmetamroZclass_basesZ	all_basesrRrBrSrTresultrQr@ZhomeclsZget_objZdict_objexcZlast_clsZsrch_clsZsrch_objobjkindr	r	r
classify_class_attrsjs

















ricCs|jS)zHReturn tuple of base classes (including cls) in method resolution order.)__mro__)rXr	r	r
rGsrG)stopcsdkrdd}nfdd}|}t||i}t}xD||rz|j}t|}||ksbt||krptd||||<q8W|S)anGet the object wrapped by *func*.

   Follows the chain of :attr:`__wrapped__` attributes returning the last
   object in the chain.

   *stop* is an optional callback accepting an object in the wrapper chain
   as its sole argument that allows the unwrapping to be terminated early if
   the callback returns a true value. If the callback never returns a true
   value, the last object in the chain is returned as usual. For example,
   :func:`signature` uses this to stop unwrapping if any object in the
   chain has a ``__signature__`` attribute defined.

   :exc:`ValueError` is raised if a cycle is encountered.

    NcSs
t|dS)N__wrapped__)r)fr	r	r
_is_wrapperszunwrap.<locals>._is_wrappercst|do|S)Nrl)r)rm)rkr	r
rnsz!wrapper loop when unwrapping {!r})idsysgetrecursionlimitrllen
ValueErrorformat)funcrkrnrmZmemoZrecursion_limitZid_funcr	)rkr
unwraps

rvcCs|}t|t|S)zBReturn the indent size, in spaces, at the start of a line of text.)
expandtabsrrlstrip)lineZexpliner	r	r

indentsizesrzcCsRtj|j}|dkrdSx&|jdddD]}t||}q0Wt|sNdS|S)N.)rpmodulesget
__module____qualname__splitr>r
)rurXr@r	r	r

_findclass
src	Cst|rRxD|jD]:}|tk	ry
|j}Wntk
r<wYnX|dk	r|SqWdSt|r|jj}|j}t|rt	t	||dd|jkr|}n|j
}nt|r|j}t|}|dkst	|||k	rdSnt
|r|j}|j}t|r|jd||jkr|}n|j
}nzt|trL|j}|j}t|}|dksFt	|||k	rdSn:t|s`t|r|j}|j}t	|||k	rdSndSxJ|jD]@}yt	||j}Wntk
rwYnX|dk	r|SqWdS)N__func__r{)r
rjr__doc__rLrr__name____self__r>	__class__rrr4rrr[fgetrrrZ)rgrBdocr@selfrXrur	r	r
_finddocsb





rc	Csdy
|j}Wntk
rdSX|dkrNyt|}Wnttfk
rLdSXt|ts\dSt|S)zGet the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N)rrLr	TypeErrorrstrcleandoc)rrr	r	r
getdocRs

rcCsy|d}Wntk
r&dSXtj}x:|ddD]*}t|}|r<t||}t||}q<W|r~|d|d<|tjkrx*tdt|D]}|||d||<qWx|r|ds|	qWx|r|ds|	dqWd
|SdS)zClean up indentation from docstrings.

    Any whitespace that can be uniformly removed from the second line
    onwards is removed.
Nrr|)rwrUnicodeErrorrpmaxsizerrrxminrangepopjoin)rlinesZmarginryZcontentindentir	r	r
res(
rcCst|r(t|ddr|jStd|t|rht|drZtj	|j
}t|ddrZ|jStd|t|rv|j}t
|r|j}t|r|j}t|r|j}t|r|jStdt|jdS)z@Work out which source or compiled file an object was defined in.__file__Nz{!r} is a built-in modulerz{!r} is a built-in classzVmodule, class, method, function, traceback, frame, or code object was expected, got {})rr>rrrtr
rrpr}r~rrrrrr.tb_framer0f_coder2co_filenamerr)rr	r	r
getfiles,
rcCsTtj|}ddtjD}|x&|D]\}}||r.|d|Sq.WdS)z1Return the module name for a given file, or None.cSsg|]}t||fqSr	)rr)rWsuffixr	r	r

<listcomp>sz!getmodulename.<locals>.<listcomp>N)ospathbasename	importlib	machineryall_suffixesrNendswith)rZfnamesuffixesZneglenrr	r	r

getmodulenames
rcst|tjjdd}|tjjdd7}tfdd|Dr`tjdtjj	dntfddtjj
Dr~dStjrStt
|dddk	rStjkrSdS)zReturn the filename that can be used to locate an object's source.
    Return None if no way can be identified to get the source.
    Nc3s|]}|VqdS)N)r)rWs)filenamer	r
rYsz getsourcefile.<locals>.<genexpr>rc3s|]}|VqdS)N)r)rWr)rr	r
rYs
__loader__)rrrDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESanyrrsplitextSOURCE_SUFFIXESEXTENSION_SUFFIXESexistsr>	getmodule	linecachecache)rZall_bytecode_suffixesr	)rr

getsourcefiles
rcCs,|dkrt|pt|}tjtj|S)zReturn an absolute path to the source or compiled file for an object.

    The idea is for each object to have a unique origin, so this routine
    normalizes the result as much as possible.N)rrrrnormcaseabspath)r	_filenamer	r	r

getabsfilesrc
Cst|r|St|dr$tj|jS|dk	rD|tkrDtjt|Syt||}Wntk
rfdSX|tkrtjt|Sxnt	tj
D]\\}}t|rt|dr|j}|t|dkrq|t|<t|}|j
t|<ttj|<qW|tkr
tjt|Stjd}t|ds$dSt||j
rLt||j
}||krL|Stjd}t||j
r~t||j
}	|	|kr~|SdS)zAReturn the module an object was defined in, or None if not found.rNr__main__rbuiltins)rrrpr}r~r
modulesbyfilerrlistr=r_filesbymodnamerrrrealpathr>)
rrfilemodnamemodulermmainZ
mainobjectZbuiltinZ
builtinobjectr	r	r
rsD





rc
Cst|}|rt|n$t|}|dr4|ds<tdt||}|rZt||j	}n
t|}|sptdt
|r|dfSt|r |j}t
d|d}g}xRtt|D]B}|||}|r||ddkr||fS||d	|fqW|r|||dd	fStd
t|r0|j}t|r@|j}t|rP|j}t|r`|j}t|rt|ds~td|jd	}	t
d
}x*|	dkr|||	rP|	d	}	qW||	fStddS)abReturn the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An OSError
    is raised if the source code cannot be retrieved.<>zsource code not availablezcould not get source coderz^(\s*)class\s*z\bcrzcould not find class definitionco_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zcould not find code objectN) rr
checkcacher
startswithrOSErrorrgetlinesr<rr
rrecompilerrrmatchrKgrouprNrrrrr.rr0rr2rr)
rrrrr@ZpatZ
candidatesrrlnumr	r	r

findsources^









rc	Cs>yt|\}}Wnttfk
r(dSXt|rd}|rR|ddddkrRd}x(|t|krz||dkrz|d}qTW|t|kr||dddkrg}|}x>|t|kr||dddkr||||d}qWd|SnH|dkr:t	||}|d}|dkr:||
dddkr:t	|||kr:||
g}|dkr|d}||
}x\|dddkrt	|||kr|g|dd<|d}|dkrP||
}q|Wx*|r|ddkrg|dd<qWx*|r.|d	dkr.g|d	d<qWd|SdS)
zwGet lines of comments immediately preceding an object's source code.

    Returns None when source can't be found.
    Nrz#!r)#rrr|)rrrrrrstriprKrwrrzrx)rrrstartZcommentsendrcommentr	r	r
getcommentsAsJ "
$
&
rc@seZdZdS)
EndOfBlockN)rrrr	r	r	r
rnsrc@s eZdZdZddZddZdS)BlockFinderz@Provide a tokeneater() method to detect the end of a code block.cCs.d|_d|_d|_d|_d|_d|_d|_dS)NrFr)rislambdastartedpasslineindecoratordecoratorhasargslast)rr	r	r
__init__rszBlockFinder.__init__cCs|js@|js@|dkrd|_n|dkr8|dkr2d|_d|_d|_n|dkrV|jrTd|_n|dkrr|jrpd|_d|_n|tjkrd|_|d|_|jrt|jr|jsd|_nn|jrnf|tj	kr|j
d	|_
d|_nH|tjkr|j
d	|_
|j
dkrtn"|j
dkr|tjtj
fkrtdS)
N@T)defclasslambdar()Frr)rrrrrtokenizeNEWLINErrINDENTrDEDENTCOMMENTNL)rrtokenZsrowcolZerowcolryr	r	r

tokeneater{sB




zBlockFinder.tokeneaterN)rrrrrrr	r	r	r
rps	rc	CsZt}y,tt|j}x|D]}|j|qWWnttfk
rJYnX|d|jS)z@Extract the block of code at the top of the given list of lines.N)	rrgenerate_tokensiter__next__rrIndentationErrorr)rZblockfindertokensZ_tokenr	r	r
getblocks
rcCsbt|}t|\}}t|r"|j}t|s>t|rF|jjdkrF|dfSt||d|dfSdS)aReturn a list of source lines and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of the lines
    corresponding to the object and the line number indicates where in the
    original source file the first line of code was found.  An OSError is
    raised if the source code cannot be retrieved.z<module>rNr)	rvrr.rrr0rco_namer)rrrr	r	r
getsourcelinessrcCst|\}}d|S)aReturn the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    OSError is raised if the source code cannot be retrieved.r)rr)rrrr	r	r
	getsourcesrcCsVg}|jtdddx:|D]2}|||jf||kr|t||||qW|S)z-Recursive helper function for getclasstree().rr)rF)rNrrKr?walktree)classeschildrenparentrPrr	r	r
rs
rFcCsi}g}xn|D]f}|jrbxZ|jD]<}||kr4g||<|||krN||||r ||kr Pq Wq||kr||qWx|D]}||kr~||q~Wt||dS)aArrange the given list of classes into a hierarchy of nested lists.

    Where a nested list appears, it contains classes derived from the class
    whose entry immediately precedes the list.  Each entry is a 2-tuple
    containing a class and a tuple of its base classes.  If the 'unique'
    argument is true, exactly one entry appears in the returned structure
    for each class in the given list.  Otherwise, classes using multiple
    inheritance and their descendants will appear multiple times.N)r?rKr)runiquerrootsrrr	r	r
getclasstrees"	

r	Argumentszargs, varargs, varkwcCs t|\}}}}t||||S)aGet information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where
    'args' is the list of argument names. Keyword-only arguments are
    appended. 'varargs' and 'varkw' are the names of the * and **
    arguments or None.)_getfullargsr)coargsvarargs
kwonlyargsvarkwr	r	r
getargssrc	Cst|std||j}|j}|j}t|d|}t||||}d}||7}d}|jt@rx|j|}|d}d}|jt	@r|j|}||||fS)aGet information about the arguments accepted by a code object.

    Four things are returned: (args, varargs, kwonlyargs, varkw), where
    'args' and 'kwonlyargs' are lists of argument names, and 'varargs'
    and 'varkw' are the names of the * and ** arguments or None.z{!r} is not a code objectNrr)
r2rrtco_argcountco_varnamesco_kwonlyargcountrr
CO_VARARGSCO_VARKEYWORDS)	rnargsrRZnkwargsrr	steprr
r	r	r
rs"



rArgSpeczargs varargs keywords defaultscCsDtjdtddt|\}}}}}}}|s.|r6tdt||||S)aeGet the names and default values of a function's parameters.

    A tuple of four things is returned: (args, varargs, keywords, defaults).
    'args' is a list of the argument names, including keyword-only argument names.
    'varargs' and 'keywords' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.

    This function is deprecated, as it does not support annotations or
    keyword-only parameters and will raise ValueError if either is present
    on the supplied callable.

    For a more structured introspection API, use inspect.signature() instead.

    Alternatively, use getfullargspec() for an API with a similar namedtuple
    based interface, but full support for annotations and keyword-only
    parameters.

    Deprecated since Python 3.5, use `inspect.getfullargspec()`.
    zhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r)
stacklevelzdFunction has keyword-only parameters or annotations, use getfullargspec() API which can support them)warningswarnDeprecationWarninggetfullargspecrsr)rurrr
defaultsr	kwonlydefaultsannr	r	r

getargspec s
rFullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc

Cs`yt|ddtd}Wn,tk
r@}ztd|Wdd}~XYnXg}d}d}g}d}i}d}i}	|j|jk	rx|j|d<x|jD]}
|
j}|
j	}|t
kr||nv|tkr|||
j
|
jk	r||
j
f7}nJ|tkr|}n<|tkr|||
j
|
jk	r|
j
|	|<n|tkr|}|
j|
jk	r|
j||<qW|	sBd}	|sLd}t||||||	|S)a$Get the names and default values of a callable object's parameters.

    A tuple of seven things is returned:
    (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations).
    'args' is a list of the parameter names.
    'varargs' and 'varkw' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.
    'kwonlyargs' is a list of keyword-only parameter names.
    'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
    'annotations' is a dictionary mapping parameter names to annotations.

    Notable differences from inspect.signature():
      - the "self" parameter is always reported, even for bound methods
      - wrapper chains defined by __wrapped__ *not* unwrapped automatically
    F)follow_wrapper_chainsskip_bound_argsigclszunsupported callableNr	return)_signature_from_callable	Signaturer_rreturn_annotationempty
parametersvaluesrhr@_POSITIONAL_ONLYrK_POSITIONAL_OR_KEYWORDdefault_VAR_POSITIONAL
_KEYWORD_ONLY_VAR_KEYWORD
annotationr)
rusigexrrr
r	rannotations
kwdefaultsparamrhr@r	r	r
rAsT





rArgInfozargs varargs keywords localscCs t|j\}}}t||||jS)a9Get information about arguments passed into a particular frame.

    A tuple of four things is returned: (args, varargs, varkw, locals).
    'args' is a list of the argument names.
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'locals' is the locals dictionary of the given frame.)rrr4f_locals)framerrr
r	r	r
getargvaluessr7cCsVt|dddkr t|ddSt|trN|jd|fkr>|jS|jd|jSt|S)Nrtypingztyping.rrr{)r>reprreplacerrrr)r.Zbase_moduler	r	r
formatannotations
r;cst|ddfdd}|S)Nrcs
t|S)N)r;)r.)rr	r
_formatannotationsz5formatannotationrelativeto.<locals>._formatannotation)r>)rr<r	)rr
formatannotationrelativetosr=r	cCsd|S)N*r	)r@r	r	r
rDrErDcCsd|S)Nz**r	)r@r	r	r
rDrEcCsdt|S)N=)r9)rAr	r	r
rDrEcCsd|S)Nz -> r	)textr	r	r
rDrEc
sDddlm}
|
dtddfdd}g}|rBt|t|}xFt|D]:\}}||}|r|||kr|||
|||}||qLW|dk	r||||n|r|d	|rx:|D]2}||}|r||kr||
||7}||qW|dk	r||	||d
d|d}d
kr@||d
7}|S)aFormat an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.

    Deprecated since Python 3.5: use the `signature` function and `Signature`
    objects.
    r)rzc`formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directlyr)rcs(|}|kr$|d|7}|S)Nz: r	)argre)r1r;	formatargr	r
formatargandannotationsz-formatargspec.<locals>.formatargandannotationNr>rz, rr!)rrrrr	enumeraterKr)rrr
rr	rr1rB
formatvarargsformatvarkwformatvalueZ
formatreturnsr;rrCspecsZfirstdefaultrrAspecZ	kwonlyargrer	)r1r;rBr

formatargspecs:



rJcCsd|S)Nr>r	)r@r	r	r
rDrEcCsd|S)Nz**r	)r@r	r	r
rDrEcCsdt|S)Nr?)r9)rAr	r	r
rDrEcCs|||fdd}g}	x&tt|D]}
|	|||
q"W|rZ|	||||||rx|	|||||dd|	dS)afFormat an argument spec from the 4 values returned by getargvalues.

    The first four arguments are (args, varargs, varkw, locals).  The
    next four arguments are the corresponding optional formatting functions
    that are called to turn names and values into strings.  The ninth
    argument is an optional function to format the sequence of arguments.cSs|||||S)Nr	)r@localsrBrGr	r	r
convertsz formatargvalues.<locals>.convertrz, r)rrrrKr)rrr
rKrBrErFrGrLrHrr	r	r
formatargvaluessrMcsfdd|D}t|}|dkr,|d}n>|dkr@dj|}n*dj|dd}|dd=d	||}td
|||rzdnd|dkrd
nd|fdS)Ncsg|]}|krt|qSr	)r9)rWr@)r'r	r
r	sz&_missing_arguments.<locals>.<listcomp>rrrz	{} and {}z, {} and {}z, z*%s() missing %i required %s argument%s: %s
positionalzkeyword-onlyrr)rrrtrr)f_nameZargnamesposr'rRmissingrtailr	)r'r
_missing_argumentss


rTc
	st||}tfdd|D}|r:|dk}	d|f}
n2|rTd}	d|t|f}
nt|dk}	tt|}
d}|rd}||dkrd	nd||dkrd	ndf}td
||
|	rd	nd|||dkr|sdndfdS)
Ncsg|]}|kr|qSr	r	)rWrA)r'r	r
rsz_too_many.<locals>.<listcomp>rzat least %dTz
from %d to %drz7 positional argument%s (and %d keyword-only argument%s)rz5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rrrr)
rPrZkwonlyrZdefcountZgivenr'ZatleastZkwonly_givenZpluralr/Z
kwonly_sigmsgr	)r'r
	_too_manys$rVcOs4|d}|dd}t|}|\}}}}}	}
}|j}i}
t|rV|jdk	rV|jf|}t|}t|}|rrt|nd}t||}x t|D]}|||
||<qW|rt||d|
|<t||	}|ri|
|<xd|	D]X\}}||kr|st
d||f||
||<q||
kr,t
d||f||
|<qW||kr\|s\t|||	||||
||kr|d||}x&|D]}||
kr|t||d|
q|Wx8t
|||dD] \}}||
kr|||
|<qWd}x>|	D]6}||
kr|
r||
kr|
||
|<n|d7}qW|r0t||	d|
|
S)zGet the mapping of arguments to values.

    A dict is returned, with keys the function argument names (including the
    names of the * and ** arguments, if any), and values the respective bound
    values from 'positional' and 'named'.rrNz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTF)rrrrrrrrr^rHr=rrVrTrD)Zfunc_and_positionalZnamedrurOrIrrr
rr	rrrPZ	arg2valueZnum_posZnum_argsZnum_defaultsnrZpossible_kwargskwrAZreqrArRkwargr	r	r
getcallargs-sd








rZClosureVarsz"nonlocals globals builtins unboundc	Cst|r|j}t|s$td||j}|jdkr:i}nddt|j|jD}|j	}|
dtj}t
|rt|j}i}i}t}xn|jD]d}|dkrqy||||<Wqtk
ry||||<Wntk
r||YnXYqXqWt||||S)a
    Get the mapping of free variables to their current values.

    Returns a named tuple of dicts mapping the current nonlocal, global
    and builtin references as seen by the body of the function. A final
    set of unbound names that could not be resolved is also provided.
    z{!r} is not a Python functionNcSsi|]\}}|j|qSr	)
cell_contents)rWvarZcellr	r	r

<dictcomp>sz"getclosurevars.<locals>.<dictcomp>__builtins__)NoneTrueFalse)rrrrrtr__closure__zipco_freevars__globals__r~rr<rrHco_namesKeyErrorrMr[)	rucodeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesr@r	r	r
getclosurevarsms8	
rj	Tracebackz+filename lineno function code_context indexrcCst|r|j}|j}n|j}t|s2td|t|p@t|}|dkr|d|d}yt	|\}}Wnt
k
rd}}YqXtdt|t
||}||||}|d|}nd}}t|||jj||S)aGet information about a frame or traceback object.

    A tuple of five things is returned: the filename, the line number of
    the current line, the function name, a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.z'{!r} is not a frame or traceback objectrrrN)r.	tb_linenorf_linenor0rrtrrrrmaxrrrrkrr)r6contextlinenorrrrindexr	r	r
getframeinfos$rrcCs|jS)zCGet the line number from a frame object, allowing for optimization.)rm)r6r	r	r
	getlinenosrs	FrameInfo)r6cCs6g}x,|r0|ft||}|t||j}qW|S)zGet a list of records for a frame and all higher (calling) frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)rrrKrtf_back)r6ro	framelist	frameinfor	r	r
getouterframess
rxcCs8g}x.|r2|jft||}|t||j}qW|S)zGet a list of records for a traceback's frame and all lower frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)rrrrKrttb_next)tbrorvrwr	r	r
getinnerframess
r{cCsttdrtdSdS)z?Return the frame of the caller or None if this is not possible.	_getframerN)rrpr|r	r	r	r
currentframesr}cCsttd|S)z@Return a list of records for the stack above the caller's frame.r)rxrpr|)ror	r	r
stacksr~cCsttd|S)zCReturn a list of records for the stack below the current exception.r)r{rpexc_info)ror	r	r
tracesrcCstjd|S)Nrj)rr<r)klassr	r	r
_static_getmrosrcCs8i}yt|d}Wntk
r(YnXt||tS)Nr<)r__getattribute__rLdictr~	_sentinel)rgattrZ
instance_dictr	r	r
_check_instancesrc	CsFx@t|D]4}tt|tkr
y
|j|Stk
r<Yq
Xq
WtS)N)r_shadowed_dictrrr<rh)rrentryr	r	r
_check_classs

rcCs&yt|Wntk
r dSXdS)NFT)rr)rgr	r	r
_is_type	s
rc	Csntjd}x^t|D]R}y||d}Wntk
r>YqXt|tjkrb|jdkrb|j|ks|SqWt	S)Nr<)
rr<rrrhrrrrZr)r	dict_attrrZ
class_dictr	r	r
rs


rc	Cst}t|s>t|}t|}|tks2t|tjkrBt||}n|}t||}|tk	r|tk	rtt|dtk	rtt|dtk	r|S|tk	r|S|tk	r|S||krxDtt|D]4}tt|tkry
|j	|St
k
rYqXqW|tk	r|St|dS)aRetrieve attributes without triggering dynamic lookup via the
       descriptor protocol,  __getattr__ or __getattribute__.

       Note: this function may not be able to retrieve all attributes
       that getattr can fetch (like dynamically created attributes)
       and may find attributes that getattr can't (like descriptors
       that raise AttributeError). It can also return descriptor objects
       instead of instance members in some cases. See the
       documentation for details.
    rrN)rrrrrrrrrr<rhrL)rgrr*Zinstance_resultrrZklass_resultrr	r	r
getattr_statics6


rGEN_CREATEDGEN_RUNNING
GEN_SUSPENDED
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a#Get current state of a generator-iterator.

    Possible states are:
      GEN_CREATED: Waiting to start execution.
      GEN_RUNNING: Currently being executed by the interpreter.
      GEN_SUSPENDED: Currently suspended at a yield expression.
      GEN_CLOSED: Execution has completed.
    Nr|)
gi_runningrgi_framerf_lastirr)	generatorr	r	r
getgeneratorstateSs	
rcCs:t|std|t|dd}|dk	r2|jjSiSdS)z
    Get the mapping of generator local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.z{!r} is not a Python generatorrN)r%rrtr>rr5)rr6r	r	r
getgeneratorlocalsesrCORO_CREATEDCORO_RUNNINGCORO_SUSPENDEDCORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a&Get current state of a coroutine object.

    Possible states are:
      CORO_CREATED: Waiting to start execution.
      CORO_RUNNING: Currently being executed by the interpreter.
      CORO_SUSPENDED: Currently suspended at an await expression.
      CORO_CLOSED: Execution has completed.
    Nr|)
cr_runningrcr_framerrrr)	coroutiner	r	r
getcoroutinestate}s	
rcCs"t|dd}|dk	r|jSiSdS)z
    Get the mapping of coroutine local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.rN)r>r5)rr6r	r	r
getcoroutinelocalssr
from_bytescCs6yt||}Wntk
r"dSXt|ts2|SdS)zPrivate helper. Checks if ``cls`` has an attribute
    named ``method_name`` and returns it only if it is a
    pure python function.
    N)r>rLr_NonUserDefinedCallables)rXZmethod_nameZmethr	r	r
"_signature_get_user_defined_methods
rc
Cs|j}t|}|jpd}|jp$i}|r2||}y|j||}Wn6tk
rx}zd|}	t|	|Wdd}~XYnXd}
x|D]\}}y|j	|}
Wnt
k
rYnlX|jtkr|
|q|jtkr||krd}
|j|
d||<n|
|jq|jtkr"|j|
d||<|
r|jtk	s6t|jtkrf||jtd}|||<||q|jttfkr||q|jtkr|
|jqW|j|dS)	zPrivate helper to calculate how 'wrapped_sig' signature will
    look like after applying a 'functools.partial' object (or alike)
    on it.
    r	z+partial object {!r} has incorrect argumentsNFT)r*)rh)r&)r&rr=rkeywordsbind_partialrrtrs	argumentsrhrhr(rr)r:r@r,AssertionErrormove_to_endr-r+r')wrapped_sigpartialZ
extra_argsZ
old_params
new_paramsZpartial_argsZpartial_keywordsZbar0rUZtransform_to_kwonly
param_namer3Z	arg_valueZ	new_paramr	r	r
_signature_get_partialsN






rcCslt|j}|r$|djttfkr,td|dj}|ttfkrP|dd}n|t	k	r`td|j
|dS)zWPrivate helper to transform signatures for unbound
    functions to bound methods.
    rzinvalid method signaturerNzinvalid argument type)r&)r^r&r'rhr-r,rsr)r(r+r:)r/paramsrhr	r	r
_signature_bound_methods
rcCs&t|p$t|p$t|tp$|ttfkS)zxPrivate helper to test if `obj` is a callable that might
    support Argument Clinic's __text_signature__ protocol.
    )r4rrrrr)rgr	r	r
_signature_is_builtin!s
rcCst|rt|rdSt|dd}t|dd}t|dt}t|dt}t|dd}t|tjot|to|dksxt|to|dkst|t	ot|t	S)zPrivate helper to test if `obj` is a duck type of FunctionType.
    A good example of such objects are functions compiled with
    Cython, which have all attributes that a pure Python function
    would have, but have their code statically compiled.
    FrNr__defaults____kwdefaults____annotations__)
callabler
r>_voidrrr1rr^r)rgr@rirr2r1r	r	r
_signature_is_functionlike-s
rcCsr|dst|d}|dkr*|d}|d}|dksH||ksHt|d}|dksf||ksft|d|S)z Private helper to get first parameter name from a
    __text_signature__ of a builtin method, which should
    be in the following format: '($param1, ...)'.
    Assumptions are that the first argument won't have
    a default value or an annotation.
    z($,r|r:r?r)rrfind)rIrQZcposr	r	r
_signature_get_bound_paramFs



rcCsh|s|ddfSd}d}dd|dD}t|j}t|}d}d}g}|j}	d}
tj}tj}t|}
|
j	tj
ksxtx|D]}
|
j	|
j}}||kr|dkr|rd}q~|rtd}|
d	7}
q~|d
kr|rt|dkstd}|
d	}q~||kr|dkr|dkst|
}q~|r8d}||kr0|dks8|	d
|	||dkr~|	dq~Wd
|}|||fS)a
    Private helper function. Takes a signature in Argument Clinic's
    extended signature format.

    Returns a tuple of three things:
      * that signature re-rendered in standard Python syntax,
      * the index of the "self" parameter (generally 0), or None if
        the function does not have a "self" parameter, and
      * the index of the last "positional only" parameter,
        or None if the signature has no positional-only parameters.
    NcSsg|]}|dqS)ascii)encode)rWlr	r	r
rpsz6_signature_strip_non_python_syntax.<locals>.<listcomp>rFrrTr/$rz,  r)rrrrrKrOP
ERRORTOKENnextrENCODINGrstringr)	signatureself_parameterlast_positional_onlyrrZtoken_streamZ
delayed_commaZskip_next_commar@rMZcurrent_parameterrrtrrclean_signaturer	r	r
"_signature_strip_non_python_syntax]sZ





rTc	srddl|jt|\}}}d|d}y|}Wntk
rNd}YnXt|jsjtd||j	d}	gj
td}it|dd}
|
rt
j|
d}|r|jt
j	fdd	fd	d

G
fdddjffd
d	}t|	jj}t|	jj}
tj||
dd}|dk	rJjnjx<ttt|D](\}\}}|||||krbjqbW|	jjrj||	jjjx*t|	jj |	jj!D]\}}|||qW|	jj"rj#||	jj"|dk	rdst$t|dd}|dk	}t%|}|rJ|s>|rJ&dndj'jd}|d<||j
dS)zdPrivate helper to parse content of '__text_signature__'
    and return a Signature based on it.
    rNzdef fooz: passz"{!r} builtin has invalid signaturercs(t|jst|jdkr"td|jS)Nz'Annotations are not currently supported)rrArr.rs)node)astr	r

parse_names
z&_signature_fromstr.<locals>.parse_namecsyt|}Wn>tk
rLyt|}Wntk
rFtYnXYnXt|trb|St|ttfrz|St|t	r
|S|dkr|StdS)N)TFN)eval	NameErrorRuntimeErrorrrZStrintfloatZNumbytesZBytesZNameConstant)rrA)rmodule_dictsys_module_dictr	r

wrap_values 





z&_signature_fromstr.<locals>.wrap_valuecs(eZdZfddZfddZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs`g}|}x"t|jr*||j|j}q
Wt|js>t||jdt	|}|S)Nr{)
rrVrKrrANamerrorreversed)rrarWrA)rrr	r
visit_Attributes
z<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|jjst|jS)N)rZctxZLoadrsro)rr)rrr	r

visit_Namesz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)rrrrrr	)rrr	r
RewriteSymbolicssrcs|}|krdS|rp|tk	rpy|}|}Wntk
rR}YnX|kr`dS|k	rl|n|}||ddS)N)r*r.)_emptyZvisitZliteral_evalrsrK)Z	name_nodeZdefault_noder*r@o)	Parameterrrr%invalidrhr&rr	r
ps
z_signature_fromstr.<locals>.p)	fillvaluer)rh)r$)(r_parameter_clsrparseSyntaxErrorrZModulersrtZbodyr%rr>rpr}r~r<copyZNodeTransformerrrr	itertoolszip_longestPOSITIONAL_ONLYPOSITIONAL_OR_KEYWORDrDrZvarargVAR_POSITIONALKEYWORD_ONLYrdr	Zkw_defaultsrYVAR_KEYWORDrrrr:)rXrgrrrrrZprogramrrmZmodule_namerrrrrr@r*_selfZself_isboundZ
self_ismoduler	)rrrr%rrhrr&rrrr
_signature_fromstrsn









rcCsBt|std|t|dd}|s4td|t||||S)zHPrivate helper function to get signature for
    builtin callables.
    z%{!r} is not a Python builtin function__text_signature__Nz#no signature found for builtin {!r})rrrtr>rsr)rXrurrr	r	r
_signature_from_builtin5src	Csd}t|s(t|rd}ntd||j}|j}|j}|j}t|d|}|j	}||||}	|j
}
|j}|j}|rt
|}
nd}
g}||
}x4|d|D]$}|
|t}||||tdqWxBt||dD].\}}|
|t}||||t||dqW|jt@rH|||}|
|t}||||tdxJ|	D]B}t}|dk	rl||t}|
|t}||||t|dqNW|jt@r||}|jt@r|d7}||}|
|t}||||td|||
d	t|d
S)zCPrivate helper: constructs Signature for the given python function.FTz{!r} is not a Python functionNr)r.rh)r.rhr*rr!)r$__validate_parameters__)rrrrtrrrr
r^rrrrrrr~rrKr)rDrrr+r,rr-)rXruZis_duck_functionrZ	func_codeZ	pos_countZ	arg_namesrOZkeyword_only_countZkeyword_onlyr1rr2Zpos_default_countr&Znon_default_countr@r.offsetr*rqr	r	r
_signature_from_functionEsj










r)rrc
Cst|std|t|tjrDt|j|||d}|r@t|S|S|rtt	|ddd}t|tjrtt||||dSy
|j
}Wntk
rYn&X|dk	rt|tstd||Sy
|j
}Wntk
rYnXt|tjrdt|j|||d}t||d}t|jd	}|jtjkr(|St|j}|rN||d	k	sNt|f|}	|j|	d
St|sxt|rt||St|rt|||dSt|tjrt|j|||d}t||Sd}t|t rt!t |d}
|
dk	rt|
|||d}nJt!|d
}|dk	r$t||||d}n$t!|d}|dk	rHt||||d}|dkrRxL|j"ddD]:}
y
|
j#}Wntk
rYnX|rbt$|||SqbWt |j"krR|j%t&j%kr|j't&j'krt(t&St)d|nrt|t*sRt!t |d}
|
dk	rRyt|
|||d}Wn8t)k
rP}zd|}t)||Wdd}~XYnX|dk	rn|rjt|S|St|tj+rd|}t)|t)d|dS)zQPrivate helper function to get signature for arbitrary
    callable objects.
    z{!r} is not a callable object)rrr cSs
t|dS)N
__signature__)r)rmr	r	r
rDrEz*_signature_from_callable.<locals>.<lambda>)rkNz1unexpected object {!r} in __signature__ attribute)Nr)r&)r__call____new__rr|z(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature),rrrtrrrr"rrrvrrLr#_partialmethod	functools
partialmethodrurr^r&r'rhrrrr:rrrrrrrrrjrrrrrrrsrr3)rgrrr r/rrZfirst_wrapped_paramZ
sig_paramsrZcallnewZinitrBZtext_sigr0rUr	r	r
r"s	



















r"c@seZdZdZdS)rz1A private marker - used in Parameter & Signature.N)rrrrr	r	r	r
r_	src@seZdZdZdS)rz6Marker object for Signature.empty and Parameter.empty.N)rrrrr	r	r	r
rc	src@s(eZdZdZdZdZdZdZddZdS)	_ParameterKindrrrcCs|jS)N)_name_)rr	r	r
__str__n	sz_ParameterKind.__str__N)	rrrrrrrrrr	r	r	r
rg	srzpositional-onlyzpositional or keywordzvariadic positionalzkeyword-onlyzvariadic keywordc@seZdZdZdZeZeZe	Z
eZe
ZeZeedddZddZdd	Zed
dZedd
ZeddZeddZeeeedddZddZddZddZddZdS)raRepresents a parameter in a function signature.

    Has the following public attributes:

    * name : str
        The name of the parameter as a string.
    * default : object
        The default value for the parameter if specified.  If the
        parameter has no default value, this attribute is set to
        `Parameter.empty`.
    * annotation
        The annotation for the parameter if specified.  If the
        parameter has no annotation, this attribute is set to
        `Parameter.empty`.
    * kind : str
        Describes how argument values are bound to the parameter.
        Possible values: `Parameter.POSITIONAL_ONLY`,
        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    )_name_kind_default_annotation)r*r.cCs yt||_Wn$tk
r2td|dYnX|tk	rf|jttfkrfd}|t|j}t|||_||_	|tkrtdt
|tsdt|j
}t||ddkr|ddr|jtkrd	}|t|j}t|t|_d
|dd}|std|||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr{rzLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)rrrsrr+r-rt_get_paramkind_descrrrrrrrrisdigitr)r(isidentifierr)rr@rhr*r.rUr	r	r
r	s4


zParameter.__init__cCs t||j|jf|j|jdfS)N)rr)rrrrr)rr	r	r

__reduce__	s
zParameter.__reduce__cCs|d|_|d|_dS)Nrr)rr)rstater	r	r
__setstate__	s
zParameter.__setstate__cCs|jS)N)r)rr	r	r
r@	szParameter.namecCs|jS)N)r)rr	r	r
r*	szParameter.defaultcCs|jS)N)r)rr	r	r
r.	szParameter.annotationcCs|jS)N)r)rr	r	r
rh	szParameter.kind)r@rhr.r*cCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|||||dS)z+Creates a customized copy of the Parameter.)r*r.)rrrrrr)rr@rhr.r*r	r	r
r:	szParameter.replacecCs|j}|j}|jtk	r(d|t|j}|jtk	rb|jtk	rPd|t|j}nd|t|j}|tkrtd|}n|t	krd|}|S)Nz{}: {}z{} = {}z{}={}r>z**)
rhrrrrtr;rr9r+r-)rrh	formattedr	r	r
r	s



zParameter.__str__cCsd|jj|S)Nz	<{} "{}">)rtrr)rr	r	r
__repr__
szParameter.__repr__cCst|j|j|j|jfS)N)hashr@rhr.r*)rr	r	r
__hash__
szParameter.__hash__cCsJ||krdSt|tstS|j|jkoH|j|jkoH|j|jkoH|j|jkS)NT)rrNotImplementedrrrr)rotherr	r	r
__eq__
s
zParameter.__eq__N)rrrr	__slots__r(rr)rr+rr,rr-rrr%rr	rr[r@r*r.rhrr:rr
rrr	r	r	r
r	s*(rc@sheZdZdZdZddZeddZeddZed	d
Z	ddZ
d
dZddZddZ
ddZdS)BoundArgumentsaResult of `Signature.bind` call.  Holds the mapping of arguments
    to the function's parameters.

    Has the following public attributes:

    * arguments : OrderedDict
        An ordered mutable mapping of parameters' names to arguments' values.
        Does not contain arguments' default values.
    * signature : Signature
        The Signature object that created this instance.
    * args : tuple
        Tuple of positional arguments values.
    * kwargs : dict
        Dict of keyword arguments values.
    )r
_signature__weakref__cCs||_||_dS)N)rr)rrrr	r	r
r1
szBoundArguments.__init__cCs|jS)N)r)rr	r	r
r5
szBoundArguments.signaturec	Cs|g}xn|jjD]^\}}|jttfkr*Py|j|}Wntk
rNPYqX|jtkrf|	|q|
|qWt|S)N)rr&r=rhr-r,rrhr+extendrKr^)rrrr3rAr	r	r
r9
s
zBoundArguments.argsc	Csi}d}x|jjD]x\}}|sF|jttfkr6d}n||jkrFd}q|sLqy|j|}Wntk
rnYqX|jtkr||q|||<qW|S)NFT)	rr&r=rhr-r,rrhupdate)rkwargsZkwargs_startedrr3rAr	r	r
rP
s&

zBoundArguments.kwargsc	Cs|j}g}x|jjD]v\}}y||||fWqtk
r|jtk	rX|j}n"|jt	krhd}n|jt
krxi}nw|||fYqXqWt||_dS)zSet default values for missing arguments.

        For variable-positional arguments (*args) the default is an
        empty tuple.

        For variable-keyword arguments (**kwargs) the default is an
        empty dict.
        r	N)rrr&r=rKrhr*rrhr+r-r)rrZ
new_argumentsr@r3valr	r	r
apply_defaultsn
s	


zBoundArguments.apply_defaultscCs2||krdSt|tstS|j|jko0|j|jkS)NT)rrrrr)rrr	r	r
r
s
zBoundArguments.__eq__cCs|d|_|d|_dS)Nrr)rr)rr
r	r	r
r
s
zBoundArguments.__setstate__cCs|j|jdS)N)rr)rr)rr	r	r
__getstate__
szBoundArguments.__getstate__cCsDg}x(|jD]\}}|d||qWd|jjd|S)Nz{}={!r}z	<{} ({})>z, )rr=rKrtrrr)rrrArAr	r	r
r

szBoundArguments.__repr__N)rrrrrrr[rrrrrrrr
r	r	r	r
r
src@seZdZdZdZeZeZe	Z
d,e	ddddZedd	Z
ed
dZeddd
dZeddZeddZeedddZddZddZddZddddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+ZdS)-r#aA Signature object represents the overall signature of a function.
    It stores a Parameter object for each parameter accepted by the
    function, as well as information specific to the function itself.

    A Signature object has the following public attributes and methods:

    * parameters : OrderedDict
        An ordered mapping of parameters' names to the corresponding
        Parameter objects (keyword-only arguments are in the same order
        as listed in `code.co_varnames`).
    * return_annotation : object
        The annotation for the return type of the function if specified.
        If the function has no annotation for its return type, this
        attribute is set to `Signature.empty`.
    * bind(*args, **kwargs) -> BoundArguments
        Creates a mapping from positional and keyword arguments to
        parameters.
    * bind_partial(*args, **kwargs) -> BoundArguments
        Creates a partial mapping from positional and keyword arguments
        to parameters (simulating 'functools.partial' behavior.)
    )_return_annotation_parametersNT)r$rcCs|dkrt}n|rt}t}d}xt|D]\}}|j}	|j}
|	|krjd}|t|t|	}t|n|	|krzd}|	}|	ttfkr|j	t
kr|rd}t|nd}|
|krd|
}t||||
<q,Wntdd|D}t||_
||_dS)	zConstructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdS)N)r@)rWr3r	r	r
rY
sz%Signature.__init__.<locals>.<genexpr>)rr(rDrhr@rtrrsr)r*rrMappingProxyTyperr)rr&r$rrZtop_kindZ
kind_defaultsidxr3rhr@rUr	r	r
r
s>






zSignature.__init__cCstjdtddt||S)zConstructs Signature for the given python function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r)r)rrrr)rXrur	r	r

from_function
s
zSignature.from_functioncCstjdtddt||S)zConstructs Signature for the given builtin function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r)r)rrrr)rXrur	r	r
from_builtins
zSignature.from_builtin)follow_wrappedcCst|||dS)z3Constructs Signature for the given callable object.)r r)r")rXrgr#r	r	r

from_callable
szSignature.from_callablecCs|jS)N)r)rr	r	r
r&szSignature.parameterscCs|jS)N)r)rr	r	r
r$szSignature.return_annotation)r&r$cCs0|tkr|j}|tkr |j}t|||dS)zCreates a customized copy of the Signature.
        Pass 'parameters' and/or 'return_annotation' arguments
        to override them in the new copy.
        )r$)rr&r'rr)rr&r$r	r	r
r:s
zSignature.replacecCs8tdd|jD}dd|jD}|||jfS)Ncss|]}|jtkr|VqdS)N)rhr,)rWr3r	r	r
rY+sz(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr||jqSr	)rhr,r@)rWr3r	r	r
r^.sz)Signature._hash_basis.<locals>.<dictcomp>)r^r&r'r$)rr
kwo_paramsr	r	r
_hash_basis*szSignature._hash_basiscCs(|\}}}t|}t|||fS)N)r&	frozensetr'r)rrr%r$r	r	r
r3szSignature.__hash__cCs*||krdSt|tstS||kS)NT)rr#rr&)rrr	r	r
r8s

zSignature.__eq__F)rcCst}t|j}d}t|}xxyt|}Wntk
ryt|}	Wntk
rbPYnX|	jtkrrPn|	j|kr|	jt	krd}
|
j
|	jd}
t|
d|	f}PnH|	jtks|	j
tk	r|	f}Pn*|r|	f}Pnd}
|
j
|	jd}
t|
dYq$Xyt|}	Wn tk
r&tddYq$X|	jttfkrBtdd|	jtkrn|g}||t|||	j<P|	j|krtdj
|	jdd|||	j<q$Wd}xt||D]}	|	jtkr|	}q|	jtkr֐q|	j}
y||
}WnFtk
r0|s,|	jtkr,|	j
tkr,tdj
|
ddYn(X|	jt	krPtdj
|	jd|||
<qW|r|dk	rz|||j<ntdj
tt|d|||S)	z#Private method. Don't use directly.r	zA{arg!r} parameter is positional only, but was passed as a keyword)rANz$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rrr&r'r
StopIterationrhr+r@r(rtrr-r*rr,rr^rchainrrh_bound_arguments_cls)rrrrrr&Z
parameters_exZarg_valsZarg_valr3rUr'Zkwargs_paramrr	r	r
_bind?s







zSignature._bindcOs|d|dd|S)zGet a BoundArguments object, that maps the passed `args`
        and `kwargs` to the function's signature.  Raises `TypeError`
        if the passed arguments can not be bound.
        rrN)r+)rrr	r	r
bindszSignature.bindcOs|dj|dd|ddS)zGet a BoundArguments object, that partially maps the
        passed `args` and `kwargs` to the function's signature.
        Raises `TypeError` if the passed arguments can not be bound.
        rrNT)r)r+)rrr	r	r
rszSignature.bind_partialcCs t|t|jfd|jifS)Nr)rr^rr'r)rr	r	r
r	szSignature.__reduce__cCs|d|_dS)Nr)r)rr
r	r	r
rszSignature.__setstate__cCsd|jj|S)Nz<{} {}>)rtrr)rr	r	r
r
szSignature.__repr__c	Csg}d}d}xr|jD]d}t|}|j}|tkr8d}n|rJ|dd}|tkrXd}n|tkrr|rr|dd}||qW|r|ddd	|}|j
tk	rt|j
}|d|7}|S)NFTrr>z({})z, z -> {})
r&r'rrhr(rKr+r,rtrr$rr;)	rreZrender_pos_only_separatorZrender_kw_only_separatorr3rrhZrenderedZannor	r	r
rs0




zSignature.__str__)N)rrrrrrrrr*rr%rrcr!r"r$r[r&r$rr:r&rrr+r,rr	rr
rr	r	r	r
r#
s26	r#)r#cCstj||dS)z/Get a signature object for the passed callable.)r#)r#r$)rgr#r	r	r
r	src
Csddl}ddl}|}|jddd|jdddd	d
|}|j}|d\}}}y||}}	WnLtk
r}
z.d	|t
|
j|
}t|t
jd
tdWdd}
~
XYnX|r|d}|	}x|D]}
t||
}qW|	jt
jkrtdt
jd
td|jrtd	|td	t|	td	|	j||	krxtd	t|	jt|	drtd	|	jn6yt|\}}Wntk
rYnXtd	|tdntt|dS)z6 Logic for inspecting an object given at command line rNrzCThe object to be analysed. It supports the 'module:qualname' syntax)helpz-dz	--details
store_truez9Display info about the module rather than its source code)actionr-rzFailed to import {} ({}: {}))rrr{z#Can't get info for builtin modules.rz
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}__path__zSubmodule search path: {}zLine: {}r)argparserArgumentParseradd_argument
parse_argsr	partition
import_moduler_rtrrprintrpstderrexitrr>builtin_module_namesZdetailsr
__cached__r9rrr0rr)r1rparserrtargetZmod_nameZ	has_attrsZattrsrgrrfrUpartspart__rpr	r	r
_mainsV



rAr)N)N)N)F)N)r)r)r)r)r)r	)T)T)r
__author__r*disZcollections.abcr)enumimportlib.machineryrrrrrrprrrrrroperatorrrrglobalsZmod_dictZCOMPILER_FLAG_NAMESr=rSrTr9rr
rrrrrrrrr r!r#r%r'r,r.r0r2r4r5rCrUrVrirGrvrzrrrrrrrrrrrrrr_rrrrrrrrrrrrrrr4r7r;r=rrJrMrTrVrZr[rjrkrrrs_fieldsrtrxr{r}r~rrrrrrrrrrrrrrrrrrrrrrrZ_WrapperDescriptorallZ_MethodWrapperrr<Z_ClassMethodWrapperr3rrrrrrrrrrrr"rrIntEnumrrr(rr)rr+rr,rr-Z_PARAM_NAME_MAPPING__getitem__rrrr#rrArr	r	r	r
<module>sb	



	
	
,
t$
;
	
.I-7





[


	4>
5

 



		0


LH
RHk: