
    Fe	                        d Z ddlmZ ddlmZmZmZ 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 erdd
lmZ ddlmZ  ej,                  e      ZddZddZddZy)z7Allow reference sections by :ref: role using its title.    )annotations)TYPE_CHECKINGAnycast)nodesN)StandardDomain)__)logging)clean_astext)Node)Sphinxc                    d}| }|j                   | j                  k7  r+|j                   }|dz  }|j                   | j                  k7  r+|S )Nr      )parentdocument)nodeicur_nodes      =/usr/lib/python3/dist-packages/sphinx/ext/autosectionlabel.pyget_node_depthr      sG    	AH
//T]]
*??	Q //T]]
* H    c           	        t        t        | j                  j                  d            }|j	                  t
        j                        D ]  }| j                  j                  r#t        |      | j                  j                  k\  r=|d   d   }| j                  j                  }t        t
        j                  |d         }t        |d|j                               }| j                  j                  rt        j                  |dz   |z         }nt        j                  |      }t!        |      }	t"        j%                  t'        d      |||d|       ||j(                  v rMt"        j+                  t'        d	      || j                  j-                  |j(                  |   d         |d|       ||f|j.                  |<   |||	f|j(                  |<    y )
Nstdidsr   	rawsource:z!section "%s" gets labeled as "%s"autosectionlabel)locationtypesubtypez(duplicate label %s, other instance in %s)r   r   env
get_domainfindallr   sectionconfigautosectionlabel_maxdepthr   docnametitlegetattrastext autosectionlabel_prefix_documentfully_normalize_namer   loggerdebugr	   labelswarningdoc2path
anonlabels)
appr   domainr   labelidr'   r(   ref_namenamesectnames
             r   register_sections_as_labelr9       s   .#''"4"4U";<F  / 9JJ00t$

(L(LLu+a.''//U[[$q'*5+u||~>::66--gmh.FGD--h7D&R;<t");W 	 	N 6== NN2HI!1!1&--2Ea2H!I$(/A7  T #*7"2$%w8d/9r   c                    | j                  ddd       | j                  dd d       | j                  dt               t        j                  dddS )Nr+   Fr!   r&   zdoctree-readT)versionparallel_read_safeparallel_write_safe)add_config_valueconnectr9   sphinx__display_version__)r3   s    r   setuprB   <   sR    ;UEJ4dEBKK :; --"# r   )r   r   returnint)r3   r   r   r   rC   None)r3   r   rC   zdict[str, Any])__doc__
__future__r   typingr   r   r   docutilsr   r@   sphinx.domains.stdr   sphinx.localer	   sphinx.utilr
   sphinx.util.nodesr   docutils.nodesr   sphinx.applicationr   	getLogger__name__r-   r   r9   rB    r   r   <module>rS      sM    = " + +   -   *#)			8	$98	r   