
    FeZ                       U d Z ddlmZ ddl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mZmZmZmZ ddl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 ddlmZ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( ddl)m*Z*  e*jV                  e,      Z- ej\                  d      Z/er4ddlm0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ dej                  dfiZBd ZC eD       ZEdeFd <   edId!       ZGdJd"ZHdKd#ZIdJd$ZJdLd%ZKdMd&ZLdNd'ZMdOd(ZNdOd)ZOedId*       ZPedId+       ZQedPd,       ZRedId-       ZSedQdPd.       ZT G d/ d0      ZU G d1 d2eV      ZW G d3 d4eU      ZX G d5 d6      ZY G d7 d8e       ZZ G d9 d:e       Z[edRd;       Z\ G d< d=e      Z] G d> d?e      Z^ G d@ dA      Z_ G dB dCe_      Z` G dD dEej                        ZbdFeFdG<   dQdSdHZcy)TzUtility functions for docutils.    )annotationsN)Sequence)contextmanager)copy)path)IOTYPE_CHECKINGAnyCallablecast)nodes)
FileOutput)	Directive
directivesroles)Inliner)StateStateMachine
StringList)Reporterunescape)HTMLTranslator)SphinxError)___)loggingz>^(.+?:(?:\d+)?): \((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\d+)?\) )	Generator)
ModuleType)Values)ElementNodesystem_message)Builder)Config)BuildEnvironment)RoleFunction__version_info__zdocutils.__version_info__c                    | t         vrdt        d| }t        |      ddlm} t         |    \  }} |t        | |d       |S )Nzmodule z has no attribute r   )_deprecation_warning)   r   )remove)_DEPRECATED_OBJECTS__name__AttributeErrorsphinx.deprecationr)   )namemsgr)   deprecated_objectcanonical_names        6/usr/lib/python3/dist-packages/sphinx/util/docutils.py__getattr__r5   /   sP    &&|#5dX>S!!7(;D(A%~4G    zset[type[Element]]additional_nodesc               #    K   	 t        t        j                        } t        t        j                        }d | t        _        |t        _        t        t              D ]"  }t        |       t        j                  |       $ y#  t        _        t        _        t        t              D ]"  }t        |       t        j                  |       $ w xY ww)z"Create namespace for reST parsers.N)	r   r   _directivesr   _roleslistr7   unregister_nodediscard)r9   r:   nodes      r4   docutils_namespacer?   >   s     +:112ell#!,
)* 	+DD!$$T*	+ "-
)* 	+DD!$$T*	+s   C6B ACACCc                &    | t         j                  v S )z1Check the *name* directive is already registered.)r   r9   r0   s    r4   is_directive_registeredrB   O   s    :))))r6   c                0    t        j                  | |       y)zRegister a directive to docutils.

    This modifies global state of docutils.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    N)r   register_directive)r0   	directives     r4   rD   rD   T   s     !!$	2r6   c                &    | t         j                  v S )z,Check the *name* role is already registered.)r   r:   rA   s    r4   is_role_registeredrG   ]   s    5<<r6   c                0    t        j                  | |       y)zRegister a role to docutils.

    This modifies global state of docutils.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    N)r   register_local_role)r0   roles     r4   register_rolerK   b   s     
dD)r6   c                D    t         j                  j                  | d       y)z Unregister a role from docutils.N)r   r:   poprA   s    r4   unregister_rolerN   k   s    	LLT4 r6   c                P    t        t        j                  d| j                  z         S )z'Check the *node* is already registered.visit_)hasattrr   GenericNodeVisitorr-   r>   s    r4   is_node_registeredrT   p   s    5++X-EFFr6   c                    t        t        j                  d| j                  z         s6t        j                  | j                  g       t
        j                  |        yy)zRegister a node to docutils.

    This modifies global state of some visitors.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    rP   N)rQ   r   rR   r-   _add_node_class_namesr7   addrS   s    r4   register_noderX   u   sE     5++X-EF##T]]O4T" Gr6   c                   t        t        j                  d| j                  z         rt	        t        j                  d| j                  z          t	        t        j                  d| j                  z          t	        t        j
                  d| j                  z          t	        t        j
                  d| j                  z          yy)zaUnregister a node from docutils.

    This is inverse of ``nodes._add_nodes_class_names()``.
    rP   depart_N)rQ   r   rR   r-   delattrSparseNodeVisitorrS   s    r4   r<   r<      s    
 u''DMM)AB(((T]]*BC(()dmm*CD''DMM)AB''T]])BC	 Cr6   c               #     K   ddl m ddfd} 	 | t        j                  _        d t        j                  _        y# t        j                  _        w xY ww)zPatch docutils.languages.get_language() temporarily.

    This ignores the second argument ``reporter`` to suppress warnings.
    refs: https://github.com/sphinx-doc/sphinx/issues/3788
    r   get_languageNc                     |       S N language_codereporterr_   s     r4   patched_get_languagez2patched_get_language.<locals>.patched_get_language       M**r6   ra   rd   strre   zReporter | Nonereturnr
   )docutils.languagesr_   docutils	languagesrf   r_   s    @r4   rf   rf      sE      0+7*>' +7','s   AA AAAc               #  2  K   ddl m ddfd} 	 | t        j                  j                  j
                  _        d t        j                  j                  j
                  _        y# t        j                  j                  j
                  _        w xY ww)a^  Patch docutils.parsers.rst.languages.get_language().
    Starting from docutils 0.17, get_language() in ``rst.languages``
    also has a reporter, which needs to be disabled temporarily.

    This should also work for old versions of docutils,
    because reporter is none by default.

    refs: https://github.com/sphinx-doc/sphinx/issues/10179
    r   r^   Nc                     |       S ra   rb   rc   s     r4   rf   z6patched_rst_get_language.<locals>.patched_get_language   rg   r6   ra   rh   )docutils.parsers.rst.languagesr_   rl   parsersrstrm   rn   s    @r4   patched_rst_get_languagert      sk      <+C6J&&3 7C&&3l&&3s   B-A) *B)+BBc              #    K   	 t         j                  j                  dd      }| r:t        j                  t        j
                  |       d      t         j                  d<   d |!t         j                  j                  dd       y|t         j                  d<   y# !t         j                  j                  dd       w |t         j                  d<   w xY ww)z?Let docutils know the location of ``docutils.conf`` for Sphinx.DOCUTILSCONFIGNzdocutils.conf)osenvirongetr   joinabspathrM   )confdirdocutilsconfigs     r4   using_user_docutils_confr~      s     
:(8$?+/99T\\'5JO+\BJJ'(!JJNN+T2+9BJJ'( !JJNN+T2+9BJJ'(s   CA B $7C8CCc               #  x  K   d } d }t         j                  }t         j                  }t        j                  d d dk(  r| t         _        |t         _        	 d  t        j                  d d dk(  r|t         _        |t         _        y y # t        j                  d d dk(  r|t         _        |t         _        w w xY ww)Nc                (   | j                   j                  }t        |j                         t	        |            s| j
                  j                  d| d       | j
                  j                  | j                  |d|j                  |gd             y )Nz<aside class="footnote-list z">
asidenote)classesrJ   )	settingsfootnote_references
isinstanceprevious_siblingtypebodyappendstarttagtagname)selfr>   label_styles      r4   visit_footnotez&du19_footnotes.<locals>.visit_footnote   sy    mm77$//14:>II;K=MN		tW04k/J,2 ' 4 	5r6   c                    | j                   j                  d       t        |j                  dd      t	        |            s| j                   j                  d       y y )Nz	</aside>
FT)descendsiblings)r   r   r   	next_noder   r   r>   s     r4   depart_footnotez'du19_footnotes.<locals>.depart_footnote   sI    		&$...Ft*&II\*&r6      )r      )r   r   r   rl   r'   )r   r   old_visit_footnoteold_depart_footnotes       r4   du19_footnotesr      s     5+ (66(88   !$/(6%)8&A$$Ra(G3,>N)-@N* 48$$Ra(G3,>N)-@N* 4s   AB:B .B:/B77B:c           	   #    K   t               5  t               5  t        |       5  t               5  d ddd       ddd       ddd       ddd       y# 1 sw Y   "xY w# 1 sw Y   &xY w# 1 sw Y   *xY w# 1 sw Y   yxY ww)zPatch to docutils temporarily.N)rf   rt   r~   r   )r|   s    r4   patch_docutilsr      s|      
	 	!	#	!'	* 
	 		           s_   BA9A-A!A	A!A-A9	BAA!!A*&A--A6	2A99B>Bc                  |    e Zd ZdZd
dZd
dZ	 	 	 	 	 	 	 	 ddZd
dZd
dZ	 	 	 	 	 	 	 	 ddZ		 	 	 	 	 	 	 	 	 	 ddZ
y	)CustomReSTDispatcherzCustom reST's mark-up dispatcher.

    This replaces docutils's directives and roles dispatch mechanism for reST parser
    by original one temporarily.
    c                $    d | _         d | _        y )Nc                 
    d g fS ra   rb   argss    r4   <lambda>z/CustomReSTDispatcher.__init__.<locals>.<lambda>   s
    tRj r6   c                 
    d g fS ra   rb   r   s    r4   r   z/CustomReSTDispatcher.__init__.<locals>.<lambda>   s
    4* r6   )directive_func
roles_funcr   s    r4   __init__zCustomReSTDispatcher.__init__   s    (@$<r6   c                $    | j                          y ra   )enabler   s    r4   	__enter__zCustomReSTDispatcher.__enter__   s    r6   c                $    | j                          y ra   )disable)r   exc_type	exc_value	tracebacks       r4   __exit__zCustomReSTDispatcher.__exit__  s     	r6   c                    t         j                  | _        t        j                  | _        | j                  t         _        | j                  t        _        y ra   )r   rE   r   r   rJ   	role_funcr   s    r4   r   zCustomReSTDispatcher.enable  s2    (22#~~
YY
r6   c                X    | j                   t        _        | j                  t        _        y ra   )r   r   rE   r   r   rJ   r   s    r4   r   zCustomReSTDispatcher.disable  s    #22
^^
r6   c                (    | j                  |||      S ra   )r   )r   directive_namelanguage_moduledocuments       r4   rE   zCustomReSTDispatcher.directive  s     "">?HMMr6   c                *    | j                  ||||      S ra   )r   )r   	role_namer   linenore   s        r4   rJ   zCustomReSTDispatcher.role  s     ~~i$h0 	0r6   Nrj   None)r   ztype[Exception]r   	Exceptionr   r
   rj   r   r   ri   r   r   r   nodes.documentrj   z3tuple[type[Directive] | None, list[system_message]]
r   ri   r   r   r   intre   r   rj   z)tuple[RoleFunction, list[system_message]])r-   
__module____qualname____doc__r   r   r   r   r   rE   rJ   rb   r6   r4   r   r      s    ='4=JM	
$N"%N8BNN\NJN
00/90CF0RZ0	20r6   r   c                      e Zd Zy)ElementLookupErrorN)r-   r   r   rb   r6   r4   r   r     s    r6   r   c                  h     e Zd ZdZd fdZddZ	 	 	 	 	 	 	 	 d fdZ	 	 	 	 	 	 	 	 	 	 d	 fdZ xZS )
sphinx_domainszcMonkey-patch directive and role dispatch, so that domain-specific
    markup takes precedence.
    c                0    || _         t        | 	          y ra   )envsuperr   )r   r   	__class__s     r4   r   zsphinx_domains.__init__%  s    r6   c                   |j                         }d|v r|j                  dd      \  }}|| j                  j                  v r3| j                  j	                  |      } t        ||      |      }|d|g fS t        j                  t        d      ||       n?| j                  j                  j                  d      }| t        ||      |      }||g fS  t        | j                  j	                  d      |      |      }||g fS t        )ztLookup a markup element (directive or role), given its name which can
        be a full name (with domain).
        :   z%unknown directive or role name: %s:%sdefault_domainstd)lowersplitr   domains
get_domaingetattrloggerwarningr   	temp_datary   r   )r   r   r0   domain_namedomainelement
def_domains          r4   lookup_domain_elementz$sphinx_domains.lookup_domain_element)  s    zz|$; $

3 2Kdhh...,,[9/'&$/5&"B;&q!HI;X\] ++//0@AJ%3'*d3D9&"B;& <'$((--e4d;DAB;  r6   c                j    	 | j                  d|      S # t        $ r t        |   |||      cY S w xY w)NrE   )r   r   r   rE   )r   r   r   r   r   s       r4   rE   zsphinx_domains.directiveG  sA    	P--k>JJ! 	P7$^_hOO	Ps    22c                l    	 | j                  d|      S # t        $ r t        |   ||||      cY S w xY w)NrJ   )r   r   r   rJ   )r   r   r   r   re   r   s        r4   rJ   zsphinx_domains.roleO  sB    	N--fi@@! 	N7<	?FHMM	Ns    33)r   r%   rj   r   )r   ri   r0   ri   rj   r
   r   r   )	r-   r   r   r   r   r   rE   rJ   __classcell__r   s   @r4   r   r   !  su    !<P"%P8BPN\PJPNN/9NCFNRZN	2N Nr6   r   c                      e Zd ZddZy)WarningStreamc                   t         j                  |      }|s%t        j                  |j	                  d             y |j                         \  }}}t         j                  d|      j	                         }t        j                  |||       y )Nz
 location)	report_researchr   r   rstripgroupssublog)r   textmatchedr   r   levelmessages          r4   writezWarningStream.writeY  sh    ""4(NN4;;v./$+NN$4!HdEmmB-446GJJtWxJ8r6   N)r   ri   rj   r   )r-   r   r   r   rb   r6   r4   r   r   X  s    9r6   r   c                  r     e Zd Zedd       Zej                  ej                  ddf	 	 	 	 	 	 	 d fdZ xZ	S )LoggingReporterc                ~     | |j                   |j                  |j                  |j                  |j                        S )zACreate an instance of LoggingReporter from other reporter object.)sourcereport_level
halt_level
debug_flagerror_handler)clsre   s     r4   from_reporterzLoggingReporter.from_reporterd  s:     8??H$9$98;N;N&&(>(>@ 	@r6   Fbackslashreplacec                `    t        t        t                     }t        |   ||||||       y )N)r   )r   r   r   r   r   )r   r   r   r   debugr   streamr   s          r4   r   zLoggingReporter.__init__j  s3     b-/*zm 	 	Er6   )re   r   rj   r   )r   ri   r   r   r   r   r  boolr   ri   rj   r   )
r-   r   r   classmethodr   r   WARNING_LEVELSEVERE_LEVELr   r   r   s   @r4   r   r   c  sa    @ @
 9A8N8N#+#8#8&8E EAEE #E=AE Er6   r   c                  $     e Zd ZdZd fdZ xZS )NullReporterz A dummy reporter; write nothing.c                (    t         |   ddd       y )Nr   i     )r   r   )r   r   s    r4   r   zNullReporter.__init__u  s    S!$r6   r   )r-   r   r   r   r   r   r   s   @r4   r  r  r  s    *% %r6   r  c              #  <  K   	 | j                   j                  j                  }t        g d      }||_        |j                  | j                   j                  _        d || j                   j                  _        y# | j                   j                  _        w xY ww)z1Switch current source input of state temporarily.N)memore   get_source_and_liner   input_lines)statecontentgsalstate_machines       r4   switch_source_inputr  y  sw     7zz""66 %R.$+!2?2S2S

/ 37

/$

/s   BAA<  B<BBc                  0     e Zd ZdZd fdZd fdZ xZS )SphinxFileOutputz#Better FileOutput class for Sphinx.c                v    |j                  dd      | _        |j                  dd       t        |   di | y )Noverwrite_if_changedFencodingzutf-8rb   )rM   r  
setdefaultr   r   )r   kwargsr   s     r4   r   zSphinxFileOutput.__init__  s7    $*JJ/Eu$M!*g."6"r6   c                   | j                   r| j                  rd| j                  vr~| j                  rrt        j
                  j                  | j                         rIt        | j                   | j                        5 }|j                         |k(  r|cd d d        S 	 d d d        t        | -  |      S # 1 sw Y   xY w)Nb)r  )destination_path	autoclosemoder  rw   r   existsopenr  readr   r   )r   datafr   s      r4   r   zSphinxFileOutput.write  s    !!dnnDII9M))bggnnT=R=R.Sd++dmmD  668t#   # 
 w}T""   s   >B55B>)r  r
   rj   r   )r#  ri   rj   ri   )r-   r   r   r   r   r   r   r   s   @r4   r  r    s    -#
# #r6   r  c                  L    e Zd ZdZedd       Zed	d       Zd
dZddZddZ	y)SphinxDirectivezA base class for Sphinx directives.

    This class provides helper methods for Sphinx directives.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    c                V    | j                   j                  j                  j                  S z3Reference to the :class:`.BuildEnvironment` object.)r  r   r   r   r   s    r4   r   zSphinxDirective.env  s      zz""++///r6   c                .    | j                   j                  S z)Reference to the :class:`.Config` object.r   configr   s    r4   r,  zSphinxDirective.config       xxr6   c                L    | j                   j                  | j                        S )zGet source and line number.)r  r  r   r   s    r4   get_source_infozSphinxDirective.get_source_info  s    !!55dkkBBr6   c                >    | j                         \  |_        |_        y)z'Set source and line number to the node.Nr/  r   liner   s     r4   set_source_infozSphinxDirective.set_source_info  s    !%!5!5!7TYr6   c                N    dj                  d | j                         D              S )&Get current location info for logging.r   c              3  2   K   | ]  }t        |        y wra   ri   .0ss     r4   	<genexpr>z/SphinxDirective.get_location.<locals>.<genexpr>       ?1A?   rz   r/  r   s    r4   get_locationzSphinxDirective.get_location       xx?(<(<(>???r6   Nrj   r%   rj   r$   )rj   tuple[str, int]r>   r!   rj   r   rj   ri   )
r-   r   r   r   propertyr   r,  r/  r3  r?  rb   r6   r4   r&  r&    s@     0 0  C8@r6   r&  c                      e Zd ZU dZded<   ded<   ded<   ded<   ded	<   d
ed<   ded<   	 d	 	 	 	 	 	 	 ddZddZedd       Zedd       Z	dddZ
dddZddZy)
SphinxRolezA base class for Sphinx roles.

    This class provides helper methods for Sphinx roles.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    ri   r0   rawtextr   r   r   r   inlinerzdict[str, Any]optionsSequence[str]r  Nc                   || _         t        |      | _        || _        || _        ||ni | _        || _        |r%|j                         | _        | j                         S | j                  j                  j                  dd      | _        | j                  s%| j                  j                  j                  | _        | j                  sd}t        |      | j                         S )Ndefault_roler   zcannot determine default role!)rI  r   r   r   rJ  rK  r  r   r0   r   r   ry   r,  rN  r   run)	r   r0   rI  r   r   rJ  rK  r  r1   s	            r4   __call__zSphinxRole.__call__  s     TN	")"5w2 

DI xxz **..~rBDI99 HHOO88	996!#&&xxzr6   c                    t         ra   )NotImplementedErrorr   s    r4   rO  zSphinxRole.run  s    !!r6   c                V    | j                   j                  j                  j                  S r(  )rJ  r   r   r   r   s    r4   r   zSphinxRole.env  s      ||$$--111r6   c                .    | j                   j                  S r*  r+  r   s    r4   r,  zSphinxRole.config  r-  r6   c                h    || j                   }| j                  j                  j                  |      S ra   )r   rJ  re   r  )r   r   s     r4   r/  zSphinxRole.get_source_info  s+    >[[F||$$88@@r6   c                @    | j                  |      \  |_        |_        y ra   r1  )r   r>   r   s      r4   r3  zSphinxRole.set_source_info  s    !%!5!5f!=TYr6   c                N    dj                  d | j                         D              S )r5  r   c              3  2   K   | ]  }t        |        y wra   r7  r8  s     r4   r;  z*SphinxRole.get_location.<locals>.<genexpr>   r<  r=  r>  r   s    r4   r?  zSphinxRole.get_location  r@  r6   Nrb   r0   ri   rI  ri   r   ri   r   r   rJ  r   rK  zdict | Noner  rL  rj   'tuple[list[Node], list[system_message]])rj   r[  rA  rB  ra   )r   
int | Nonerj   rC  )r>   r!   r   r\  rj   r   rE  )r-   r   r   r   __annotations__rP  rO  rF  r   r,  r/  r3  r?  rb   r6   r4   rH  rH    s     IL
IK   Z\!,7IV=." 2 2  A
>@r6   rH  c                       e Zd ZU dZded<   ded<   ded<   ded<    ej                  dej                        Z	 d
	 	 	 	 	 	 	 d fd	Z	 xZ
S )ReferenceRolezA base class for reference roles.

    The reference roles can accept ``link title <target>`` style as a text for
    the role.  The parsed result; link title and target will be stored to
    ``self.title`` and ``self.target``.
    r  has_explicit_titledisabledri   titletargetz^(.+?)\s*(?<!\x00)<(.*?)>$c           	     v   |i }|j                  d      | _        | j                  j                  |      }|rFd| _        t        |j                  d            | _        t        |j                  d            | _        n'd| _        t        |      | _        t        |      | _        t        	| )  |||||||      S )N!Tr   r   F)
startswithra  explicit_title_rematchr`  r   grouprb  rc  r   rP  )
r   r0   rI  r   r   rJ  rK  r  r   r   s
            r4   rP  zReferenceRole.__call__  s     ?G ,((..t4&*D#!'--"23DJ"7==#34DK&+D#!$DJ"4.DKwgtVWgwWWr6   rY  rZ  )r-   r   r   r   r]  recompileDOTALLrg  rP  r   r   s   @r4   r_  r_    sp     NJK #

#@"))L Z\X!X,7XIVX=X Xr6   r_  c                  D     e Zd ZdZd fdZd fdZd fdZddZ xZS )SphinxTranslatorax  A base class for Sphinx translators.

    This class adds a support for visitor/departure method for super node class
    if visitor/departure method for node class is not found.

    It also provides helper methods for Sphinx translators.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    c                v    t         |   |       || _        |j                  | _        |j                  | _        y ra   )r   r   builderr,  r   )r   r   rp  r   s      r4   r   zSphinxTranslator.__init__4  s/    "nn ))r6   c                    |j                   j                  D ](  }t        | d|j                  z  d      }|s  ||        y t        |   |       y)z
        Dispatch node to appropriate visitor method.
        The priority of visitor method is:

        1. ``self.visit_{node_class}()``
        2. ``self.visit_{super_node_class}()``
        3. ``self.unknown_visit()``
        zvisit_%sN)r   __mro__r   r-   r   dispatch_visitr   r>   
node_classmethodr   s       r4   rs  zSphinxTranslator.dispatch_visit:  sS     ..00 	)JT:1D1D#EtLFt		) G"4(r6   c                    |j                   j                  D ](  }t        | d|j                  z  d      }|s  ||        y t        |   |       y)z
        Dispatch node to appropriate departure method.
        The priority of departure method is:

        1. ``self.depart_{node_class}()``
        2. ``self.depart_{super_node_class}()``
        3. ``self.unknown_departure()``
        z	depart_%sN)r   rr  r   r-   r   dispatch_departurert  s       r4   rx  z#SphinxTranslator.dispatch_departureK  sS     ..00 	-JT;*2E2E#FMFt		- G&t,r6   c                F    t         j                  t        d      ||       y )Nzunknown node type: %rr   )r   r   r   r   s     r4   unknown_visitzSphinxTranslator.unknown_visit\  s    r12D4Hr6   )r   r   rp  r#   rj   r   rD  )	r-   r   r   r   r   rs  rx  rz  r   r   s   @r4   rn  rn  (  s    	*)"-"Ir6   rn  ztuple[Values, Reporter]__document_cache__c                "   	 t         \  }}|t        |      }ddlm	} |j                  |||       }|j                  | d       |S # t        $ r? t        j                  j	                  |       }|j
                  |j                  fxa \  }}Y w xY w)a&  Return a new empty document object.  This is an alternative of docutils'.

    This is a simple wrapper for ``docutils.utils.new_document()``.  It
    caches the result of docutils' and use it on second call for instantiation.
    This makes an instantiation of document nodes much faster.
    r   )addnodes)r   )r{  	NameErrorrl   utilsnew_documentr   re   r   sphinxr}  r   note_source)source_pathr   cached_settingsre   docr}  r   s          r4   r  r  e  s    T$6!
 (    8K HHb)O  Tnn))+69<s||9SS6_hTs   	A ABB)rj   Generator[None, None, None])r0   ri   rj   r  )r0   ri   rE   ztype[Directive]rj   r   )r0   ri   rJ   r&   rj   r   )r0   ri   rj   r   )r>   type[Element]rj   r  )r>   r  rj   r   )r|   z
str | Nonerj   r  ra   )r  r   r  r   rj   r  )r  ri   r   r
   rj   r   )dr   
__future__r   rw   rj  collections.abcr   
contextlibr   r   r   typingr   r	   r
   r   r   rl   r   docutils.ior   docutils.parsers.rstr   r   r   docutils.parsers.rst.statesr   docutils.statemachiner   r   r   docutils.utilsr   r   docutils.writers._html_baser   sphinx.errorsr   sphinx.localer   r   sphinx.utilr   	getLoggerr-   r   rk  r   r   typesr   docutils.frontendr   docutils.nodesr    r!   r"   sphinx.buildersr#   sphinx.configr$   sphinx.environmentr%   sphinx.util.typingr&   r'   r,   r5   setr7   r]  r?   rB   rD   rG   rK   rN   rT   rX   r<   rf   rt   r~   r   r   r   r   r   r   r   r   r  r  r  r&  rH  r_  NodeVisitorrn  r  rb   r6   r4   <module>r     s   % " 	 	 $ %   9 9   " = = / A A - 6 %  			8	$BJJ[\	) (<<'$3/ 224OP 
	 (+u $ , + + *
3 
*!
G
#	D 7 7& C C. : : A A@  '0 '0T	 	4N) 4Nn9 9Eh E%8 % 7 7"#z #&@i @@B@ B@J"XJ "XJ5Iu(( 5It , +r6   