HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sphinx/util/__pycache__/inspect.cpython-310.pyc
o

u�am}�
@s$dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZddl
mZddlmZmZmZmZmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZdd	l m!Z!dd
l"m#Z#ddl"m$Z%ddl&m'Z'dd
l(m)Z)ddl(m*Z+ej,dkr�ddlm-Z-m.Z.m/Z/ne0e1j2�Z-e0e3j4�Z.e0e5j6d�Z/	e'�7e8�Z9e�:dej;�Z<dedefdd�Z=dedefdd�Z>dd�dededefdd�Z?dedeee3fd d!�Z@dedee3effd"d#�ZAdedee3effd$d%�ZBdedeed&ffd'd(�ZCdedeeed&ffd)d*�ZDdedeefd+d,�ZEdedeFfd-d.�ZGd/edeFfd0d1�ZHd/edeFfd2d3�ZIdedefd4d5�ZJdedeFfd6d7�ZKd�ded8ed9e3deFfd:d;�ZLd�ded8ed9e3deFfd<d=�ZMd/edeFfd>d?�ZNdedeFfd@dA�ZOdedeFfdBdC�ZPdedeFfdDdE�ZQdedeFfdFdG�ZRdedeFfdHdI�ZSdedeFfdJdK�ZTdedeFfdLdM�ZUdedeFfdNdO�ZVdedeFfdPdQ�ZWdedeFfdRdS�ZXdedeFfdTdU�ZYdedeFfdVdW�ZZded9e3dXedefdYdZ�Z[d[ede3fd\d]�Z\ded^e3deFfd_d`�Z]Gdadb�db�Z^Gdcdd�dd�Z_Gdedf�df�Z`Gdgdh�dhee3ef�ZadiedeFfdjdk�ZbddifdiedleFdmeFdnedejcf
dodp�Zdd�dqejcdredsedejcfdtdu�Ze	v	vd�dqejcdweFdxeFde3fdydz�Zfdpe3dejcfd{d|�Zgd�d~e#jhde3dejcfd�d��Zie[dddfded�ed�eFd8ed9e3de3fd�d��ZjdS)�z�
    sphinx.util.inspect
    ~~~~~~~~~~~~~~~~~~~

    Helpers for inspecting Python modules.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�partial�
partialmethod)�
import_module)�	Parameter�isclass�ismethod�ismethoddescriptor�ismodule)�StringIO)�
ModuleType)	�Any�Callable�Dict�Mapping�Optional�Sequence�Tuple�Type�cast)�RemovedInSphinx50Warning)�ast)�unparse)�logging)�
ForwardRef)�	stringify)��)�ClassMethodDescriptorType�MethodDescriptorType�WrapperDescriptorType�fromkeysF)rz at 0x[0-9a-f]{8,16}(?=>)�func�returnc	Cs6tjdtdd�t�|�}g}d}d}g}d}i}d}i}|j|jur(|j|d<|j��D]Z}	|	j	}
|	j
}|
tjur@|�
|�n<|
tjurW|�
|�|	j|	jurV||	jf7}n%|
tjur_|}n|
tjuru|�
|�|	j|	jurt|	j||<n|
tjur||}|	j|	jur�|	j||<q-|s�d}|s�d}t�|||||||�S)zPLike inspect.getfullargspec but supports bound methods, and wrapped
    methods.z-sphinx.ext.inspect.getargspec() is deprecated���
stacklevelN�r")�warnings�warnr�inspect�	signature�return_annotation�empty�
parameters�values�kind�namer�POSITIONAL_ONLY�append�POSITIONAL_OR_KEYWORD�default�VAR_POSITIONAL�KEYWORD_ONLY�VAR_KEYWORD�
annotation�FullArgSpec)r!�sig�args�varargs�varkw�
kwonlyargs�defaults�annotations�
kwdefaults�paramr/r0r&r&�5/usr/lib/python3/dist-packages/sphinx/util/inspect.py�
getargspec;sV�




�



�

��rD�objcCs4zt|d�r	|WSt�|�WSty|YSw)z?Get an original object from wrapped object (wrapped functions).�__sphinx_mock__)�hasattrr)�unwrap�
ValueError�rEr&r&rCrHqs
�rH��stoprLcCsd	|r	||�r	|St|�r|j}n t�|�rt|d�r|j}nt|�r'|j}n
t|�r/|j}n|Sq)zx
    Get an original object from wrapped object (unwrapping partials, wrapped
    functions, and other decorators).
    T�__wrapped__)	�	ispartialr!r)�	isroutinerGrM�
isclassmethod�__func__�isstaticmethod)rErLr&r&rC�
unwrap_all~s�rScCsDt|dd�}|durdSt|ttf�rtdd�|D��r|St|��)z�Get __all__ attribute of the module as dict.

    Return None if given *obj* does not have __all__.
    Raises ValueError if given *obj* have invalid __all__.
    �__all__Ncss�|]}t|t�VqdS�N��
isinstance�str��.0�er&r&rC�	<genexpr>�s�zgetall.<locals>.<genexpr>)�safe_getattrrW�list�tuple�allrI)rErTr&r&rC�getall�s racC�t|dd�}t|t�r
|SiS)z,Get __annotations__ from given *obj* safely.�__annotations__N�r]rWr)rErcr&r&rC�getannotations��
recCrb)z(Get __globals__ from given *obj* safely.�__globals__Nrd)rErgr&r&rC�
getglobals�rfrh.cCs t|dd�}t|t�r
|St�S)z$Get __mro__ from given *obj* safely.�__mro__N)r]rWr_)rErir&r&rC�getmro�s
rjcCsBt�|�sdSt|di�}|�d�}t|t�rt|�dkr|SdS)z%Get __orig_bases__ from *obj* safely.N�__dict__�__orig_bases__r)r)rr]�getrWr_�len)rErkrlr&r&rC�getorigbases�s

rocCsft�|�st�t|dd�}|durdSt|t�r|St|t�r#|diSt|ttf�r1dd�|D�St	�)z�Get __slots__ attribute of the class as dict.

    Return None if gienv *obj* does not have __slots__.
    Raises TypeError if given *obj* is not a class.
    Raises ValueError if given *obj* have invalid __slots__.
    �	__slots__NcSsi|]}|d�qSrUr&rYr&r&rC�
<dictcomp>�szgetslots.<locals>.<dictcomp>)
r)r�	TypeErrorr]rW�dictrXr^r_rI)rErpr&r&rC�getslots�s


rtcCsFtjdkrt|tj�St|dd�}t|dd�}|dkr!|dkr!dSdS)	z)Check the if object is a kind of NewType.)r�
�
__module__N�__qualname__�typingzNewType.<locals>.new_typeTF)�sys�version_inforWrx�NewTyper])rErvrwr&r&rC�	isNewType�s
r|�xcCst�|�o
t|tj�S)z(Check if the object is subclass of enum.)r)r�
issubclass�enum�Enum�r}r&r&rC�isenumclass�sr�cCst|tj�S)z)Check if the object is attribute of enum.)rWrr�r�r&r&rC�isenumattribute�sr�cCst|�r|j}t|�s|S)zfGet an original object from partial object.

    This returns given object itself if not partial.
    )rNr!rJr&r&rC�	unpartial�s�r�cCst|ttf�S)zCheck if the object is partial.)rWrrrJr&r&rCrN�rN�clsr0cCsrt|t�rdSt�|�r|jdurt|j�rdS|r7|r7t�}t|�D]}|j�	||�}||ur6t
|�Sq#dS)z#Check if the object is classmethod.TNF)rW�classmethodr)r�__self__r�objectrjrkrmrP)rEr�r0�placeholder�basecls�methr&r&rCrP
s
�rPcCsTt|t�rdS|r(|r(t|d|g�D]}|j�|�}|r't|t�r$dSdSqdS)z$Check if the object is staticmethod.TriF)rW�staticmethod�getattrrkrm)rEr�r0r�r�r&r&rCrRs

�rRcCs&dD]}tt||d�d�rdSqdS)z/Check if the object is some kind of descriptor.)�__get__�__set__�
__delete__N�__call__TF)rGr])r}�itemr&r&rC�isdescriptor-s
�r�cCst|dd�duS)z)Check if the object is an abstractmethod.�__isabstractmethod__FT�r]rJr&r&rC�isabstractmethod5sr�cCs$z|jjdkWStyYdSw)z6Check if the object is a function or method in cython.�cython_function_or_methodF)�	__class__�__name__�AttributeErrorrJr&r&rC�is_cython_function_or_method:s
�r�cCs�t�|�rdSt|�r@t|�}t|�st|�st�|�rdSt|�r$dSt�|�r+dSt	|t
ttf�r5dSt
|�jdkr>dSdSdS)z4Check if the object is an attribute like descriptor.TF�instancemethod)r)�isdatadescriptorr�rH�
isfunction�	isbuiltinrr�rrWrrr�typer�)rE�	unwrappedr&r&rC�isattributedescriptorBs&

�r�cCs2t�|�rt|d�rt|d�r|jjdkrdSdS)z/Check if the object is singledispatch function.�dispatch�register�	functoolsTF)r)r�rGr�rvrJr&r&rC�is_singledispatch_functionas
��r�cCs.zddlm}t||�WStyYdSw)z-Check if the object is singledispatch method.r)�singledispatchmethodF)r�r�rW�ImportError)rEr�r&r&rC�is_singledispatch_methodls�r�cC�t�t|��S)z Check if the object is function.)r)r�rSrJr&r&rCr�ur�r�cCr�)zCheck if the object is builtin.)r)r�rSrJr&r&rCr�zr�r�cCr�)z(Check is any kind of function or method.)r)rOrSrJr&r&rCrOr�rOcCs:dtdtfdd�}t||d�}t|d�rt�|�rdSdS)	z*Check if the object is coroutine-function.rEr"cSs.t|�st|�st|�rdSt|d�rdSdS)z2Check if the object is wrapped coroutine-function.FrMT)rRrPrNrGrJr&r&rC�iswrappedcoroutine�s

z/iscoroutinefunction.<locals>.iswrappedcoroutinerK�__code__TF)r�boolrSrGr)�iscoroutinefunction)rEr�r&r&rCr��s
r�cCst|d�rt�|�rdSdS)z*Check if the object is async-gen function.r�TF)rGr)�isasyncgenfunctionrJr&r&rCr��sr�cCs.tjdkrddlm}t||�rdSt|t�S)z Check if the object is property.)r�r)�cached_propertyT)ryrzr�r�rW�property)rEr�r&r&rC�
isproperty�s



r�cCsRttd�r
t|tj�r
dSttd�rt|tj�rdSttd�r't|tj�r'dSdS)z$Check if the object is GenericAlias.�
_GenericAliasT�GenericAlias�_SpecialGenericAliasF)rGrxrWr��typesr�r�rJr&r&rC�isgenericalias�s

�

�

�r��defargscGs|z
t||g|�R�WSty=}z'z|j|WWYd}~Sty'Ynw|r4|dWYd}~St|�|�d}~ww)z;A getattr() that turns all exceptions into AttributeErrors.Nr)r��	Exceptionrkr�)rEr0r��excr&r&rCr]�s�
��r]r�c
s0t�t�r%zt��}Wn	tyYnbw�fdd�|D�}dd�|�St�t�rFzt��}Wn	ty9Yn=wdd�dd�|D��St�t�rgzt��}Wn	tyZYnwdd�dd�|D��St�tj	�rvd�j
j�jfSzt
��}Wnty�}zt|�d	}~wwt�d
|�}|�dd�S)
zFA repr() implementation that returns text safe to use in reST context.c3s(�|]}dt|�t�|�fVqdS)z%s: %sN��object_description)rZ�key�r�r&rCr\�s���z%object_description.<locals>.<genexpr>z{%s}�, cs��|]}t|�VqdSrUr��rZr}r&r&rCr\�s�zfrozenset({%s})csr�rUr�r�r&r&rCr\�s��z%s.%sN��
� )rWrs�sortedr��join�setrr�	frozensetrr�r�r�r0�reprrI�memory_address_re�sub�replace)r��sorted_keys�items�
sorted_values�sr�r&r�rCr��sH
�
�
�
�
���r��	attr_namecslzt|�}t�fdd�|D��}Wn
tyYdSwzt|d�}Wn
ty-YdSwtt|d�|uS)z�If attr_name is implemented at builtin class, return True.

        >>> is_builtin_class_method(int, '__init__')
        True

    Why this function needed? CPython implements int.__init__ by Descriptor
    but PyPy implements it by pure Python code.
    c3s$�|]
}�t|di�vr|VqdS)rkNr�)rZ�c�r�r&rCr\s�"z*is_builtin_class_method.<locals>.<genexpr>Fr�N)rj�next�
StopIterationr]r�r��builtins)rEr��mror�r0r&r�rC�is_builtin_class_method�s	��r�c@sBeZdZdZdeddfdd�Zdedefdd	�Zdefd
d�Z	dS)�DefaultValuezKA simple wrapper for default value of the parameters of overload functions.�valuer"NcC�
||_dSrU�r�)�selfr�r&r&rC�__init__�
zDefaultValue.__init__�othercC�
|j|kSrUr��r�r�r&r&rC�__eq__r�zDefaultValue.__eq__cCs|jSrUr��r�r&r&rC�__repr__szDefaultValue.__repr__)
r�rvrw�__doc__rXr�r�r�r�r�r&r&r&rCr�s
r�c@s>eZdZdZdeddfdd�Zddd�Zd	edefd
d�Z	dS)
�TypeAliasForwardRefzPseudo typing class for autodoc_type_aliases.

    This avoids the error on evaluating the type inside `get_type_hints()`.
    r0r"NcCr�rU�r0)r�r0r&r&rCr�$r�zTypeAliasForwardRef.__init__cCsdSrUr&r�r&r&rCr�'szTypeAliasForwardRef.__call__r�cCr�rUr�r�r&r&rCr�+r�zTypeAliasForwardRef.__eq__)r"N)
r�rvrwr�rXr�r�rr�r�r&r&r&rCr�s

r�c@s@eZdZdZdedeeefddfdd�Zdedefd	d
�ZdS)�TypeAliasModulez-Pseudo module class for autodoc_type_aliases.�modname�mappingr"NcCs||_||_d|_dSrU)�_TypeAliasModule__modname�_TypeAliasModule__mapping�_TypeAliasModule__module)r�r�r�r&r&rCr�2s
zTypeAliasModule.__init__r0cs�d�td|j|g��}||jvrt|j|�S|d��fdd�|j��D�}|r.t||�Szt|�WStyM|j	durEt|j�|_	t
|j	|�YSw)N�.c� i|]\}}|���r||�qSr&��
startswith�rZ�k�v��prefixr&rCrq?� z/TypeAliasModule.__getattr__.<locals>.<dictcomp>)r��filterr�r�r�r�r�rr�r�r�)r�r0�fullname�nestedr&r�rC�__getattr__8s



�zTypeAliasModule.__getattr__)	r�rvrwr�rXrr�rr�r&r&r&rCr�/sr�c@s<eZdZdZdeeefddfdd�Zdedefdd	�ZdS)
�TypeAliasNamespacez�Pseudo namespace class for autodoc_type_aliases.

    This enables to look up nested modules and classes like `mod1.mod2.Class`.
    r�r"NcCr�rU)�_TypeAliasNamespace__mapping)r�r�r&r&rCr�Vr�zTypeAliasNamespace.__init__r�csJ||jvrt|j|�S|d��fdd�|j��D�}|r#t||�St�)Nr�cr�r&r�r�r�r&rCrq_r�z2TypeAliasNamespace.__getitem__.<locals>.<dictcomp>)rr�r�r��KeyError)r�r�r�r&r�rC�__getitem__Ys

zTypeAliasNamespace.__getitem__)	r�rvrwr�rrXr�rrr&r&r&rCr�Psr��subjectcCs.t|�}|�d�dkr|�d�tjkrdSdS)z<Check the function should be unwrapped on getting signature.r��
contextlib�__file__TF)rhrmrr)rrgr&r&rC�_should_unwrapgs
r�bound_method�follow_wrapped�type_aliasescCsz|durd}ntjdtdd�z.zt|�rt�|�}ntj||d�}Wnty1t�|�}Ynwt|j�	��}|j
}WntyRt|d�rOg}t
j}n�YnwzEt|�}t�|d|�}t|�D]\}	}
|
j|vr�||
j}t|t�ry|j}|
j|d�||	<qcd	|vr�t|d	t�r�|d	j}n|d	}Wn	ty�Ynw|r�t�|�r�nt|�d
kr�|�d
�tj||dd�S)
z�Return a Signature object for the given *subject*.

    :param bound_method: Specify *subject* is a bound method or not
    :param follow_wrapped: Same as ``inspect.signature()``.
    NTzLThe follow_wrapped argument of sphinx.util.inspect.signature() is deprecatedr#r$)r�_partialmethod�r8r"rF)r+�__validate_parameters__)r'r(rrr)r*rIr^r-r.r+�
IndexErrorrGrr,r�rx�get_type_hints�	enumerater0rWr�r�r�rrn�pop�	Signature)rrrr	r*r-r+�localnsr@�irBr8r&r&rCr*rsb���

��



���

�r*r:�globalnsrc	s�dtdtdtdtfdd��dtdtdtdtf�fdd	�}|d
ur"i}|d
ur(|}t|j���}t|�D]\}}|jrI||j||�}|j|d�||<q3|j	}|rU||||�}|j||d�S)
z;Evaluate unresolved type annotations in a signature object.�refrrr"cSs&tjdkr
|�||t��S|�||�S)zEvaluate a forward reference.)r�	)ryrz�	_evaluater�)rrrr&r&rC�evaluate_forwardref�s
z/evaluate_signature.<locals>.evaluate_forwardrefr8c	s�z7t|t�r2t|d�}�|||�}t|t�r�|||�}W|St|t�r5t|d�}�|||�}W|SW|SW|SttfyCY|Sw)z$Evaluate unresolved type annotation.T)rWrXr�	NameErrorrr)r8rrr�rr&rC�evaluate�s&


	
�
����z$evaluate_signature.<locals>.evaluateNr)r-r+)
rrrr^r-r.rr8r�r+)	r:rrrr-rrBr8r+r&rrC�evaluate_signature�s �rT�show_annotation�show_return_annotationcCs�g}d}|j��D]�}|j|jkr||jkr|�d�|j|jkr/||j|jdfvr/|�d�t�}|j|jkrA|�	d|j
�n|j|jkrP|�	d|j
�n|�	|j
�|rk|j|j
urk|�	d�|�	t|j��|j|j
ur�|r|j|j
ur|�	d�n|�	d�|�	t|j��|�|���|j}q	|tjkr�|�d�|jtj
us�|dus�|dur�d	d
�|�St|j�}dd
�|�|fS)zYStringify a Signature object.

    :param show_annotation: Show annotation in result
    N�/�*z**z: z = �=Fz(%s)r�z
(%s) -> %s)r-r.r/r1r2r6r3r
r5�writer0r7r8r,�stringify_annotationr4r��getvaluerr+r�)r:rrr;�	last_kindrB�argr8r&r&rC�stringify_signature�sD
�





r'cCs2d|d}t�|�}ttj|jd�}t||�S)z&Create a Signature object from string.zdef funcz: passr)r�parser�FunctionDef�body�signature_from_ast)r*�code�module�functionr&r&rC�signature_from_strs

r/r��noder,c
	Cs,|j}t|j�}g}t|d�rt|j�}|t|j�}nd}t|j�}tt|�|�D]	}|�dtj	�q*t|d�rmt
|j�D].\}}	||tj	urMtj	}
n	tt|||��}
t|	j
|�p^tj	}|�t|	jtj|
|d��q>t
|j�D]2\}}	|||tj	ur�tj	}
ntt||||��}
t|	j
|�p�tj	}|�t|	jtj|
|d��qr|jr�t|jj
|�p�tj	}|�t|jjtj|d��t
|j�D]%\}}	t|j||�p�tj	}
t|	j
|�p�tj	}|�t|	jtj|
|d��q�|j�rt|jj
|�p�tj	}|�t|jjtj|d��t|j|��ptj	}tj||d�S)z*Create a Signature object from AST *node*.�posonlyargsr)r4r8r)r+)r;r^r?rGrnr1�range�insertrr,rr��ast_unparser8r2r&r1r3�varargr5r>�kw_defaultsr6�kwargr7�returnsr)r)
r0r,r;r?�paramsr1�positionals�_rr&r4r8r+r&r&rCr+'sZ





�
��
��r+�
attrgetter�allow_inheritedc	Cs>tfdtdtdttfdd�}|r<|r<t|||�r<t|�D]}|j�|�}|r;t	|d�r;t
|j�}|dus7|s;|Sq||�}t|�rO||j
jkrOt
|j�S|dur�|r�|r�|r�t|�D]}t||d�}|durs||�}|dursnq]|dur�t|�D]}t||d�}|dur�t�
|�}|dur�nq||dur�t�
|�}|S)z�Get the docstring for the object.

    This tries to obtain the docstring for some kind of objects additionally:

    * partial functions
    * inherited docstring
    * inherited decorated methods
    rEr<r"cSs||dd�}t|t�r
|SdS)Nr�rV)rEr<�docr&r&rC�getdoc_internaljs
zgetdoc.<locals>.getdoc_internalrQN)r]rr
rrXrPrjrkrmrG�getdocrQrNr�r�r!r))	rEr<r=r�r0r?r�r�r>r&r&rCr@`s@

�
�
�
r@)NN)TT)r�)kr�r�rrr)�reryr�rxr'r�rr�	importlibrrrrrr	�ior
rrr
rrrrrrr�sphinx.deprecationr�sphinx.pycode.astrrr4�sphinx.utilr�sphinx.util.typingrrr#rzrrrr�r�r�rXr�rsrk�	getLoggerr��logger�compile�
IGNORECASEr�rDrHrSrarerhrjrortr�r|r�r�r�rNrPrRr�r�r�r�r�r�r�r�rOr�r�r�r�r]r�r�r�r�r�r�rrr*rr'r/r)r+r@r&r&r&rC�<module>s�
,



6
			
	

(
!��
�I
�/��
�4	9�����