
    -e                        d Z ddlmZ ddlZ ej        e          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 d
Z G d de          Zd Z ej        d          ZdS )ae   Thoroughly document Bokeh enumerations

The ``bokeh-enum`` directive generates useful documentation for enumerations,
including all the allowable values. If the number of values is large, the full
list is put in a collapsible code block.

This directive takes the name of a Bokeh enum variable as the argument and the
module name as an option. An optional description may be added as content:

.. code-block:: rest

    .. bokeh-enum:: baz
        :module: bokeh.sphinxext.sample

        Specify a baz style

Examples
--------

The directive above will generate the following output:

    .. bokeh-enum:: baz
        :module: bokeh.sphinxext.sample

        Specify a baz style

Although ``bokeh-enum`` may be used explicitly, it is more often convenient in
conjunction with the :ref:`bokeh.sphinxext.bokeh_autodoc` extension. Together,
the same output above will be generated directly from the following code:

.. code-block:: python

    #: Specify a baz style
    baz = enumeration("a", "b", "c")

To enable this extension, add `"bokeh.sphinxext.bokeh_enum"` to the extensions
list in your Sphinx configuration module.

    )annotationsN)	unchanged)SphinxError   )PARALLEL_SAFE)BokehDirective)ENUM_DETAIL)BokehEnumDirectivesetupc                  (    e Zd ZdZdZed dZd ZdS )r
   Tr   c                    dS )NT )xs    :lib/python3.11/site-packages/bokeh/sphinxext/bokeh_enum.py<lambda>zBokehEnumDirective.<lambda>a   s    T     )modulenoindexc                ,   | j         d         }| j        d         }	 t          j        |          }n## t          $ r t          d|d|           w xY wt          ||d           }t          |          }t          |          dk    r2|d d          d|dd           }t          
                    |          }n|}d }t          j        || j        d         | j                            d	d
          | j        ||          }|                     |d          S )Nr   r   z&Could not generate reference docs for z: could not import module    (   z .... ir   F)namer   r   content	shortreprfullreprz<bokeh-enum>)	argumentsoptions	importlibimport_moduleImportErrorr   getattrreprlen_wrapperwrapr	   rendergetr   parse)self	enum_namemodule_namer   enumr   r   rst_texts           r   runzBokehEnumDirective.rund   s:   N1%	l8,	},[99FF 	} 	} 	}{y{{ny{{|||	} vy$//::x==3#CRC=@@@@I}}X..HH IH%<)L$$Y66L
 
 
 zz(N333s	   1  AN)__name__
__module____qualname__has_contentrequired_argumentsr   option_specr.   r   r   r   r
   r
   [   sB        K!> K
4 4 4 4 4r   r
   c                H    |                      ddt                     t          S )z+ Required Sphinx extension setup function. pyz
bokeh-enum)add_directive_to_domainr
   r   )apps    r   r   r      s!    l4FGGGr   z    )subsequent_indent)__doc__
__future__r   logging	getLoggerr/   logr   textwrapdocutils.parsers.rst.directivesr   sphinx.errorsr    r   bokeh_directiver   	templatesr	   __all__r
   r   TextWrapperr$   r   r   r   <module>rG      s  & &V # " " " " " g!!      6 5 5 5 5 5 % % % % % %       + + + + + + " " " " " "%4 %4 %4 %4 %4 %4 %4 %4P    8&999r   