
    7 f
                        d Z ddlmZ ddlmZmZ ddlmZ ddlZddl	m
Z
 ddlmZ erddlmZ dd	lmZ dd
lmZ  G d dej                  Z G d de
          ZddZddZdS )a  Provides the ``ifconfig`` directive.

The ``ifconfig`` directive enables writing documentation
that is included depending on configuration variables.

Usage::

    .. ifconfig:: releaselevel in ('alpha', 'beta', 'rc')

       This stuff is only included in the built docs for unstable versions.

The argument for ``ifconfig`` is a plain Python expression, evaluated in the
namespace of the project configuration (that is, all variables from
``conf.py`` are available.)
    )annotations)TYPE_CHECKINGAny)nodesN)SphinxDirective)nested_parse_with_titles)Node)Sphinx)
OptionSpecc                      e Zd ZdS )ifconfigN)__name__
__module____qualname__     I/var/www/equiseq/venv/lib/python3.11/site-packages/sphinx/ext/ifconfig.pyr   r   "   s        Dr   r   c                  6    e Zd ZU dZdZdZdZi Zded<   d
dZ	d	S )IfConfigT   r   r   option_specreturn
list[Node]c                    t                      }| j        j        |_        |                     |           | j        d         |d<   t          | j        | j        || j                   |gS )Nr   expr)r   statedocumentset_source_info	argumentsr   contentcontent_offset)selfnodes     r   runzIfConfig.run.   s]    zz
+T"""~a(V T\4ATUUUvr   N)r   r   )
r   r   r   has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer   __annotations__r$   r   r   r   r   r   &   sR         K $ K         r   r   appr
   doctreenodes.documentdocnamestrr   Nonec                x   d | j         D             }|                    | j         j                                                   | j        j        |d<   t          |                    t                              D ]}	 t          |d         |          }|s|
                    g            1|
                    |j                   L# t          $ rh}ddlm} d                     ||j        |                    }|j                            d|z  |          }	|
                    |	           Y d }~d }~ww xY wd S )	Nc                (    i | ]}|j         |j        S r   )namevalue).0confvals     r   
<dictcomp>z*process_ifconfig_nodes.<locals>.<dictcomp>8   s    	@	@	@'',	@	@	@r   builderr   r   )format_exception_only z.Exception occurred in ifconfig expression: 
%s)	base_node)configupdate__dict__copyr7   r2   listfindallr   evalreplace_selfchildren	Exception	tracebackr8   join	__class__reportererror)
r*   r+   r-   nsr#   reserrr8   msgnewnodes
             r   process_ifconfig_nodesrO   7   sp   	@	@SZ	@	@	@BIIcj!&&(()))K$ByMW__X..// 1 1	1tF|R((C  1!!"%%%%!!$-0000  	' 	' 	'777777''//sCCDDC&,, .I-0.1<@ - B BG g&&&&&&&&	'1 1s   <C
D7AD22D7dict[str, Any]c                    |                      t                     |                     dt                     |                     dt
                     t          j        ddS )Nr   zdoctree-resolvedT)versionparallel_read_safe)add_noder   add_directiver   connectrO   sphinx__display_version__)r*   s    r   setuprY   M   sQ    LLj(+++KK"$:;;;1NNNr   )r*   r
   r+   r,   r-   r.   r   r/   )r*   r
   r   rP   )__doc__
__future__r   typingr   r   docutilsr   rW   sphinx.util.docutilsr   sphinx.util.nodesr   docutils.nodesr	   sphinx.applicationr
   sphinx.util.typingr   Elementr   r   rO   rY   r   r   r   <module>rd      sF     # " " " " " % % % % % % % %        0 0 0 0 0 0 6 6 6 6 6 6 .######))))))------	 	 	 	 	u} 	 	 	       "1 1 1 1,O O O O O Or   