U
    /e2                     @  sX   d Z ddlmZ ddlZeeZddlmZ ddl	m
Z
 dZG dd	 d	Zd
d ZdS )z Provide the Instance property.

The Instance property is used to construct object graphs of Bokeh models,
where one Bokeh model refers to another.

    )annotationsNwraps   )Property)validatewithout_property_validationc                   @  s.   e Zd ZdZddddZdd Zdd	 Zd
S )r   a<   Control validation of bokeh properties

    This can be used as a context manager, or as a normal callable

    Args:
        value (bool) : Whether validation should occur or not

    Example:
        .. code-block:: python

            with validate(False):  # do no validate while within this block
                pass

            validate(False)  # don't validate ever

    See Also:
        :func:`~bokeh.core.property.bases.validation_on`: check the state of validation

        :func:`~bokeh.core.properties.without_property_validation`: function decorator

    None)returnc                 C  s   t j| _|t _d S N)r   _should_validateold)selfvalue r   B/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/core/property/validation.py__init__C   s    zvalidate.__init__c                 C  s   d S r   r   )r   r   r   r   	__enter__G   s    zvalidate.__enter__c                 C  s   | j t_d S r   )r   r   r   )r   typr   	tracebackr   r   r   __exit__J   s    zvalidate.__exit__N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   -   s   r   c                   s   t   fdd}|S )aY   Turn off property validation during update callbacks

    Example:
        .. code-block:: python

            @without_property_validation
            def update(attr, old, new):
                # do things without validation

    See Also:
        :class:`~bokeh.core.properties.validate`: context mangager for more fine-grained control

    c               
     s*   t d  | |W  5 Q R  S Q R X d S )NF)r   )argskwargsinput_functionr   r   func\   s    
z)without_property_validation.<locals>.funcr   )r   r   r   r   r   r   N   s    r   )r   
__future__r   logging	getLoggerr   log	functoolsr   basesr   __all__r   r   r   r   r   r   <module>   s   

	!