grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î £ fÀ˜ã@sÐdZddfZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZmZyddlmZWnNek r8dd f\ZZd d f\ZZd d df\ZZZYn5Xe ƒZ!x(ej"ƒD]\Z#Z$e#e!de$Z%dd„Z&dd„Z'dd„Z(dd„Z)dd„Z*e+e dƒrÑdd„Z,n dd„Z,e+e dƒrûd d!„Z-n d"d!„Z-d#d$„Z.d%d&„Z/d'd(„Z0d)d*„Z1d+d,„Z2d-d.„Z3d/d0„Z4d1d2„Z5d3d4„Z6dd5d6„Z7ed7d8ƒZ8d9d:„Z9d;d<„Z:d=dd>d?„Z;d@dA„Z<dBdC„Z=dDdE„Z>dFdG„Z?edHdIƒZ@dJdK„ZAdLdM„ZBdNdO„ZCddPdQ„ZDiZEiZFddRdS„ZGdTdU„ZHdVdW„ZIGdXdY„dYeJƒZKGdZd[„d[ƒZLd\d]„ZMd^d_„ZNd`da„ZOdbdc„ZPdddedf„ZQedgdhƒZRdidj„ZSdkdl„ZTedmdnƒZUdodp„ZVedqdrƒZWdsdt„ZXedudvƒZYdwdx„ZZddydz„Z[d{d|„Z\dddfiie]d}d~„dd~„d€d~„d�d~„e[d‚dƒ„ Z^e]d„d~„d…d~„d†d~„d‡dˆ„Z_d‰dŠ„Z`d‹dŒ„Zad�dŽ„Zbed�d�ƒZcd‘d’„Zded“d”ƒZedd•d–„Zfd—d˜„Zgdd™dš„Zhdd›dœ„Zid�dž„ZjddŸd „Zkdd¡d¢„ZlemƒZnd£d¤„Zod¥d¦„Zpd§d¨„Zqd©dª„Zrd«d¬„Zsend­d®„Ztd¯Zud°Zvd±Zwd²Zxd³d´„Zydµd¶„Zze{e{j|ƒZ}e{e~j|ƒZe{e€j�d·ƒZ‚e}ee‚e jƒfZ„d¸d¹„Z…fdºd»„Z†d¼d½„Z‡d¾d¿„ZˆdÀdÁ„Z‰dÂdÄZŠdÄdÅ„Z‹dÆdÇdÈ„ZŒdÆdÉdÊ„Z�dÆdÆdËdÌ„ZŽdÍd΄Z�GdÏdЄdЃZ�GdÑdÒ„dÒƒZ‘GdÓdÔ„dÔe€ƒZ’e’ddÕdÖƒZ“e’ddÕd׃Z”e’d dÕd؃Z•e’dÙdÕdÚƒZ–e’d dÕdÛƒZ—GdÜdÝ„d݃Z˜GdÞdß„d߃Z™Gdàdá„dáƒZšdâdã„Z›eœdäkrÌe›ƒndS)åa(Get 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 getargspec(), getargvalues(), getcallargs() - get info about function arguments getfullargspec() - same, with support for Python-3000 features formatargspec(), 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 z'Yury Selivanov éN)Ú attrgetter)Ú namedtupleÚ OrderedDict)ÚCOMPILER_FLAG_NAMESéééééé é@ZCO_écCst|tjƒS)zøReturn 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))Ú isinstanceÚtypesÚ ModuleType)Úobject©rú,/opt/alt/python34/lib64/python3.4/inspect.pyÚismoduleDsrcCs t|tƒS)zÆReturn 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)rÚtype)rrrrÚisclassMsrcCst|tjƒS)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)rrrrÚismethodUsrcCsQt|ƒs$t|ƒs$t|ƒr(dSt|ƒ}t|dƒoPt|dƒ S)a–Return 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__)rrÚ isfunctionrÚhasattr)rÚtprrrÚismethoddescriptor_s$ rcCsPt|ƒs$t|ƒs$t|ƒr(dSt|ƒ}t|dƒoOt|dƒS)a€Return 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)rrrrr)rrrrrÚisdatadescriptorss$ rÚMemberDescriptorTypecCst|tjƒS)z�Return true if the object is a member descriptor. Member descriptors are specialized descriptors defined in extension modules.)rrr )rrrrÚismemberdescriptorƒsr!cCsdS)z�Return true if the object is a member descriptor. Member descriptors are specialized descriptors defined in extension modules.Fr)rrrrr!‹sÚGetSetDescriptorTypecCst|tjƒS)z�Return true if the object is a getset descriptor. getset descriptors are specialized descriptors defined in extension modules.)rrr")rrrrÚisgetsetdescriptor”sr#cCsdS)z�Return true if the object is a getset descriptor. getset descriptors are specialized descriptors defined in extension modules.Fr)rrrrr#œscCst|tjƒS)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)rrrrr£s rcCs,tt|ƒst|ƒo(|jjt@ƒS)z¸Return true if the object is a user-defined generator function. Generator function objects provides same attributes as functions. See help(isfunction) for attributes listing.)ÚboolrrÚ__code__Úco_flagsÚ CO_GENERATOR)rrrrÚisgeneratorfunction°sr)cCst|tjƒS)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)rrrrÚ isgenerator¹sr+cCst|tjƒS)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)rrrrÚ istracebackÊsr-cCst|tjƒS)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)rrrrÚisframeÔs r/cCst|tjƒS)auReturn true if the object is a code object. Code objects provide these attributes: co_argcount number of arguments (not including * or ** args) co_code string of raw compiled bytecode 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 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)rrÚCodeType)rrrrÚiscodeâsr1cCst|tjƒS)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)rrÚBuiltinFunctionType)rrrrÚ isbuiltinôsr3cCs.t|ƒp-t|ƒp-t|ƒp-t|ƒS)z1szgetmembers..)rÚgetmroÚsetÚdirÚ __bases__Ú__dict__ÚitemsrrÚDynamicClassAttributeÚappendÚAttributeErrorÚgetattrÚaddÚsort) rZ predicateÚmroÚresultsÚ processedÚnamesÚbaseÚkÚvr8ÚvaluerrrÚ getmemberss:          rNÚ Attributezname kind defining_class objectcCs$t|ƒ}tt|ƒƒ}tdd„|Dƒƒ}|f|}||}t|ƒ}xP|D]H}x?|jjƒD].\}}t|tjƒrw|j |ƒqwqwWqaWg} t ƒ} xa|D]Y} d} d} d}| | kry.| dkrt dƒ‚nt || ƒ} Wn%t k r<}zWYdd}~XqXt | d| ƒ} | |krd} d}x5|D]-}t || dƒ}|| krn|}qnqnWxQ|D]I}y|j || ƒ}Wntk rÙw¦YnX|| kr¦|}q¦q¦W|dk r |} q qnxC|D];}| |jkr|j| }| |krL|} nPqqW| dkrfqÃn| dk rx| n|}t|tƒrœd}|}nWt|tƒrºd}|}n9t|tƒrØd }|}nt|ƒríd }nd }| j t| || |ƒƒ| j| ƒqÃW| 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(g|]}|ttfkr|‘qSr)rr)Ú.0Úclsrrrú Ss z(classify_class_attrs..Nr>z)__dict__ is special, don't want the proxyÚ __objclass__z static methodz class methodÚpropertyÚmethodÚdata)r:rÚtupler<r>r?rrr@rAr;Ú ExceptionrCÚ __getattr__rBÚ staticmethodÚ classmethodrTr4rOrD)rQrFZmetamroZ class_basesZ all_basesrIrJrKrLÚresultrHÚnameZhomeclsZget_objZdict_objÚexcZlast_clsZsrch_clsZsrch_objÚobjÚkindrrrÚclassify_class_attrs6s€                            racCs|jS)zHReturn tuple of base classes (including cls) in method resolution order.)Ú__mro__)rQrrrr:ªsr:ÚstopcsŸˆdkrdd„}n‡fdd†}|}t|ƒh}xV||ƒrš|j}t|ƒ}||krŠtdj|ƒƒ‚n|j|ƒqEW|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|dƒS)NÚ __wrapped__)r)ÚfrrrÚ _is_wrapperÁszunwrap.._is_wrappercst|dƒoˆ|ƒ S)Nrd)r)re)rcrrrfÄsz!wrapper loop when unwrapping {!r})ÚidrdÚ ValueErrorÚformatrD)ÚfuncrcrfreÚmemoZid_funcr)rcrÚunwrap°s    rlcCs&|jƒ}t|ƒt|jƒƒS)zBReturn the indent size, in spaces, at the start of a line of text.)Ú expandtabsÚlenÚlstrip)ÚlineZexplinerrrÚ indentsizeÑs rqc CsCy |j}Wntk r%dSYnXt|tƒs9dSt|ƒS)zùGet 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)Ú__doc__rBrÚstrÚcleandoc)rÚdocrrrÚgetdocÖs   rvc CsOy|jƒjdƒ}Wntk r1dSYnXtj}xR|dd…D]@}t|jƒƒ}|rLt|ƒ|}t||ƒ}qLqLW|r­|djƒ|d.) ÚwarningsÚwarnÚDeprecationWarningÚcatch_warningsÚ simplefilterÚPendingDeprecationWarningÚimpÚosÚpathÚbasenameZ get_suffixesrErŽ)r›r™ÚfilenameÚsuffixesÚneglenr�r‘r’rrrÚ getmoduleinfos    r cCsptjj|ƒ}dd„tjjƒDƒ}|jƒx1|D])\}}|j|ƒr?|d|…Sq?WdS)z1Return the module name for a given file, or None.cSs#g|]}t|ƒ |f‘qSr)rn)rPr�rrrrR/s z!getmodulename..N)ršr›rœÚ importlibÚ machineryÚ all_suffixesrEÚendswith)r›ZfnameržrŸr�rrrÚ getmodulename+s  r¥csýt|ƒ‰tjjdd…}|tjjdd…7}t‡fdd†|Dƒƒr‚tjjˆƒdtjj d‰n)t‡fdd†tjj Dƒƒr«dStjj ˆƒrÁˆSt t |ˆƒddƒdk ræˆSˆtjkrùˆSdS)z†Return 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|]}ˆj|ƒVqdS)N)r¤)rPÚs)r�rrú >sz getsourcefile..rc3s|]}ˆj|ƒVqdS)N)r¤)rPr¦)r�rrr§AsÚ __loader__)r�r¡r¢ÚDEBUG_BYTECODE_SUFFIXESÚOPTIMIZED_BYTECODE_SUFFIXESÚanyršr›ÚsplitextÚSOURCE_SUFFIXESÚEXTENSION_SUFFIXESÚexistsrCÚ getmoduleÚ linecacheÚcache)rZall_bytecode_suffixesr)r�rÚ getsourcefile7s !r³cCsC|dkr't|ƒp!t|ƒ}ntjjtjj|ƒƒS)z¾Return 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)r³r�ršr›ÚnormcaseÚabspath)rÚ _filenamerrrÚ getabsfileMs r·c Cs t|ƒr|St|dƒr2tjj|jƒS|dk r^|tkr^tjjt|ƒSyt||ƒ}Wntk r‰dSYnX|tkrªtjjt|ƒSxŸt tjj ƒƒD]ˆ\}}t|ƒrÀt|dƒrÀ|j }|t j|dƒkrqÀn|t |zsource code not availablezcould not get source coderz^(\s*)class\s*z\bÚcrzcould not find class definitionÚco_firstlinenoz"could not find function definitionz+^(\s*def\s)|(.*(?rrr¹ÚreÚcompiler~rnÚmatchrAÚgrouprErr‰rr&r-rŠr/r‹r1rrÆ) rr¿rÁr�r]ZpatZ candidatesrƒrÍÚlnumrrrÚ findsource‡s^       #            rÐc Csåyt|ƒ\}}Wnttfk r4dSYnXt|ƒrEd}|rp|ddd…dkrpd}nx6|t|ƒkr¨||jƒdkr¨|d}qsW|t|ƒkrá||dd…dkrág}|}xQ|t|ƒkr4||dd…dkr4|j||jƒƒ|d}qäWdj|ƒSnœ|dkrát ||ƒ}|d}|dkrá||j ƒdd…dkrát ||ƒ|krá||jƒj ƒg}|dkrk|d}||jƒj ƒ}xv|dd…dkrgt ||ƒ|krg|g|dd…<|d}|dkrNPn||jƒj ƒ}qõWnx0|r�|djƒdkr�g|dd…sròcCsvg}|jdtddƒƒxP|D]H}|j||jfƒ||kr&|jt||||ƒƒq&q&W|S)z-Recursive helper function for getclasstree().r8r…r¹)rErrAr=Úwalktree)ÚclassesÚchildrenÚparentrGrÅrrrróHs  $róFcCséi}g}x�|D]•}|jrŒxƒ|jD]Y}||krKg||._formatannotation)rC)rr*r)rÁrÚformatannotationrelativetosr+cCsd|S)NÚ*r)r]rrrr9#sr9cCsd|S)Nz**r)r]rrrr9$scCsdt|ƒS)Nú=)r()rMrrrr9%scCsd|S)Nz -> r)Útextrrrr9&sc s¦‡‡‡fdd†} g}|r=t|ƒt|ƒ}nx`t|ƒD]R\}}| |ƒ}|r�||kr�|| |||ƒ}n|j|ƒqJW|dk rÈ|j|| |ƒƒƒn|rÞ|jdƒn|r:xS|D]H}| |ƒ}|r&||kr&|| ||ƒ7}n|j|ƒqëWn|dk rb|j| | |ƒƒƒnddj|ƒd}dˆkr¢|| ˆˆdƒƒ7}n|S) a¨Format an argument spec from the values returned by getargspec or 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.cs7ˆ|ƒ}|ˆkr3|dˆˆ|ƒ7}n|S)Nz: r)Úargr\)r r)Ú formatargrrÚformatargandannotation0s  z-formatargspec..formatargandannotationNr,ú(z, ú)r)rnÚ enumeraterAr€)rürýrÿr rþr r r0Ú formatvarargsÚ formatvarkwÚ formatvalueZ formatreturnsr)r1ÚspecsZ firstdefaultrƒr/ÚspecZ kwonlyargr\r)r r)r0rÚ formatargspec s2      r:cCsd|S)Nr,r)r]rrrr9QscCsd|S)Nz**r)r]rrrr9RscCsdt|ƒS)Nr-)r()rMrrrr9Ssc Cs¸|||dd„}g} x1tt|ƒƒD]} | j||| ƒƒq.W|ry| j||ƒ|||ƒƒn|r£| j||ƒ|||ƒƒnddj| ƒ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]Úlocalsr0r7rrrÚconvertZsz formatargvalues..convertr2z, r3)r~rnrAr€) rürýrÿr;r0r5r6r7r<r8rƒrrrÚformatargvaluesOs $$r=csÖ‡fdd†|Dƒ}t|ƒ}|dkr>|d}nW|dkr\dj|Œ}n9dj|dd…Œ}|dd…=dj|ƒ|}td |||r­d nd |dkrÂd nd |fƒ‚dS)Ncs(g|]}|ˆkrt|ƒ‘qSr)r()rPr])rrrrRgs z&_missing_arguments..rrrz {} and {}z , {} and {}z, z*%s() missing %i required %s argument%s: %sÚ positionalz keyword-onlyrÑr¦éþÿÿÿr?)rnrir€r†)Úf_nameZargnamesÚposrrIÚmissingr¦Útailr)rrÚ_missing_argumentsfs     rDc s1t|ƒ|}t‡fdd†|Dƒƒ}|rQ|dk} d|f} nI|rvd} d|t|ƒf} n$t|ƒdk} tt|ƒƒ} d} |ræd} | |dkrÁd nd||dkrÙd ndf} ntd || | rþd nd|| |dkr | r d nd fƒ‚dS) Ncs"g|]}|ˆkr|‘qSrr)rPr/)rrrrRxs z_too_many..rz at least %dTz from %d to %drÑz7 positional argument%s (and %d keyword-only argument%s)r¦z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rnrsr†) r@rüZkwonlyrýZdefcountZgivenrZatleastZ kwonly_givenZpluralrZ kwonly_sigÚmsgr)rrÚ _too_manyvs$ rFcOsú|d}|dd…}t|ƒ}|\}}}}} } } |j} i} t|ƒr~|jdk r~|jf|}nt|ƒ}t|ƒ}|r¨t|ƒnd}t||ƒ}x&t|ƒD]}||| ||r9rürýrÿr rþr r r@Z arg2valueZnum_posZnum_argsZ num_defaultsÚnrƒZpossible_kwargsÚkwrMZreqr/rBÚkwargrrrÚ getcallargs‹sd            '   rKÚ ClosureVarsz"nonlocals globals builtins unboundc Cs^t|ƒr|j}nt|ƒs<tdj|ƒƒ‚n|j}|jdkr]i}n"dd„t|j|jƒDƒ}|j }|j dt j ƒ}t |ƒrµ|j }ni}i}tƒ}x~|jD]s}|d krìqÔny||||ás z"getclosurevars..Ú __builtins__ÚNoneÚTrueÚFalse)zNonezTruezFalse)rr‰rr†rir&Ú __closure__ÚzipÚ co_freevarsÚ __globals__rˆrºr>rr;Úco_namesÚKeyErrorrDrL) rjÚcodeZ nonlocal_varsZ global_nsZ builtin_nsZ global_varsZ builtin_varsZ unbound_namesr]rrrÚgetclosurevarsËs8              r[Ú Tracebackz+filename lineno function code_context indexcCs5t|ƒr!|j}|j}n |j}t|ƒsNtdj|ƒƒ‚nt|ƒpct|ƒ}|dkr|d|d}yt |ƒ\}}Wnt k r¸d}}YqXt |dƒ}t dt |t |ƒ|ƒƒ}||||…}|d|}n d}}t|||jj||ƒS)a“Get 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_linenorŠÚf_linenor/r†rir³r�rÐrÉÚmaxr}rnr\r‹Úco_name)r%ÚcontextÚlinenor�rÔr�rÏÚindexrrrÚ getframeinfos&       " rdcCs|jS)zCGet the line number from a frame object, allowing for optimization.)r^)r%rrrÚ getlineno#srecCs=g}x0|r8|j|ft||ƒƒ|j}q W|S)zÐGet 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.)rArdÚf_back)r%raÚ framelistrrrÚgetouterframes(s   rhcCs@g}x3|r;|j|jft||ƒƒ|j}q W|S)zÑGet 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.)rArŠrdÚtb_next)ÚtbrargrrrÚgetinnerframes3s    rkcCs ttdƒrtjdƒSdS)z?Return the frame of the caller or None if this is not possible.Ú _getframerN)rr{rlrrrrÚ currentframe>srmcCsttjdƒ|ƒS)z@Return a list of records for the stack above the caller's frame.r)rhr{rl)rarrrÚstackBsrncCsttjƒd|ƒS)zCReturn a list of records for the stack below the current exception.r)rkr{Úexc_info)rarrrÚtraceFsrpcCstjdj|ƒS)Nrb)rr>r)ÚklassrrrÚ_static_getmroOsrrc CsDi}ytj|dƒ}Wntk r0YnXtj||tƒS)Nr>)rÚ__getattribute__rBÚdictrˆÚ _sentinel)r_ÚattrZ instance_dictrrrÚ_check_instanceRs  rwc CsZxSt|ƒD]E}tt|ƒƒtkr y|j|SWqRtk rNYqRXq q WtS)N)rrÚ_shadowed_dictrrur>rY)rqrvÚentryrrrÚ _check_class[s  rzc Cs+yt|ƒWntk r&dSYnXdS)NFT)rrr†)r_rrrÚ_is_typeds   r{c Cs‹tjd}xwt|ƒD]i}y|j|ƒd}Wntk rKYqXt|ƒtjko||jdko||j|ks|SqWt S)Nr>) rr>rrrrYrr"r¹rSru)rqÚ dict_attrryZ class_dictrrrrxks  rxc Csut}t|ƒs`t|ƒ}t|ƒ}|tksKt|ƒtjkrft||ƒ}qfn|}t||ƒ}|tk rÊ|tk rÊtt|ƒdƒtk rÊtt|ƒdƒtk rÊ|Sn|tk rÚ|S|tk rê|S||krUx\tt|ƒƒD]E}tt|ƒƒtkr y|j |SWqNt k rJYqNXq q Wn|tk re|St |ƒ‚dS)aôRetrieve 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) rur{rrxrr rwrzrrr>rYrB)r_rvrZinstance_resultrqr|Z klass_resultryrrrÚgetattr_staticys6          r}Ú GEN_CREATEDÚ GEN_RUNNINGÚ GEN_SUSPENDEDÚ GEN_CLOSEDcCs:|jr tS|jdkr tS|jjdkr6tStS)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. Nrrx)Ú gi_runningrÚgi_framer�Úf_lastir~r€)Ú generatorrrrÚgetgeneratorstate®s r†cCsTt|ƒs$tdj|ƒƒ‚nt|ddƒ}|dk rL|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 generatorrƒN)r+r†rirCrƒr$)r…r%rrrÚgetgeneratorlocalsÀs    r‡Ú from_bytesc CsCyt||ƒ}Wntk r+dSYnXt|tƒs?|SdS)N)rCrBrÚ_NonUserDefinedCallables)rQZ method_nameÚmethrrrÚ"_signature_get_user_defined_methodßs   r‹cCs0|j}t|jƒƒ}|jp'f}|jp6i}|rL||}ny|j||Ž}WnCtk r§}z#dj|ƒ} t| ƒ|‚WYdd}~XnXd} xi|jƒD][\} } y|j | } Wnt k rìYn›X| j t kr|j | ƒq»n| j tkr_| |krId} | jd| ƒ|| |d kr>| }qŸn|rrd}|| ko_|d ksr| d ƒqrn| |ƒ|dkrŸ| dƒqŸqŸWdj |ƒ}|||fS)a¬ 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|]}|jdƒ‘qS)Úascii)Úencode)rPÚlrrrrR™s z6_signature_strip_non_python_syntax..rwFrrŸTrú/ú$r3z, ú rÑ) ryrìrírãrAréÚOPÚ ERRORTOKENÚnextrÚstringr€)Ú signatureÚself_parameterÚlast_positional_onlyr�r…Z token_streamZ delayed_commaZskip_next_commar.rDZcurrent_parameterr©rªÚtrr¬Úclean_signaturerrrÚ"_signature_strip_non_python_syntaxˆsP                r²TcsA|j‰t|ƒ\}}}d|d}ytj|ƒ}Wntk rYd}YnXt|tjƒs„tdj|ƒƒ‚n|j d} g‰ˆj ‰t ƒ‰d}i‰t |ddƒ} | r÷t jj| dƒ}|r÷|j‰q÷nt j‰dd„‰‡‡fdd †‰ G‡ fd d †d tjƒ‰ˆ‡‡‡‡‡‡‡fd d †} t| jjƒ} t| jjƒ} tj| | ddƒ}|dk r»ˆj‰n ˆj‰xQttt|ƒƒƒD]7\}\}}| ||ƒ||kr݈j‰qÝqÝW| jjrCˆj‰| | jjˆƒnˆj‰x6t| jj| jj ƒD]\}}| ||ƒqhW| jj!r°ˆj"‰| | jj!ˆƒn|dk r.t |ddƒ}|dk }t#|ƒ}|r|sø|rˆj$dƒq.ˆdj%dˆjƒ} | ˆd.parse_namecsÙyt|ˆƒ}WnCtk rXyt|ˆƒ}Wntk rStƒ‚YnXYnXt|tƒrutj|ƒSt|ttfƒr—tj |ƒSt|t ƒr³tj |ƒS|dkrÌtj |ƒStƒ‚dS)NTF)TFN) ÚevalÚ NameErrorÚ RuntimeErrorrrsÚastZStrÚintÚfloatZNumÚbytesZBytesZ NameConstant)r¦rM)Ú module_dictÚsys_module_dictrrÚ wrap_valueõs        z&_signature_fromstr..wrap_valuecs4eZdZ‡fdd†Z‡fdd†ZdS)z,_signature_fromstr..RewriteSymbolicscs‹g}|}x/t|tjƒr=|j|jƒ|j}qWt|tjƒs\tƒ‚n|j|jƒdj t |ƒƒ}ˆ|ƒS)Nr') rr¸rOrArvrMÚNamer·rgr€Úreversed)rÞr³ÚarHrM)r¾rrÚvisit_Attribute s  z<_signature_fromstr..RewriteSymbolics.visit_Attributecs.t|jtjƒs!tƒ‚nˆ|jƒS)N)rZctxr¸ZLoadrhrg)rÞr³)r¾rrÚ visit_Names z7_signature_fromstr..RewriteSymbolics.visit_NameN)r¹r…rØrÂrÃr)r¾rrÚRewriteSymbolicss  rÄcs¿ˆ|ƒ}|ˆkrdS|r™|tk r™y%ˆƒj|ƒ}tj|ƒ}Wntk rmˆ}YnX|ˆkr~dS|ˆk r�|n|}nˆjˆ|ˆd|dˆƒƒdS)Nrr)Ú_emptyZvisitr¸Z literal_evalrhrA)Z name_nodeZ default_noderr]Úo)Ú ParameterrÄrÚinvalidr`rr´rrÚps     z_signature_fromstr..pÚ fillvaluerGr`r)&Ú_parameter_clsr²r¸ÚparseÚ SyntaxErrorrZModulerhriZbodyrrrCr{r‡rˆr>ZNodeTransformerrÀrür Ú itertoolsÚ zip_longestÚPOSITIONAL_ONLYÚPOSITIONAL_OR_KEYWORDr4r¼ZvarargÚVAR_POSITIONALÚ KEYWORD_ONLYrUrþZ kw_defaultsrJÚ VAR_KEYWORDrrr�)rQr_r¦rr±r®r¯ZprogramrÁreZ module_namerÉrür rìrƒr]rÚ_selfZ self_isboundZ self_ismoduler) rÇrÄrrÈr`r¼rr´r½r¾rÚ_signature_fromstrÎsj        '   +     (      rÖcCsgt|ƒs$tdj|ƒƒ‚nt|ddƒ}|sTtdj|ƒƒ‚nt||||ƒS)Nz%{!r} is not a Python builtin functionÚ__text_signature__z#no signature found for builtin {!r})r˜r†rirCrhrÖ)rQrjrr¦rrrÚ_signature_from_builtinYs  rØc!Cs[t|ƒs$tdj|ƒƒ‚nt|tjƒrbt|j||ƒ}|r[t|ƒS|Sn|r«t |ddd„ƒ}t|tjƒr«t|d|d|ƒSny |j }Wnt k rÌYn8X|dk rt|t ƒstdj|ƒƒ‚n|Sy |j }Wnt k r%YnXt|tjƒr¤t|j||ƒ}t||dƒ}t|jjƒƒd}|ft|jjƒƒ}|jd |ƒSt|ƒs¼t|ƒrÉt j|ƒSt|ƒrètt |d|ƒSt|tjƒrt|j||ƒ}t||ƒSd}t|tƒr]tt|ƒd ƒ}|dk rgt|||ƒ}n`t|d ƒ} | dk r—t| ||ƒ}n0t|d ƒ} | dk rÇt| ||ƒ}n|dkrïxS|jdd…D]>} y | j} Wnt k rYqçX| rçt t || ƒSqçWt|jkrZ|j!t"j!krWt#t"ƒSqZqïn’t|t$ƒsïtt|ƒd ƒ}|dk rïyt|||ƒ}Wqìt%k rè} z#dj|ƒ}t%|ƒ| ‚WYdd} ~ XqìXqïn|dk r|r t|ƒS|Snt|tj&ƒrBdj|ƒ}t%|ƒ‚nt%dj|ƒƒ‚dS)Nz{!r} is not a callable objectrccSs t|dƒS)NÚ __signature__)r)rerrrr9ysz%_signature_internal..rrz1unexpected object {!r} in __signature__ attributerrÚ__call__Ú__new__rßrzno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)Nrx)'rœr†rirrrrr‰r—rlrÙrBÚ SignatureÚ_partialmethodÚ functoolsÚ partialmethodrjr•rWrrr�rržÚ from_functionr˜rØr’rr‹rbr×rÖrßrr­r‰rhr2)r_rrrrßr‘Zfirst_wrapped_paramr“ÚcallÚnewZinitrJZtext_sigrrErrrrgs¼                             (  rcCs t|ƒS)z/Get a signature object for the passed callable.)r)r_rrrr­ sr­c@seZdZdZdS)r�z0A private marker - used in Parameter & SignatureN)r¹r…rØrrrrrrr�s r�c@seZdZdS)rÅN)r¹r…rØrrrrrÅs rÅc@s4eZdZdd„Zdd„Zdd„ZdS)Ú_ParameterKindcGstj||Œ}||_|S)N)r¹rÛÚ_name)rÞr]rür_rrrrÛs z_ParameterKind.__new__cCs|jS)N)rä)rÞrrrÚ__str__ sz_ParameterKind.__str__cCsdj|jƒS)Nz<_ParameterKind: {!r}>)rirä)rÞrrrÚ__repr__#sz_ParameterKind.__repr__N)r¹r…rØrÛrårærrrrrãs   rãr]rÐrÑrÒérÓrÔc @sèeZdZdZdZeZeZe Z e Z e ZeZdededd „Zed d „ƒZed d „ƒZedd„ƒZedd„ƒZdededededd„Zdd„Zdd„Zdd„ZdS)rÇaRepresents 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`. räÚ_kindÚ_defaultÚ _annotationrrcCs÷|tttttfkr*tdƒ‚n||_|tk rr|ttfkrrdj|ƒ}t|ƒ‚qrn||_ ||_ |tkrŸtdƒ‚nt |t ƒsÆt dj|ƒƒ‚n|jƒsêtdj|ƒƒ‚n||_dS)Nz,invalid value for 'Parameter.kind' attributez({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {!r}z"{!r} is not a valid parameter name)rrrrrrhrèrÅrirérêrrsr†Ú isidentifierrä)rÞr]r`rrrErrrrßNs"       zParameter.__init__cCs|jS)N)rä)rÞrrrr]gszParameter.namecCs|jS)N)ré)rÞrrrrkszParameter.defaultcCs|jS)N)rê)rÞrrrroszParameter.annotationcCs|jS)N)rè)rÞrrrr`sszParameter.kindr]r`cCs|tkr|j}n|tkr0|j}n|tkrH|j}n|tkr`|j}nt|ƒ||d|d|ƒS)z+Creates a customized copy of the Parameter.rr)r�rärèrêrér)rÞr]r`rrrrrr�ws        zParameter.replacecCs¢|j}|j}|jtk r?dj|t|jƒƒ}n|jtk rldj|t|jƒƒ}n|tkr…d|}n|t kržd|}n|S)Nz{}:{}z{}={}r,z**) r`rärêrÅrir)rér(rr)rÞr`Ú formattedrrrrå‰s       zParameter.__str__cCs"dj|jjt|ƒ|jƒS)Nz<{} at {:#x} {!r}>)riÚ __class__r¹rgr])rÞrrrræœszParameter.__repr__cCsYt|tƒstS|j|jkoX|j|jkoX|j|jkoX|j|jkS)N)rrÇÚNotImplementedrärèrérê)rÞÚotherrrrÚ__eq__ s zParameter.__eq__N)z_namez_kindz_defaultz _annotation)r¹r…rØrrÚ __slots__rrÐrrÑrrÒrrÓrrÔrÅrrßrTr]rrr`r�r�rårærðrrrrrÇ.s$   rÇc@sdeZdZdZdd„Zedd„ƒZedd„ƒZedd „ƒZd d „Z d S) Ú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. cCs||_||_dS)N)rŽÚ _signature)rÞr­rŽrrrrߺs zBoundArguments.__init__cCs|jS)N)ró)rÞrrrr­¾szBoundArguments.signaturec CsŸg}xŒ|jjjƒD]x\}}|jttfkr>Pny|j|}Wntk rdPYqX|jtkr„|j |ƒq|j |ƒqWt |ƒS)N) rórr?r`rrrŽrYrÚextendrArW)rÞrür”r"r/rrrrüÂs zBoundArguments.argsc CsÐi}d}x½|jjjƒD]©\}}|sm|jttfkrOd}qm||jkrmd}qqmn|syqny|j|}Wntk ržYqX|jtkr¾|j|ƒq||| 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Ú _parametersNrÚ__validate_parameters__Tc Csg|dkrtƒ}n0|r/tƒ}t}d}xt|ƒD]è\}}|j} |j} | |kr‘d} | j|| ƒ} t| ƒ‚n| |kr¬d}| }n| ttfkrô|jt krë|rñd} t| ƒ‚qñqôd}n| |krdj| ƒ} t| ƒ‚n||| .)rrr4r`r]rirhrrrÅrÚMappingProxyTyperør÷) rÞrrrùr–Ztop_kindZ kind_defaultsÚidxr"r`r]rErrrrß s<            zSignature.__init__c CsÙd}t|ƒs?t|ƒr'd}q?tdj|ƒƒ‚n|j}|j}|j}|j}t|d|…ƒ}|j }||||…} |j } |j } |j } | rÆt | ƒ} nd} g}|| }xI|d|…D]7}| j|tƒ}|j||d|dtƒƒqíWx_t||d…ƒD]G\}}| j|tƒ}|j||d|dtd| |ƒƒq?W|jt@rÙ|||}| j|tƒ}|j||d|dtƒƒnxl| D]d}t}| dk r | j|tƒ}n| j|tƒ}|j||d|dtd|ƒƒqàW|jt@r·||}|jt@ry|d 7}n||}| j|tƒ}|j||d|dtƒƒn||d | jd tƒd |ƒS) z2Constructs Signature for the given python functionFTz{!r} is not a Python functionNrrr`rrrrrù)rržr†rirËr&rrrWrr›r™ršrnrˆrÅrArr4r'rrrrr)rQrjZis_duck_functionrÇZ func_codeZ pos_countZ arg_namesr>Zkeyword_only_countZ keyword_onlyr r r!Zpos_default_countrZnon_default_countr]rÚoffsetrrcrrrràO sj            #           zSignature.from_functioncCs t||ƒS)N)rØ)rQrjrrrÚ from_builtin  szSignature.from_builtincCs|jS)N)rø)rÞrrrr¤ szSignature.parameterscCs|jS)N)r÷)rÞrrrr¨ szSignature.return_annotationrcCsL|tkr|jjƒ}n|tkr6|j}nt|ƒ|d|ƒS)z�Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy. r)r�rrr÷r)rÞrrrrrr�¬ s    zSignature.replacec Cs/t|tƒstS|j|jksCt|jƒt|jƒkrGdSdd„t|jjƒƒDƒ}x¿t|jjƒƒD]¨\}\}}|j t krÝy|j|}Wnt k rÉdSYq'X||kr'dSqy||}Wnt k rdSYqX||ks#||j|krdSqWdS)NFcSsi|]\}}||“qSrr)rPrûr"rrrrO s z$Signature.__eq__..T) rrÜrîrrnrr4Úkeysr?r`rrY)rÞrïZother_positionsrûr”r"Z other_paramZ other_idxrrrrð» s. (      zSignature.__eq__r’FcCsbtƒ}t|jjƒƒ}f}t|ƒ}xðyt|ƒ}Wn tk rPyt|ƒ} Wntk rxPYnÔX| jtkrŒPnÀ| j|krä| jt kr×d} | j d| jƒ} t | ƒd‚n| f}Pnh| jt ks| j tk r| f}Pn=|r"| f}Pn*d} | j d| jƒ} t | ƒd‚Yq3Xyt|ƒ} Wn!tk r„t dƒd‚Yq3X| jt tfkr©t dƒ‚n| jtkrå|g} | j|ƒt| ƒ|| j {}) rrrsr`rrArrrir€rrÅr)) rÞr\Zrender_pos_only_separatorZrender_kw_only_separatorr"rìr`ZrenderedZannorrrråg s0          zSignature.__str__)z_return_annotationz _parameters)r¹r…rØrrrñrÇrËròrrÅrrßr[ràrýrTrrr�r�rðrrr�rårrrrrÜþs"  2Q   rÜcCsgddl}ddl}|jƒ}|jdddƒ|jdddd dd ƒ|jƒ}|j}|jd ƒ\}}}y|j|ƒ}} Wn`tk rù} z@d j |t | ƒj | ƒ} t | d t jƒtdƒWYdd} ~ XnX|r8|jdƒ} | }x | D]} t|| ƒ}qWn| j t jkrjt dd t jƒtdƒn|jrSt dj |ƒƒt dj t| ƒƒƒt dj | jƒƒ|| krt dj t| jƒƒƒt| dƒrFt dj | jƒƒqFn>yt|ƒ\}}Wntk r2YnXt dj |ƒƒt dƒnt t|ƒƒdS)z6 Logic for inspecting an object given at command line rNrÚhelpzCThe object to be analysed. It supports the 'module:qualname' syntaxz-dz --detailsÚactionÚ store_truez9Display info about the module rather than its source coder zFailed to import {} ({}: {})r¿rr'z#Can't get info for builtin modules.rz Target: {}z Origin: {}z Cached: {}z Loader: {}Ú__path__zSubmodule search path: {}zLine: {}rw)Úargparser¡ÚArgumentParserÚ add_argumentÚ parse_argsrÚ partitionÚ import_modulerXrirr¹Úprintr{ÚstderrÚexitryrCÚbuiltin_module_namesZdetailsr³Ú __cached__r(r¨rrrÐrò)rr¡ÚparserrüÚtargetZmod_nameZ has_attrsZattrsr_rÁr^rEÚpartsÚpartÚ__rbrrrÚ_main” sV              rr¸)�rrÚ __author__r¸Úimportlib.machineryr¡rÎr±ršrËr{rãrérr“rÞrºÚoperatorrÚ collectionsrrZdisrZ _flag_namesÚ ImportErrorZ CO_OPTIMIZEDZ CO_NEWLOCALSrrZ CO_NESTEDr(Z CO_NOFREEÚglobalsZmod_dictr?rKrLr6rrrrrrr!r#rr)r+r-r/r1r3r4r7rNrOrar:rlrqrvrtr�rŽr r¥r³r·r»r½r°rÐrÖrXr×rÙrðrñròrórørùrrúrr rr r#r&r)r+rsr:r=rDrFrKrLr[r\rdrerhrkrmrnrprrurrrwrzr{rxr}r~rr€r�r†r‡rrÚZ_WrapperDescriptorÚallZ_MethodWrapperr¹r>Z_ClassMethodWrapperr2r‰r‹r•r—r˜ržr¢r²rÖrØrr­r�rÅrãrrrrrrÇròrÜrr¹rrrrÚs8                           , t !       . I -'     X        )     > 5!       0    K    F‹¦  {Uÿ— :