<s> """<STR_LIT>""" <EOL> import logging <EOL> from envisage . api import ( bind_extension_point , ExtensionPoint , Plugin , <EOL> ServiceOffer ) <EOL> from traits . api import Instance , List <EOL> IPYTHON_KERNEL_PROTOCOL = '<STR_LIT>' <EOL> IPYTHON_NAMESPACE = '<STR_LIT>' <EOL> logger = logging . getLogger ( __name__ ) <EOL> class IPythonKernelPlugin ( Plugin ) : <EOL> """<STR_LIT>""" <EOL> SERVICE_OFFERS = '<STR_LIT>' <EOL> id = '<STR_LIT>' <EOL> name = '<STR_LIT>' <EOL> def stop ( self ) : <EOL> logger . info ( '<STR_LIT>' ) <EOL> self . kernel . shutdown ( ) <EOL> kernel_namespace = ExtensionPoint ( <EOL> List , id = IPYTHON_NAMESPACE , desc = """<STR_LIT>""" <EOL> ) <EOL> kernel = Instance ( IPYTHON_KERNEL_PROTOCOL ) <EOL> service_offers = List ( contributes_to = SERVICE_OFFERS ) <EOL> def _service_offers_default ( self ) : <EOL> ipython_kernel_service_offer = ServiceOffer ( <EOL> protocol = IPYTHON_KERNEL_PROTOCOL , <EOL> factory = self . _create_kernel , <EOL> ) <EOL> return [ ipython_kernel_service_offer ] <EOL> def _create_kernel ( self ) : <EOL> return self . kernel <EOL> def _kernel_default ( self ) : <EOL> from . internal_ipkernel import InternalIPKernel <EOL> kernel = InternalIPKernel ( ) <EOL> bind_extension_point ( kernel , '<STR_LIT>' , <EOL> IPYTHON_NAMESPACE , self . application ) <EOL> return kernel </s>
