
    ~Ti                        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mZ d dlmZmZ d dlmZ er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  G d deedf         Z	 	 	 	 	 	 	 	 ddZ  G d de      Z!y)    )annotations)TYPE_CHECKING)nodes)_process_documenter_options)_auto_document_object)LOGGER_AutodocAttrGetter_AutodocConfig)SphinxDirectiveswitch_source_input)nested_parse_to_nodes)Callable)Node)RSTState)
StringList)_AutodocObjTypec                       e Zd ZdZddZddZy)DummyOptionSpecz"An option_spec allows any options.c                     y)z&Behaves like some options are defined.T )selfs    P/home/agent/.local/lib/python3.12/site-packages/sphinx/ext/autodoc/_directive.py__bool__zDummyOptionSpec.__bool__   s        c                    d S )Nc                    | S )Nr   )xs    r   <lambda>z-DummyOptionSpec.__getitem__.<locals>.<lambda>   s     r   r   )r   _keys     r   __getitem__zDummyOptionSpec.__getitem__   s    r   N)returnbool)r   strr!   Callable[[str], str])__name__
__module____qualname____doc__r   r    r   r   r   r   r      s    ,r   r   r$   c                    t        | |      5  |rt        | |      cddd       S t        j                         }| j                  |_        | j                  |d|d       |j                  cddd       S # 1 sw Y   yxY w)z>Parse an item of content generated by _auto_document_object().Nr   F)match_titles)r   r   r   	paragraphdocumentnested_parsechildren)statecontenttitles_allowednodes       r   parse_generated_contentr3   "   sq     
UG	, (8   7At%@}}  s   A4AA44A=c                  6    e Zd ZdZ e       ZdZdZdZdZ	ddZ
y)AutodocDirectivezA directive class for all autodoc directives.

    It generates the directive lines for the given object,
    then parses and returns the generated content.
    T   r   c                D   | j                         \  }}t        j                  d||| j                         | j                  j                  d      sJ | j                  dd  }| j                  }d}	 t        || j                  j                  | j                        }| j"                  j$                  j&                  j(                  |_        | j"                  j$                  j&                  j,                  }t/        | j0                  d   ||j                  t3        j4                  |j                        |j6                  t9        |j:                  j<                        | j>                  |||j@                  |jB                  	      }	|	sg S t        j                  d
djE                  |	             tG        | j"                  |	|      S # t        t        t        f$ rF}t        j                  d| j                  |||j                  j                   |f       g cY d }~S d }~ww xY w)Nz[autodoc] %s:%s: input:
%sauto   T)obj_typedefault_optionsoptionsz=An option to %s is either unknown or has an invalid value: %s)exc_infolocationr   )namer:   current_documentconfigeventsget_attrmore_contentr<   record_dependenciesref_contextreread_alwaysz[autodoc] output:
%s
)$get_source_infor   debug
block_textr?   
startswithenvr   rA   autodoc_default_optionsr<   KeyError
ValueError	TypeErrorerrorr@   docnamer/   r,   settings	tab_width
_tab_widthrE   r   	argumentsr
   from_configrB   r	   	_registryautodoc_attrgettersr0   rF   rG   joinr3   )
r   sourcelinenoobjtyperM   r1   documenter_optionsexcrE   r0   s
             r   runzAutodocDirective.run>   s   --/2FFDOOT yy##F+++#'99QR=hh 	!<  $ C C" )-

(;(;(D(D(N(N% #jj11::NN (" 11!--cjj9::'(I(IJ& 3++
 I,dii.@A&tzz7NKKI *i0 		LLO		..66? I		s   1,G H;HHHN)r!   
list[Node])r%   r&   r'   r(   r   option_spechas_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacera   r   r   r   r5   r5   1   s.     "#KK $8Lr   r5   N)r/   r   r0   r   r1   r"   r!   rb   )"
__future__r   typingr   docutilsr   %sphinx.ext.autodoc._directive_optionsr   sphinx.ext.autodoc._generater   sphinx.ext.autodoc._sharedr   r	   r
   sphinx.util.docutilsr   r   sphinx.util.parsingr   collections.abcr   docutils.nodesr   docutils.parsers.rst.statesr   docutils.statemachiner   "sphinx.ext.autodoc._property_typesr   dictr#   r   r3   r5   r   r   r   <module>rv      s~    "    M > Q Q E 5(#40Bd3 667 (:>EL ELr   