U
    /e                     @  s   d Z ddlmZ ddlZe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mZ ddlmZ dd	lmZmZ dd
lmZ dZG dd deZdd ZdS )a5   Thoroughly document Bokeh settings.

The ``bokeh-model`` directive will automatically document all the attributes
(including Bokeh PrioritizedSettings) of an object.

This directive takes the name of a module attribute

.. code-block:: rest

    .. bokeh-settings:: settings
        :module: bokeh.settings

    )annotationsN)	unchanged)SphinxError)PrioritizedSetting_Unset   )PARALLEL_SAFE)BokehDirective	py_sig_re)SETTINGS_DETAIL)BokehSettingsDirectivesetupc                   @  s(   e Zd ZdZdZdZdeiZdd ZdS )r   Tr   modulec                 C  s>  d | j}t|}|d kr,td|| \}}}}| jd }zt|}W n( t	k
r|   td| d| Y nX t
||d }	|	d krtd| d| d| g }
|	jj D ]d}t|tsq|j|j|jt|j|jtkrdnt|j|jtkrdnt|jd	}|
| qtj|||
d
}| |dS )N z+Unable to parse signature for bokeh-model: r   z&Unable to generate reference docs for z: couldn't import module z: no model z in module z(Unset))nameenv_vartypehelpdefaultdev_default)r   module_namesettingsz<bokeh-settings>)join	argumentsr
   matchr   groupsoptions	importlibimport_moduleImportErrorgetattr	__class____dict__values
isinstancer   r   r   Zconvert_typetextwrapdedentr   r   r   reprr   appendr   renderparse)selfsigmZname_prefixZobj_nameZarglistZretannr   r   objr   xZsettingZrst_text r0   B/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/sphinxext/bokeh_settings.pyrunK   s6    



zBokehSettingsDirective.runN)	__name__
__module____qualname__Zhas_contentZrequired_argumentsZoptional_argumentsr   Zoption_specr2   r0   r0   r0   r1   r   D   s
   r   c                 C  s   |  ddt tS )z+ Required Sphinx extension setup function. pyzbokeh-settings)Zadd_directive_to_domainr   r   )Zappr0   r0   r1   r   q   s    r   )__doc__
__future__r   logging	getLoggerr3   logr   r%   Zdocutils.parsers.rst.directivesr   Zsphinx.errorsr   Zbokeh.settingsr   r    r   Zbokeh_directiver	   r
   Z	templatesr   __all__r   r   r0   r0   r0   r1   <module>   s   
-