
    Rie                       U d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddlm
Z
mZ ddlmZ ddlmZ ddlmZ e
r4dd	lmZ dd
lmZmZmZmZmZ ddlmZ ddlmZ ddlmZ ddd fZddd fZefZ de!d<   	 ddlZe ej                  fz  Z  ejF                  e$      Z%i ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5i d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWi dXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{iZ&d|e!d}<   dd~Z'ddd fZ(ddd fZ)e
r G d de      Z*nddd fZ*ddd fZ+ddd fZ,ddd fZ- G d dej\                  d      Z/e
rddd fZ0	 	 	 d	 	 	 	 	 	 	 	 	 ddZ1ddZ2ddZ3ddZ4dddZ5ddZ6	 ddd	 	 	 	 	 	 	 ddZ7ddZ8i Z9de!d<   ddZ:y# e"$ r Y dw xY w)zThe composite types for Sphinx.    )annotationsN)CallableSequence)TYPE_CHECKINGTypeAliasType)nodes)Inliner)logging)Mapping)	AnnotatedAnyFinalLiteralProtocol)TypeIs)Sphinx)_InventoryItem_RestifyModec                     t         d   S )N)fully-qualified-except-typingsmartr        J/home/agent/.friday_env/lib/python3.12/site-packages/sphinx/util/typing.pyr   r      s    	 r   _StringifyModec                     t         d   S )N)r   fully-qualifiedr   r   r   r   r   r   r      s    '	 r   ztuple[type, ...]AnyTypeAliasType)_contextvarsContextzcontextvars.Context)r    
ContextVarzcontextvars.ContextVar)r    Tokenzcontextvars.Token)_ctypesArrayzctypes.Array)r$   	Structurezctypes.Structure)r$   Unionzctypes.Union)_ioBufferedRandomzio.BufferedRandom)r(   BufferedReaderzio.BufferedReader)r(   BufferedRWPairzio.BufferedRWPair)r(   BufferedWriterzio.BufferedWriter)r(   BytesIOz
io.BytesIO)r(   FileIOz	io.FileIO)r(   StringIOzio.StringIO)r(   TextIOWrapperzio.TextIOWrapper)zjson.decoderJSONDecoderzjson.JSONDecoder)zjson.encoderJSONEncoderzjson.JSONEncoder)_lzmaLZMACompressorzlzma.LZMACompressor)r3   LZMADecompressorzlzma.LZMADecompressor)zmultiprocessing.contextProcesszmultiprocessing.Process)pathlib._localPathzpathlib.Path)r7   	PosixPathzpathlib.PosixPath)r7   PurePathzpathlib.PurePath)r7   PurePosixPathzpathlib.PurePosixPath)r7   PureWindowsPathzpathlib.PureWindowsPath)r7   WindowsPathzpathlib.WindowsPath)_picklePicklerzpickle.Pickler)r>   	Unpicklerzpickle.Unpickler)_structStructzstruct.Struct)builtinsasync_generatorztypes.AsyncGeneratorType)rC   builtin_function_or_methodztypes.BuiltinMethodType)rC   cellztypes.CellType)rC   classmethod_descriptorztypes.ClassMethodDescriptorType)rC   codeztypes.CodeType)rC   	coroutineztypes.CoroutineType)rC   ellipsisztypes.EllipsisType)rC   frameztypes.FrameType)rC   functionztypes.LambdaType)rC   	generatorztypes.GeneratorType)rC   getset_descriptorztypes.GetSetDescriptorType)rC   mappingproxyztypes.MappingProxyType)rC   member_descriptorztypes.MemberDescriptorType)rC   methodztypes.MethodType)rC   zmethod-wrapperztypes.MethodWrapperType)rC   method_descriptorztypes.MethodDescriptorType)rC   moduleztypes.ModuleType)rC   NoneTypeztypes.NoneType)rC   NotImplementedTypeztypes.NotImplementedType)rC   	tracebackztypes.TracebackType)rC   wrapper_descriptorztypes.WrapperDescriptorType)_weakrefsetWeakSetzweakref.WeakSet)zipfile._pathCompleteDirszzipfile.CompleteDirs)rZ   r8   zzipfile.Pathz$Final[Mapping[tuple[str, str], str]]_INVALID_BUILTIN_CLASSESc                ~    	 | j                   | j                  f}t        j	                  |d      S # t        $ r Y yw xY w)z)Check *obj* is an invalid built-in class. )
__module____qualname__AttributeErrorr\   get)objkeys     r   is_invalid_builtin_classre   v   sD    nnc... $''R00  s   0 	<<TextlikeNodec                 D    t         j                  t         j                  z  S N)r   TextTextElementr   r   r   rf   rf      s    EJJ!2!22 2r   PathMatcherc                 *    t         t        gt        f   S rh   )r   strboolr   r   r   rk   rk      s    8SE4K( (r   c                  8    e Zd Z	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)RoleFunctionNc                    y rh   r   )selfnamerawtexttextlinenoinlineroptionscontents           r   __call__zRoleFunction.__call__   s	     CFr   )Nr   )rx   dict[str, Any] | Nonery   zSequence[str]rs   rm   rt   rm   ru   rm   rv   intrw   r	   returnz3tuple[list[nodes.Node], list[nodes.system_message]])__name__r_   r`   rz   r   r   r   rp   rp      sg     .2%'
	F +
	F #
	F
	F 
	F 	
	F
 
	F 
	F A
	Fr   rp   c            	         t         t        t        t        t        t        t        t        t
        j                  f   t        t           gt        t        t        j                     t        t        j                     f   f   S rh   )r   rm   r|   r	   dicttypingr   r   tuplelistr   Nodesystem_messager   r   r   rp   rp      sW    	c3Wd3

?&;Xc]Kd5::U%9%9 ::;	= r   
OptionSpecc                 X    t         t        t        t        gt        j                  f   f   S rh   )r   rm   r   r   r   r   r   r   r   r      s!    $sHcUFJJ%6778 8r   TitleGetterc                 >    t         t        j                  gt        f   S rh   )r   r   r   rm   r   r   r   r   r      s    8UZZL#-. .r   	Inventoryc                 B    t         t        t         t        t        f   f   S rh   )r   rm   r   r   r   r   r   r      s    c4^ 3445 5r   c                  @    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   y	)
ExtensionMetadataz`The metadata returned by an extension's ``setup()`` function.

    See :ref:`ext-metadata`.
    rm   versionr|   env_versionrn   parallel_read_safeparallel_write_safeN)r~   r_   r`   __doc____annotations__r   r   r   r   r      s2    
 LAT r   r   F)total_ExtensionSetupFuncc                 *    t         t        gt        f   S rh   )r   r   r   r   r   r   r   r      s    x2C(CDDr   c                    ddl m} 	 t        j                  | |||      S # t        $ r  || di       cY S t
        $ r  || di       cY S t        $ r  || di       cY S t        $ r i cY S w xY w)zReturn a dictionary containing type hints for a function, method, module or class
    object.

    This is a simple wrapper of `typing.get_type_hints()` that does not raise an error on
    runtime.
    r   )safe_getattr)include_extrasr   )sphinx.util.inspectr   r   get_type_hints	NameErrorra   	TypeErrorKeyError)rc   globalnslocalnsr   r   s        r   r   r      s     1$$7>
 	
  8C!2B77 8C!2B77 8C!2B77  	s    ! A+A+
A+
A+*A+c                ^    t        | dd      }|dk(  xr t        | t        j                        S )z&Check *typ* is system defined TypeVar.r_   r^   r   )getattr
isinstancer   TypeVar)typmodnames     r   is_system_TypeVarr      s+    c<,GhB:c6>>#BBr   c                    t        j                  |       t         j                  u xs t        |       j	                  d      S )z$Check if *obj* is an annotated type.ztyping.Annotated)r   
get_originr   rm   
startswithrc   s    r   _is_annotated_formr      s:     	#&"2"22 	3s812r   c                L    t        j                  |       t         j                  u S )z<Check if the object is :class:`typing.Unpack` or equivalent.)r   r   Unpackr   s    r   _is_unpack_formr      s    S!V]]22r   c                   ddl m}m} ddlm}m} ddh}|vr;dj                  t        t        t        |                  }d| d}t        |      | | t        j                  k(  ry
| t        u ryt        | t              r| S t!        | dd      dk(  }	dk(  s|	rdnd}
	  ||       rd|
 | j"                   dS  ||       rd|
 | j$                   d| j"                   dS t'        |       x}rd|
 | dS t)        |       rSt+        | j,                  d         }g }| j.                  D ]  }t        |t0              r|j3                  t+        |             /t5        j6                  |      rdj                  t5        j8                  |      D cg c]=  }|j                  r/|j:                   dt+        t!        ||j:                               ? c}      }|j3                  t+        t1        |             d| d       |j3                  t        |              dj                  |      }d|
 | j$                   d| j"                   d| d| d
S t        | t<        j>                        rd|
 | j$                   d| j"                   dS t        | t        j@                        s& ||       rB|	r@| jB                  t<        jD                  u r$dj                  fd| j,                  D              S t        | tF              rJtI        | d      rd|
 | j$                   d| jJ                   dS d|
 | j$                   d| j"                   dS | j$                  dv r|tI        | d      r`| j,                  sd| j"                   d| j,                  dS dj                  fd| j,                  D              }d| j"                   d| dS d| j"                   dS  ||       ra| j"                  rDt        | jB                  t<        jL                        s d|
 | j$                   d| j"                   d}nt+        | jB                        }t!        | dd      }|s|S tO        t        tP        |            r|S |	r| j"                  d k(  s| j$                  d!k(  rF| j"                  d k(  r7dj                  fd"|d	d# D              }t+        |d#         }| d$| d%| dS |	rE| jB                  j"                  d&k(  r,dj                  fd'| j,                  D              }| d(| dS dj                  fd)|D              }| d(| dS t        | t<        jL                        rd*| j$                   d| j"                   dS | t<        jR                  u rd*| j$                   d| j"                   dS tI        | d      rd|
 | j$                   d| jJ                   dS t        | t<        jT                        rd| jV                   dS d+|
 | j$                   d| j"                   dS c c}w # tX        tZ        f$ r*}t\        j_                  d,| |        ||       cY d	}~S d	}~ww xY w)-a}  Convert a type-like object to a reST reference.

    :param mode: Specify a method how annotations will be stringified.

                 'fully-qualified-except-typing'
                     Show the module name and qualified name of the annotation except
                     the "typing" module.
                 'smart'
                     Show the name of the annotation.
    r   ismockismockmodule)isgenericaliasobject_descriptionr   r   , mode must be one of ; got Nz:py:obj:`None`...r_   r^   r   ~z:py:class:``.z=\ z\ ()z`\ [] | c              3  6   K   | ]  }t        |        y wrh   restify.0amodes     r   	<genexpr>zrestify.<locals>.<genexpr>=  s     E1ga.E   r`   z
:py:type:`>   rC   __builtin____args__c              3  6   K   | ]  }t        |        y wrh   r   )r   argr   s     r   r   zrestify.<locals>.<genexpr>H  s      .+.GC&.r   r   r   zcollections.abcc              3  6   K   | ]  }t        |        y wrh   r   r   s     r   r   zrestify.<locals>.<genexpr>b  s      IaD!1 Ir   z\ [[], r   c              3  8   K   | ]  }t        |         yw)r   N)_format_literal_arg_restifyr   s     r   r   zrestify.<locals>.<genexpr>g  s!      !BC/==!   z\ [c              3  6   K   | ]  }t        |        y wrh   r   r   s     r   r   zrestify.<locals>.<genexpr>m  s     @!WQ-@r   z
:py:obj:`~z	:py:obj:`z#restify on %r in mode %r failed: %r)0!sphinx.ext.autodoc._dynamic._mockr   r   r   r   r   joinmapreprsorted
ValueErrortypesrT   Ellipsisr   rm   r   r~   r_   re   r   r   r   __metadata__typeappenddataclassesis_dataclassfieldsrs   r   NewType	UnionType
__origin__r'   r   hasattrr`   _SpecialFormallr   r   
ForwardRef__forward_arg__ra   r   loggerdebug)clsr   r   r   r   r   valid_modesvalidmsgcls_module_is_typingmodule_prefix	fixed_clsargs	meta_argsmfd_fieldsmetaconcatenated_argsru   r   returnsexcs    `                     r   r   r      s"    GF2G<K;		#dF;$789$UG6$:o {cU^^+
h#s
"3b9XE
  7?.BCMi' ~Q??C[ /?qaPP2377Y7 !	{!<<$3<<?D1DI%% .a&$$WQ%56 --a0#yy!,!3!3A!6*66 FF83wwq!&&/A4'H&IJ*  H
 $$a$)?(@H:Q%OP$$T!W-. 99Y'Dm_S^^,<Acll^ LfBtfA' V^^, /?qaPPU__-3$&,,.
 ::EEEE-.sN+#M?3>>2B!CDTDTCUUVWWs~~.>a~QOO^^::sJ'||)#,,tCLL;K1MM$(II .25,,. %! &cll^48I7J!LL a00C ||Js~~v?R?R$S %]OCNN3C1S\\NRSTs~~t4sJ3H3((34 &#,,**DNN&77CLLJ<Vyy I8CR= II!(2,5&TF#gYa88#(?(?9(Lyy !GJ||!   &D6++ 99@x@@DfCvQ''V001/qa@@FJJ/qa@@S.) /?qAQAQ@RRSTTV../ !4!4 5Q77 }ocnn-=Qs||nANNi*j I& ':CsK!#&&'s   "X! <&X! #X! 8BX! AX
BX! 8X! A#X! 4:X! /X! AX! 6X! X! A?X! X! 3A%X! AX!  !X! 6X! 9.X! (*X! )X! =X! X! !Y0YYYc                 ddl m}  ||       rt| j                  }|dk(  s|j                  dk(  r*d|j                   d|j                   d| j
                   dS d|j                   d|j                   d| j
                   dS t        |       S )	Nr   isenumattributer   r   z:py:attr:`~r   r   z
:py:attr:`r   r   	__class__r_   r`   rs   r   r   r   r   enum_clss       r   r   r     s    3s==7?h11X= h112!H4I4I3J!CHH:UVW H//0(2G2G1H#((STUU9r   )short_literalsc              
   ddl m}m} h d}|vr;dj                  t	        t
        t        |                  }d| d}t        |      | | t        j                  k(  ry| t        u ry	t        | t              r)| j                  d
      r| j                  d
      r| dd S | S | st        |       S dk(  rdnd}t        | dd      }	t        | dd      }
t        | dd      }|
dk(  }t         j"                  dd dk\  rt        | t$        j&                        rd}t        | t$        j(                  t*        f      rt-        |       s|rdv r|S ||
 d| z   S t        | t$        j.                        r
||
 d| z   S  ||       r||z   S  ||       r
||
 d| z   S t1        |       x}r||z   S t3        |       rnI|
dk(  rC|	rAt        | dd      }||	S |st        |       S dj                  fd|D              }|	 d| dS 	 |
 d}t        | dd      }|	s|r|sdk(  rd| }|r$dk(  rd}nt-        |       r|
d k(  r
dk(  rdnd}nd}|r8|r|}n|r|}n|	r|	}n{t5        | j6                  d!      j9                  d"d      }nR|	r|	}nMt;        | d#      rt5        | j6                  !      }n(t        | t        j<                        rd$}nt        |       S t        | dd%      }|rt        |t>        t@        f      ru|d&v rQtC        d' |D              r?t$        jD                  |   jF                  }dj                  fd(|D              }| d)| dS |d*v rd+j                  fd,|D              S |d-k(  r:dj                  fd.|dd D              }t5        |d   !      }| d/| d0| dS |d1k(  r>rd+j                  fd2|D              S dj                  fd3|D              }| d)| dS t3        |       r7t5        |d   !      }g }| jH                  D ]  }t        |tJ              r|jM                  t5        |!             1tO        jP                  |      rdj                  tO        jR                  |      D cg c]?  }|j
                  r1|jT                   d4t5        t        ||jT                        !       A c}      }|jM                  t5        tK        |      !       d5| d6       |jM                  t        |              dj                  |      }| d7| d| dS tC        d8 |D              r||z   S dj                  fd9|D              }| | d| dS ||z   S c c}w ):aj  Stringify type annotation object.

    :param annotation: The annotation to stringified.
    :param mode: Specify a method how annotations will be stringified.

                 'fully-qualified-except-typing'
                     Show the module name and qualified name of the annotation except
                     the "typing" module.
                 'smart'
                     Show the name of the annotation.
                 'fully-qualified'
                     Show the module name and qualified name of the annotation.

    :param short_literals: Render :py:class:`Literals` in PEP 604 style (``|``).
    r   r   >   r   r   r   r   r   r   NNoner   '   r   r   r   r^   r`   r_   r~   r      )      T>   r   r   r   rC   r   c              3  :   K   | ]  }t        |         ywr   r  Nstringify_annotation)r   r   r   r  s     r   r   z'stringify_annotation.<locals>.<genexpr>  s%      &
 !4OO&
   [r   r   r   typing_extensionsr  ztyping.r   types.UnionTyper   >   r'   r  c              3  V   K   | ]!  }t        |d d      t        j                  u  # yw)r   .N)r   r   r   r   r   s     r   r   z'stringify_annotation.<locals>.<genexpr>  s"     ]GA|S1V^^C]s   ')c              3  8   K   | ]  }t        |         ywr   _format_literal_arg_stringifyr   s     r   r   z'stringify_annotation.<locals>.<genexpr>#  !      @A-ad;;r   zLiteral[>   r'   Optionalr  r   c              3  :   K   | ]  }t        |         ywr  r  r   r   r   r  s     r   r   z'stringify_annotation.<locals>.<genexpr>(  s%       %QT.QQr  r   c              3  :   K   | ]  }t        |         ywr  r  r  s     r   r   z'stringify_annotation.<locals>.<genexpr>-  %       %QT.QQr  z
Callable[[r   r   c              3  8   K   | ]  }t        |         ywr   r  r   s     r   r   z'stringify_annotation.<locals>.<genexpr>7  s!      "DE1!$??"r   c              3  8   K   | ]  }t        |         ywr   r  r   s     r   r   z'stringify_annotation.<locals>.<genexpr>:  r  r   =(r   z
Annotated[c              3  2   K   | ]  }t        |        y wrh   )r   r  s     r   r   z'stringify_annotation.<locals>.<genexpr>X  s     ?!"1%?s   c              3  :   K   | ]  }t        |         ywr  r  r  s     r   r   z'stringify_annotation.<locals>.<genexpr>\  r  r  )+r   r   r   r   r   r   r   r   r   rT   r   r   rm   r   endswithr   sysversion_infor   r   r   r   r   r   re   r   r  r   replacer   r   r   r   r   r   r   r   r   r   r   r   r   rs   )
annotationr   r  r   r   r   r   r   r   annotation_qualnameannotation_moduleannotation_nameannotation_module_is_typingfixed_annotationr   r   annotation_forward_argqualnameannotation_argsflattened_argsr   r   r   r   r   r   s    ``                       r   r  r    s^   , GOK;		#dF;$789$UG6$:o Z5>>9X*c"  %**=*=c*Ba##J7?CM  'z>2F$ZrB":z2>O"3x"?
w&:j&BSBS+T&*# V^^%56j)&4 4
 ,
 #""3!4Ao5FGGG	J	/"3!4Ao5FGGG	j	!..	
	"3!4Ao5FGGG5jA	A		A///	J	'	j	(-@z:t4<&& 
## II &
&
 
 &&a(9':!<< 	()+M)0=NPT)U#,B7?/M&43R+RM		$):>Q)Q#wB"!-H*$. 0))8#1 ')R(	 
 
&	\	*'!!^
 
J	0$ J j*b9O:oe}E44]_]] $^^O<EEN99 ES D $_HTF!44??:: (   #99 ("- D +#$~G $_JtfCyBB"zz "IX"   99 ET D $_HTF!44
+'"nD I,, .a&$$,D
 !--a0#yy!,!3!3A!6*66 66(!$8AFF9KRVgu$v#wx*  H
 $$/QdSabccdemdnnop $$T!W-%.& 99Y'D#_JtfBtfA>>??? 8++99 ( D $_XJavQ778##-*s   AU6
c                  ddl m}  ||       rc| j                  }|dk(  s|j                  dk(  r|j                   d| j
                   S |j                   d|j                   d| j
                   S t        |       S )Nr   r   r   r   r   r   r  s       r   r  r  e  sy    3s==7?h11X=++,AchhZ88%%&a(=(='>azJJ9r   z+dict[str, tuple[Any, str, tuple[int, int]]]_DEPRECATED_OBJECTSc                    | t         vrdt        d| }t        |      ddlm} t         |    \  }}} |t        | ||       |S )Nzmodule z has no attribute r   )_deprecation_warning)remove)r5  r~   ra   sphinx.deprecationr7  )rs   r   r7  deprecated_objectcanonical_namer8  s         r   __getattr__r<  w  sR    &&|#5dX>S!!70CD0I-~v4Gr   )rc   r   r}   rm   )NNF)
rc   r   r   r{   r   zMapping[str, Any] | Noner   rn   r}   zdict[str, Any])r   r   r}   rn   )rc   r   r}   zTypeIs[Annotated[Any, ...]])rc   r   r}   rn   )r   )r   r   r   r   r}   rm   )r   r   r   rm   r}   rm   )r   r   r*  r   r  rn   r}   rm   )rs   rm   r}   r   );r   
__future__r   r   r'  r   r   collections.abcr   r   r   r   docutilsr   docutils.parsers.rst.statesr	   sphinx.utilr
   r   r   r   r   r   r   r  r   sphinx.applicationr   sphinx.util.inventoryr   r   r   r   r   ImportError	getLoggerr~   r   r\   re   rf   rk   rp   r   r   r   	TypedDictr   r   r   r   r   r   r   r   r  r  r5  r<  r   r   r   <module>rG     s   % "  
   . /  / '??()4 '4%5 " 5; *88::			8	$
AB!6AB #$<AB 2	AB .AB 0AB .AB 2AB 2AB 2AB 2AB AB {AB  !AB" 0#AB& $%7'AB( $%7)AB,  !6-AB. "#:/AB2 +,E3AB6 7AB8 $%89AB: #$6;AB< ()@=AB> *+D?AB@ &'<AABD ,EABF 0GABJ ?KABN $%?OABP /0IQABR *SABT +,MUABV *WABX 4YABZ 2[AB\ ,]AB^ 0_AB` 4aABb &'CcABd !":eABf &'CgABh .iABj #$=kABl &'CmABn .oABp .qABr '(BsABt 4uABv '(EwABz  1{AB~ &'=AB@ ~AAB > AH1 3 ) Fx F 9 / 6(( ( D
 '+(, 		# & 	
 BC3
L'^$ ;S$
 !S$ S$S$
 S$ 	S$l
D @ 	_  		s   ;G+ +G43G4