bgdZddlZddgZdZdZdZd\ZZZZ d Z d Z d Z d Z e fd Zdddeddde fdZeddde fdZdS)zSubset of inspect module from upstream python We use this instead of upstream because upstream inspect is slow to import, and significantly contributes to numpy import times. Importing this copy has almost no overhead. N getargspec formatargspecc6t|tjS)aReturn 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 im_class class object in which this method belongs im_func function object containing implementation of method im_self instance to which this method is bound, or None ) isinstancetypes MethodTypeobjects L/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/_utils/_inspect.pyismethodr s fe. / //c6t|tjS)aReturn 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 func_code code object containing compiled function bytecode func_defaults tuple of any default values for arguments func_doc (same as __doc__) func_globals global namespace in which this function was defined func_name (same as __name__) )rr FunctionTyper s r isfunctionrs fe0 1 11r c6t|tjS)aReturn 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 )rrCodeTyper s r iscoder)s$ fen - --r )czt|std|j}|j}t |d|}t |D]#}||dddvrtd$d}|jtzr|j|}|dz}d}|jtzr |j|}|||fS)aGet information about the arguments accepted by a code object. Three things are returned: (args, varargs, varkw), where 'args' is a list of argument names (possibly containing nested lists), and 'varargs' and 'varkw' are the names of the * and ** arguments or None. zarg is not a code objectNr).z*tuple function arguments are not supported) r TypeError co_argcount co_varnameslistrangeco_flags CO_VARARGSCO_VARKEYWORDS)conargsnamesargsivarargsvarkws r getargsr*As "::42333 NE NE fuf  D 5\\JJ 72A2;) # #HII I $G {Z.'  E {^#&u% % r ct|r|j}t|stdt |j\}}}||||jfS)amGet the names and default values of a function's arguments. A tuple of four things is returned: (args, varargs, varkw, defaults). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments. zarg is not a Python function)r __func__rrr*__code__ __defaults__)funcr&r(r)s r rr`s`~~} d  86777"4=11D'5 %!2 22r cHt|j\}}}||||jfS)aaGet 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 (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'locals' is the locals dictionary of the given frame. )r*f_codef_locals)framer&r(r)s r getargvaluesr4qs+#5<00D'5 % //r czt|dkrd|dzdzSdd|zdzS)Nr(rz,), ))lenjoin)seqs r joinseqr<}s> 3xx1}}SV|d""TYYs^^#c))r ct|ttfvrfd|DS|S)z=Recursively walk a sequence, stringifying each element. c2g|]}t|Sstrseq).0_oconvertr:s r zstrseq..s%@@@2VB..@@@r )typertuple)r rDr:s ``r rArAsQ F||e}$$t@@@@@@@@AAAwvr c d|zSN*r?names r rMs S4Zr c d|zSNz**r?rKs r rMrMs 4$;r c&dt|zSN=reprvalues r rMrMsC$u++,=r c g} |rt|t|z } tt|D]M} t|| ||} |r| | kr| ||| | z z} | | N|| |||| ||dd| zdzS)amFormat an argument spec from the 4 values returned by getargspec. The first four arguments are (args, varargs, varkw, defaults). The other 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. Nr6r7r8)r9rrAappendr:) r&r(r)defaults formatarg formatvarargs formatvarkw formatvaluer:specs firstdefaultr'specs r rrs E14yy3x==0 3t99  d1gy$//  B\))++hq.converts#yVD\!:!:::r c2g|]}t|Sr?r@)rBargrDr:s r rEz#formatargvalues..s% 8 8 8CVC$ ' ' 8 8 8r r6r7r8)rXr:) r&r(r)rfrZr[r\r]r:r^rDs ` @r formatargvaluesris$#;;;; 9 8 8 8 84 8 8 8EL ]]7++kk&/.J.JJKKK F [[''++fUm*D*DDEEE 5!! !C ''r )__doc__r__all__r rr CO_OPTIMIZED CO_NEWLOCALSr!r"r*rr4r<rAstrrrir?r r ros$  ) 0 0 0 2 2 2...,:D6 lJ   >333" 0 0 0*** ")!%D4 7 766== ((((:""9"9 8 8 ? ? ((((((r