
    ~Tif7                    H   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d d	lmZmZ d d
lm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m Z  er2d dl!m"Z"m#Z#m$Z$ d dl%m&Z& d dl'm(Z( d dl)m*Z* d dl+m,Z,m-Z- d dlm.Z.m/Z/ d dlm0Z0 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ1	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d dZ3	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d!dZ4	 	 	 	 	 	 	 	 d"dZ5d#dZ6y)$    )annotationsN)TYPE_CHECKING)
StringList)PycodeError)_load_object_by_name)_gather_members)ismock)_add_content_directive_header_lines)ALL)LOGGER_get_render_mode)___)ModuleAnalyzer)inspect)restifystringify_annotation)IteratorMapping
MutableSet)_CurrentDocument)EventManager)_AutoDocumenterOptions)_AutodocObjType_ItemProperties)_AttrGetter_AutodocConfig)_RestifyModec                v    t        |||| ||||	|
	      }|y t               }t        || |||d||||	|
|       |S )N)	nameobjtypecurrent_documentconfigeventsget_attroptionsref_contextreread_always )more_contentr$   r#   r%   r&   indentr'   propsrecord_dependenciesr(   r)   result)r   r   _generate_directives)r$   r#   r%   r&   r+   r!   obj_typer'   r.   r(   r)   r-   r/   s                O/home/agent/.local/lib/python3.12/site-packages/sphinx/ext/autodoc/_generate.py_auto_document_objectr3      sm     !)#
E }\F!)/# M    c                  ||
j                   dv r|
j                  }n|}	 t        j                  |      }|j	                          |j                  |j                         ||
j                  k7  r=	 t        j$                  |
j                        \  }}|j                  t'        |             t)        |
j*                        }t-        |
j.                        r.|s,t        j0                  t3        d      |
j4                  dd       |rG|	j6                  s;t9        j:                  |
j.                        } ||dd      }|r||
j                  k7  ry|d	n|j                  }t=        | |duxr |
j>                  |j@                  v |||	|
|tC        |
|
             tE        |||jF                  ni ||jH                  ni ||||||	|
|||||       y# t        $ r}t        j                  d|       d}|
j                  rs	 t        j                  |
j                     j                  }|I|j                  r=|j                  r1|j                  |j                         n# t         t"        f$ r Y nw xY wY d}~d}~ww xY w# t        $ r Y w xY w)ay  Generate reST for the object given by *props*, and possibly for its members.

    If *more_content* is given, include that content. If *parent_modname* is
    given, use that module name to find attribute docs. If *check_module* is
    True, only generate if the object is defined in the module name it is
    imported from. If *all_members* is True, document all members.
    N>   class	exceptionz$[autodoc] module analyzer failed: %szA mocked object is detected: %rautodocmocked_object)typesubtype
__module__r*   )r-   source)r+   is_finalr$   r,   r'   r-   r/   source_name)all_membersanalyzer_order	attr_docsr$   r#   r%   r&   r,   r'   r-   real_modnamer.   r(   r)   r/   )%r1   canonical_module_namer   
for_moduleanalyzeaddsrcnamer   r   debugmodule_namesysmodules__spec__has_locationoriginAttributeErrorKeyErrorget_module_sourcestrbooldocstring_linesr	   _objwarningr   	full_nameimported_membersr   	unpartial_add_directive_linesdotted_partsfinals_docstring_source_name_document_memberstagorderrB   )r+   parent_modnamecheck_moduler@   r$   r#   r%   r&   r,   r'   r-   r.   r(   r)   r/   rC   analyzerexcmodule_specrH   r   has_docstringsubjectmodnameanalyzer_sources                            r2   r0   r0   M   sv   < 3I!I 22%@!,,\: 	 0 01& u222	'99%:U:UVJGQ##CL1 ../Mejj-01OO#		
 G44##EJJ/7L$7w%"3"33 %,b(2B2BO!%O%*<*<*O*O	 ,4,@x((b(0(<($$")!/#q  @;SA
@!kk%*;*;<EE
  +#00#**'++K,>,>? #H- @.  		sN   A G 1<I= 	I:$I5='I$6I5I,)I5+I,,I55I:=	J
	J
c                4   t        |j                  |j                  dv r|j                  rdnd|j                   |||      }t	        t        |      d      }	t	        |j                  |      }
t        t        |j                        |j                  |      }t	        t        |      d      }|j                  dd       t        |	||       |j                  dd       t        |
||d	z          | t        | ||d	z          t        |||d	z          y )
N>   r6   r7   zpy:attributezpy:)autodoc_typehintsdirective_namer>   r'   r-   r*   )r=   )render_modeshort_literalsr-   )r/   r,   z   )r   rk   r1   doc_as_attrr   listrU   _body_alias_linesr   autodoc_typehints_format"python_display_short_literal_typesappendr
   )r+   r>   r$   r,   r'   r-   r/   r?   linesheader_linesrU   alias_liness               r2   r[   r[      s	    $ 22 ~~!77E<M<M u~~&'
E d5k"5L !!6!6{KO $V%D%DE@@E
 T%[4K
 MM"bfV<
MM"bG\&%HVFUNCr4   c                   |	j                   dk(  xs |	j                   dv xr |	j                   }|syt        | xs  |j                  xs |j                  t
        u       }t        ||||||||||
|	||      }t        |	j                   dk(  xr  |xr |j                  xs |	j                  du       }|D ]3  \  }}}|j                  sJ t        d|
|xr | d|||||||||||       5 y)zGenerate reST for member documentation.

    If *all_members* is True, document all members, else those given by
    *self.options.members*.
    module>   r6   r7   N)want_allr,   rA   rB   r$   r#   r%   r&   r'   ra   r-   r(   r)   T)r+   ra   rb   r@   r$   r#   r%   r&   r,   r'   r-   r.   r(   r)   r/   )r1   ro   rT   inherited_membersmembersr   r   ignore_module_allallrJ   r0   )r@   rA   rB   r$   r#   r%   r&   r,   r'   r-   rC   r.   r(   r)   r/   has_membersrz   member_documentersmembers_check_modulemember_propsis_attrmember_indents                         r2   r_   r_      s6   . ..H, 00J9J9J5J  KV7#<#<VSV@VWH(%)##$  (" 	=	=&&;%))t*;
 1C 
,g}'''' 	'-=g+-  3#'	
	
r4   c              #  L  K   | j                   dv rMddlm} t        | |      sJ | j                  r,t        | j                        }t        d      |z   d yy| j                   dv rdd	lm} t        | |      sJ | j                  }| j                  r,t        |j                        }t        d      |z   d y| j                  rt        |j                        gfd
|j                  D        }|j                  r)|j!                  dt        |j                                |j"                  r|j!                  d       |j$                  r|j!                  d       ddj'                  |       d}t        d      |z   d y| j(                  rm	 t+        j,                  | j.                        }	|	j1                          d| j2                  f}
|
|	j4                  v }|ryt        |      }t        d      |z   yyy# t6        $ r d}Y 0w xY ww)z>Add content from docstrings, attribute documentation and user.>   data	attributer   )_AssignStatementProperties)modezalias of %sr*   N>   r6   r7   )_ClassDefPropertiesc              3  :   K   | ]  }t        |         yw))rn   N)r   ).0
constraintrm   rn   s     r2   	<genexpr>z$_body_alias_lines.<locals>.<genexpr>c  s,       # )"K s   zbound=\ zcovariant=Truezcontravariant=TruezTypeVar(z, )F)r1   "sphinx.ext.autodoc._property_typesr   
isinstance_obj_is_generic_aliasr   rV   r   r   _obj_is_new_type__supertype___obj_is_typevarrepr__name____constraints__	__bound__rt   __covariant____contravariant__joinro   r   rE   rJ   rF   r\   rB   r   )r-   rm   rn   r   aliasr   obj	supertypeattrsrc   keyclass_var_doc_comments    ``         r2   rq   rq   B  s     ~~..Q%!;<<< &&EJJ[9EM"U**H~~//J%!4555jj!! 1 1DIM"Y..H  S\\" '*&9&9	E }}[)Q(RST  -.$$12tyy/02EM"U**H.)44U5F5FG  "5--.(+x/A/A(A% %Ck2EM"U**
  .(-%.s+   F H$%AH 0#H$H!H$ H!!H$c                    t        j                  | j                  dd       }t        j                  | j                  dd       }|r
|r| d| }n| j                  }|r| d| S d| S )Nr<   __qualname__.z:docstring of zdocstring of )r   safe_getattrrV   rX   )r-   r=   
obj_moduleobj_qualnamefullnames        r2   r^   r^     ss    %%ejj,EJ''

NDILl !\<.1??z228*%%r4   )r$   r   r#   r   r%   r   r&   r   r+   StringList | Noner!   rS   r1   r   r'   r   r.   MutableSet[str]r(   Mapping[str, str | None]r)   r   returnr   )NNFF) r+   r   ra   z
str | Nonerb   rT   r@   rT   r$   r   r#   r   r%   r   r&   r   r,   rS   r'   r   r-   r   r.   r   r(   r   r)   r   r/   r   r   None)r+   r   r>   rT   r$   r   r,   rS   r'   r   r-   r   r/   r   r?   rS   r   r   ) r@   rT   rA   zdict[str, int]rB   z dict[tuple[str, str], list[str]]r$   r   r#   r   r%   r   r&   r   r,   rS   r'   r   r-   r   rC   rS   r.   r   r(   r   r)   r   r/   r   r   r   )r-   r   rm   r   rn   rT   r   zIterator[str])r-   r   r=   rS   r   rS   )7
__future__r   rK   typingr   docutils.statemachiner   sphinx.errorsr   #sphinx.ext.autodoc._dynamic._loaderr   *sphinx.ext.autodoc._dynamic._member_finderr   !sphinx.ext.autodoc._dynamic._mockr	   sphinx.ext.autodoc._rendererr
   r   sphinx.ext.autodoc._sentinelsr   sphinx.ext.autodoc._sharedr   r   sphinx.localer   r   sphinx.pycoder   sphinx.utilr   sphinx.util.typingr   r   collections.abcr   r   r   sphinx.environmentr   sphinx.eventsr   %sphinx.ext.autodoc._directive_optionsr   r   r   r   r   r   r   r3   r0   r[   r_   rq   r^    r4   r2   <module>r      s   " 
   , % D F 4 N - ?  (  <==3*LSF/++ '+ 	+
 + $+ + + $+ )+ *+ #+ +^ '+!%	u#uu u 	u u 'u u u u $u u )u *u #u  !u" 
#up.D#.D .D 	.D
 .D $.D .D .D .D 
.DbI
I
 #I
 0	I

 I
 'I
 I
 I
 I
 $I
 I
 I
 )I
 *I
 #I
  !I
" 
#I
XEE,8EJNEEP&r4   