
    }c                         d Z d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 ddlmZ ddlmZ dd	lmZ  ej        e          Zd
edefdZde
deddfdZde
deeef         fdZdS )z7Allow reference sections by :ref: role using its title.    )AnyDictcast)nodes)Node)Sphinx)StandardDomain)__)logging)clean_astextnodereturnc                 f    d}| }|j         | j        k    r|j         }|dz  }|j         | j        k    |S )Nr      )parentdocument)r   icur_nodes      ;lib/python3.11/site-packages/sphinx/ext/autosectionlabel.pyget_node_depthr      sG    	AH
/T]
* ?	Q /T]
*  H    appr   Nc           	      :   t          t          | j                            d                    }|                    t
          j                  D ]L}| j        j        rt          |          | j        j        k    r-|d         d         }| j        j
        }t          t
          j        |d                   }t          |d|                                          }| j        j        rt          j        |dz   |z             }nt          j        |          }t!          |          }	||j        v rVt$                              t)          d          || j                            |j        |         d                   |d|           ||f|j        |<   |||	f|j        |<   Nd S )	Nstdidsr   	rawsource:z(duplicate label %s, other instance in %sautosectionlabel)locationtypesubtype)r   r	   env
get_domainfindallr   sectionconfigautosectionlabel_maxdepthr   docnametitlegetattrastext autosectionlabel_prefix_documentfully_normalize_namer   labelsloggerwarningr
   doc2path
anonlabels)
r   r   domainr   labelidr(   r)   ref_namenamesectnames
             r   register_sections_as_labelr8      s   .#'"4"4U";";<<F  // 9 9J0 	t$$
(LL	u+a.'/U[$q'**5+u||~~>>:6 	8-gmh.FGGDD-h77D&&6=  	TNN2HII!1!1&-2Ea2H!I!I$(/A7  T T T #*7"2$%w8d)9 9r   c                     |                      ddd           |                      dd d           |                     dt                     ddddS )	Nr,   Fr"   r'   zdoctree-readbuiltinT)versionparallel_read_safeparallel_write_safe)add_config_valueconnectr8   )r   s    r   setupr@   3   sc    ;UEJJJ4dEBBBKK :;;; "#  r   )__doc__typingr   r   r   docutilsr   docutils.nodesr   sphinx.applicationr   sphinx.domains.stdr	   sphinx.localer
   sphinx.utilr   sphinx.util.nodesr   	getLogger__name__r/   intr   r8   strr@    r   r   <module>rO      s8   = = " " " " " " " " " "             % % % % % % - - - - - -             * * * * * *		8	$	$ #    9F 9d 9t 9 9 9 92	v 	$sCx. 	 	 	 	 	 	r   