
    Kh                         S r SSKrSS/rS rS rS rSu  rrrr	S	 r
S
 rS rS r\4S jrSSS\S S S \4S jr\S S S \4S jrg)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formatargspecc                 6    [        U [        R                  5      $ )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
    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

)
isinstancetypes
MethodTypeobjects    G/var/www/html/env/lib/python3.13/site-packages/numpy/_utils/_inspect.pyismethodr      s     fe..//    c                 6    [        U [        R                  5      $ )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
    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__)

)r   r   FunctionTyper	   s    r   
isfunctionr      s     fe0011r   c                 6    [        U [        R                  5      $ )aC  Return 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

)r   r   CodeTyper	   s    r   iscoder   )   s    $ fenn--r   )            c                    [        U 5      (       d  [        S5      eU R                  nU R                  n[	        USU 5      n[        U5       H  nX4   SS S;   d  M  [        S5      e   SnU R                  [        -  (       a  U R                  U   nUS-   nSnU R                  [        -  (       a  U R                  U   nX5U4$ )a  Get 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.

zarg is not a code objectNr   ) .z*tuple function arguments are not supported)	r   	TypeErrorco_argcountco_varnameslistrangeco_flags
CO_VARARGSCO_VARKEYWORDS)conargsnamesargsivarargsvarkws          r   getargsr*   A   s     "::233NNENNEfuD
 5\72A;)#HII  G	{{Z..'	E	{{^#u%%r   c                     [        U 5      (       a  U R                  n [        U 5      (       d  [        S5      e[	        U R
                  5      u  pnXX0R                  4$ )aY  Get 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.

zarg is not a Python function)r   __func__r   r   r*   __code____defaults__)funcr&   r(   r)   s       r   r   r   `   sQ     ~~}}d677"4==1D5%!2!222r   c                 N    [        U R                  5      u  pnXX0R                  4$ )aI  Get 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_codef_locals)framer&   r(   r)   s       r   getargvaluesr4   q   s&     #5<<0D5%//r   c                 d    [        U 5      S:X  a  SU S   -   S-   $ SSR                  U 5      -   S-   $ )Nr   (r   z,), ))lenjoin)seqs    r   joinseqr<   }   s8    
3x1}SV|d""TYYs^#c))r   c           
          [        U 5      [        [        4;   a#  U" U  Vs/ s H  n[        X1U5      PM     sn5      $ U" U 5      $ s  snf )z=Recursively walk a sequence, stringifying each element.

    )typer   tuplestrseq)r
   convertr:   _os       r   r@   r@      sE     F|e}$@2VB.@AAv As   Ac                     SU -   $ N* names    r   <lambda>rI      s    S4Zr   c                     SU -   $ Nz**rF   rG   s    r   rI   rI      s    4$;r   c                     S[        U 5      -   $ N=reprvalues    r   rI   rI      s    C$u+,=r   c	                    / n	U(       a  [        U 5      [        U5      -
  n
[        [        U 5      5       H>  n[        X   XH5      nU(       a  UW
:  a  X" X;U
-
     5      -   nU	R                  U5        M@     Ub  U	R                  U" U5      5        Ub  U	R                  U" U5      5        SSR	                  U	5      -   S-   $ )aY  Format 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.

r6   r7   r8   )r9   r   r@   appendr:   )r&   r(   r)   defaults	formatargformatvarargsformatvarkwformatvaluer:   specsfirstdefaultr'   specs                r   r   r      s     E4y3x=03t9dgy/\)+h</?&@AADT	 
 ]7+,['(5!!C''r   c                     SU -   $ rD   rF   rG   s    r   rI   rI      s    sTzr   c                     SU -   $ rK   rF   rG   s    r   rI   rI      s    TD[r   c                     S[        U 5      -   $ rM   rO   rQ   s    r   rI   rI      s    cDK.?r   c	                 $   UXG4S jn	U  V
s/ s H  n
[        XU5      PM     nn
U(       a"  UR                  U" U5      U" X1   5      -   5        U(       a"  UR                  U" U5      U" X2   5      -   5        SSR                  U5      -   S-   $ s  sn
f )aX  Format 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.

c                 (    U" U 5      U" X   5      -   $ )NrF   )rH   localsrV   rY   s       r   rA    formatargvalues.<locals>.convert   s    V\!:::r   r6   r7   r8   )r@   rT   r:   )r&   r(   r)   rb   rV   rW   rX   rY   r:   rA   argrZ   s               r   formatargvaluesre      s     $#; 4884CVC$'4E8]7+k&/.JJK['+fm*DDE5!!C'' 9s   B)__doc__r   __all__r   r   r   CO_OPTIMIZEDCO_NEWLOCALSr!   r"   r*   r   r4   r<   r@   strr   re   rF   r   r   <module>rk      s    
)02., :D 6lJ >3"
0* ")  !%D4 76=(: ""9 8 ? (r   