σ
mάJ]c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z e j e  Z	 d d l
 m Z d d l m Z d d l m Z m Z m Z m Z d d l m Z d d	 l m Z d d
 l m Z m Z d Z e d e f d     Y Z d e f d     YZ d e f d     YZ d S(   u    Client-side interactivity.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   FunctionTypei   (   t   abstract(   t   Dictt   Stringt   Boolt   AnyRef(   t   Model(   t   import_required(   t   nodejs_compilet   CompilationErroru   Callbacku   OpenURLu   CustomJSt   Callbackc           B` s   e  Z d  Z RS(   u+    Base class for interactive callback.

    (   t   __name__t
   __module__t   __doc__(    (    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyR   2   s   t   OpenURLc           B` s2   e  Z d  Z e d d d Z e e d d Z RS(   u4    Open a URL in a new or current tab or window.

    u   http://t   helpu   
    The URL to direct the web browser to. This can be a template string,
    which will be formatted with data from the data source.
    uͺ   
    Open URL in a new (`False`, default) or current (`True`) tab or window.
    For `same_tab=False`, whether tab or window will be opened is browser
    dependent.
    (   R   R   R   R   t   urlR   t   Falset   same_tab(    (    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyR   9   s
   			t   CustomJSc           B` sn   e  Z d  Z e d    Z e i  d   Z e e e d d Z	 e d d d d  Z
 e d e d d  Z RS(	   uU   Execute a JavaScript function.

    .. warning::
        The explicit purpose of this Bokeh Model is to embed *raw JavaScript
        code* for a browser to execute. If any part of the code is derived
        from untrusted user inputs, then you must take appropriate care to
        sanitize the user input prior to passing to Bokeh.

    c         C` sΕ   d d l  m } | d  t | t  s8 t d   n  t d d d  } | j } | j j t	 |   } t
 t | |   } | j d d  | j | d	  d
 d j |  } |  d | d |  S(   u    Create a ``CustomJS`` instance from a Python function. The
        function is translated to JavaScript using PScript.
        i    (   t
   deprecateduk   'from_py_func' is deprecated and will be removed in an eventual 2.0 release. Use CustomJS directly instead.u,   CustomJS.from_py_func needs function object.u   pscriptu7   To use Python functions for CustomJS, you need PScript uA   ("conda install -c conda-forge pscript" or "pip install pscript")u   windowu   cbu   cb(%s);
u   , t   codet   argsN(   t   bokeh.util.deprecationR   t
   isinstanceR   t
   ValueErrorR   t   __defaults__t   __code__t   co_varnamest   lent   dictt   zipt   popt   Nonet   py2jst   join(   t   clst   funcR   t   pscriptt   default_valuest   default_namesR   R   (    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyt   from_py_funcT   s    

	#c         C` sP   t  | d d d d } d | k r6 t | j   n |  d | j d |  Sd S(	   uA    Create a ``CustomJS`` instance from CoffeeScript code.

        t   langu   coffeescriptt   fileu   ???u   errorR   R   N(   R   R   t   errorR   (   R(   R   R   t   compiled(    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyt   from_coffeescriptl   s    R   uΥ   
    A mapping of names to Python objects. In particular those can be bokeh's models.
    These objects are made available to the callback's code snippet as the values of
    named parameters to the callback.
    t   defaultu    u  
    A snippet of JavaScript code to execute in the browser. The
    code is made into the body of a function, and all of of the named objects in
    ``args`` are available as parameters that the code can use. Additionally,
    a ``cb_obj`` parameter contains the object that triggered the callback
    and an optional ``cb_data`` parameter that contains any tool-specific data
    (i.e. mouse coordinates and hovered glyph indices for the ``HoverTool``).

    .. note:: Use ``CustomJS.from_coffeescript()`` for CoffeeScript source code.

    uU   
    Enables or disables automatic insertion of ``"use strict";`` into ``code``.
    (   R   R   R   t   classmethodR-   R2   R   R   R	   R   R   R   R   t
   use_strict(    (    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyR   I   s   	
	
	(   u   Callbacku   OpenURLu   CustomJS(   R   t
   __future__R    R   R   R   t   loggingt	   getLoggerR   t   logt   typesR   t   core.has_propsR   t   core.propertiesR   R   R   R	   t   modelR
   t   util.dependenciesR   t   util.compilerR   R   t   __all__R   R   R   (    (    (    s5   lib/python2.7/site-packages/bokeh/models/callbacks.pyt   <module>
   s    ""  