
    -eY                        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d
lmZmZ ddlmZ dZ G d de          Zd ZdS )a   Thoroughly document Bokeh options classes.

The ``bokeh-options`` directive will automatically document all the properties
of a Bokeh Options class under a heading of "Keyword Args".

This directive takes the name of a Bokeh Options subclass as the argument, and
its module as an option:

.. code-block:: rest

    .. bokeh-options:: Opts
        :module: bokeh.sphinxext.sample

Examples
--------

For the following definition of ``bokeh.sphinxext.sample.Opts``:

.. code-block:: python

    class Opts(Options):
        ''' This is an Options class '''

        host = String(default="localhost", help="a host to connect to")
        port = Int(default=5890, help="a port to connect to")

the above usage yields the output:

    .. bokeh-options:: Opts
        :module: bokeh.sphinxext.sample

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

    )annotationsN)	unchanged)SphinxError)	type_link)Options   )PARALLEL_SAFE)BokehDirective	py_sig_re)OPTIONS_DETAIL)BokehOptionsDirectivesetupc                  (    e Zd ZdZdZdZdeiZd ZdS )r   Tr   modulec                   d                     | j                  }t          j        |          }|t	          d|          |                                \  }}}}| j        d         }	 t          j        |          }n## t          $ r t	          d| d|           w xY wt          ||d           }	|	t	          d| d|           t          |	t                    st	          d| d	           |	i           }
g }t          |
                                          D ]}|
                    |          }|                    t#          |t%          |j                  t)          |                    |
                    |j        d
n*t/          j        |j                                                                       t5          j        |          }|                     |d          S )N z-Unable to parse signature for bokeh-options: r   z.Unable to generate options reference docs for z, couldn't import module z6Unable to generate options reference docs: no options z in module z+Unable to generate options reference docs: z is not a subclass of Options )nametypedefaultdoc)optsz<bokeh-options>)join	argumentsr   matchr   groupsoptions	importlibimport_moduleImportErrorgetattr
issubclassr   sorted
propertieslookupappenddictr   propertyreprinstance_default__doc__textwrapdedentrstripr   renderparse)selfsigmname_prefixoptions_namearglistretannmodule_namer   r   options_objr   	prop_name
descriptorrst_texts                  =lib/python3.11/site-packages/bokeh/sphinxext/bokeh_options.pyrunzBokehOptionsDirective.runb   s,   hht~&&OC  9UcUUVVV56XXZZ2\7Fl8,	E,[99FF 	E 	E 	E  D|  D  D  wB  D  D  E  E  E	E &,55?}Wc}}p{}}~~~'7++ 	ywLwwwxxxgbkk 6 6 8 899 		 		I$++I66JKK"":#677 !<!<[!I!IJJ(08hojN`NgNgNiNi>j>j	      "(d333zz($5666s   *A? ? BN)	__name__
__module____qualname__has_contentrequired_argumentsoptional_argumentsr   option_specr>        r=   r   r   [   s>        KY'K&7 &7 &7 &7 &7rG   r   c                H    |                      ddt                     t          S )z+ Required Sphinx extension setup function. pyzbokeh-options)add_directive_to_domainr   r	   )apps    r=   r   r      s!    o7LMMMrG   )r+   
__future__r   logging	getLoggerr?   logr   r,   docutils.parsers.rst.directivesr   sphinx.errorsr   bokeh.core.property._sphinxr   bokeh.util.optionsr   r   r	   bokeh_directiver
   r   	templatesr   __all__r   r   rF   rG   r=   <module>rW      s+  " "N # " " " " " g!!      6 5 5 5 5 5 % % % % % % 2 1 1 1 1 1 & & & & & &       6 6 6 6 6 6 6 6 % % % % % %-7 -7 -7 -7 -7N -7 -7 -7`    rG   