ó
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
 Z d e f d „  ƒ  YZ d	 „  Z d S(   ug    Bokeh Application Handler to look for Bokeh server lifecycle callbacks
in a specified Python module.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNi   (   t   Handleru   LifecycleHandlert   LifecycleHandlerc           B` sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   u?    Load a script which contains server lifecycle callbacks.

    c         O` sJ   t  t |  ƒ j | | Ž  t |  _ t |  _ t |  _ t |  _ t |  _	 d  S(   N(
   t   superR   t   __init__t   _do_nothingt   _on_server_loadedt   _on_server_unloadedt   _on_session_createdt   _on_session_destroyedt   Truet   safe_to_fork(   t   selft   argst   kwargs(    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyR   0   s    				c         C` s   d S(   uø    This handler does not make any modifications to the Document.

        Args:
            doc (Document) : A Bokeh Document to update in-place

                *This handler does not modify the document*

        Returns:
            None

        N(    (   R   t   doc(    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   modify_document:   s    c         C` s   |  j  | ƒ S(   u¼    Execute `on_server_unloaded`` from the configured module (if
        it is defined) when the server is first started.

        Args:
            server_context (ServerContext) :

        (   R	   (   R   t   server_context(    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   on_server_loadedI   s    c         C` s   |  j  | ƒ S(   uj   Execute ``on_server_unloaded`` from the configured module (if
        it is defined) when the server cleanly exits. (Before stopping the
        server's ``IOLoop``.)

        Args:
            server_context (ServerContext) :

        .. warning::
            In practice this code may not run, since servers are often killed
            by a signal.

        (   R
   (   R   R   (    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   on_server_unloadedS   s    c         C` s   |  j  | ƒ S(   u¼    Execute ``on_session_created`` from the configured module (if
        it is defined) when a new session is created.

        Args:
            session_context (SessionContext) :

        (   R   (   R   t   session_context(    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   on_session_createdb   s    c         C` s   |  j  | ƒ S(   uÀ    Execute ``on_session_destroyed`` from the configured module (if
        it is defined) when a new session is destroyed.

        Args:
            session_context (SessionContext) :

        (   R   (   R   R   (    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   on_session_destroyedl   s    (	   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   (    (    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyR   +   s   	
		
		
c         C` s   d  S(   N(    (   t   ignored(    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyR   ~   s    (   u   LifecycleHandler(   R   t
   __future__R    R   R   R   t   loggingt	   getLoggerR   t   logt   handlerR   t   __all__R   R   (    (    (    sC   lib/python2.7/site-packages/bokeh/application/handlers/lifecycle.pyt   <module>
   s   "S