def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) log('inside init') # Catch KeyboardInterrupt, cancel query, raise QueryCancelledError psycopg2.extensions.set_wait_callback(wait_select_inter) self._conn_string = os.getenv('DATABASE_URL', '') self._autocommit = True self._conn = None self._start_connection()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) # The path to the unix micropython should be in the PATH, if not check # the env for MPUNIX #TODO: Use shutil.which() in python 3.3+ self.micropython_exe = 'micropython' if os.environ.get('MPUNIX') is not None: self.micropython_exe = os.environ.get('MPUNIX') self._start_interpreter()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._replace_get_ipython() self.comm_manager = CommManager(shell=None, parent=self, kernel=self) self.shell_handlers["comm_open"] = self.comm_manager.comm_open self.shell_handlers["comm_msg"] = self.comm_manager.comm_msg self.shell_handlers["comm_close"] = self.comm_manager.comm_close self.comm_manager.register_target("ipython.widget", Widget.handle_comm_opened) self._start_singular()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._replace_get_ipython() self.comm_manager = CommManager(shell=None, parent=self, kernel=self) self.shell_handlers['comm_open'] = self.comm_manager.comm_open self.shell_handlers['comm_msg'] = self.comm_manager.comm_msg self.shell_handlers['comm_close'] = self.comm_manager.comm_close if ipywidgets_extension_loaded: self.comm_manager.register_target('ipython.widget', Widget.handle_comm_opened) self._start_polymake()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_jython() try: self.hist_file = os.path.join(locate_profile(),'jython_kernel.hist') except: self.hist_file = None self.log.warn('No default profile found, history unavailable') self.max_hist_cache = 1000 self.hist_cache = []
def __init__(self, **kwargs): self.mathjax_initialized = False Kernel.__init__(self, **kwargs) if self.log is None: # This occurs if we call as a stand-alone kernel # (eg, not as a process) # FIXME: take care of input/output, eg StringIO # make work without a session self.log = logging.Logger("NotebookApp") self.definitions = Definitions(add_builtin=True) # TODO Cache self.definitions.set_ownvalue('$Line', Integer(0)) # Reset the line number
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) # powershell_command env variable is set by the kernel to allow both powershell and pwsh # but on python2 we cannot pass it thru env variable, see https://github.com/vors/jupyter-powershell/issues/7 # TODO(python2): can we pass it somehow differently and still provide user-picked value on python2? try: powershell_command = environ['powershell_command'] except: powershell_command = get_powershell() repl = subprocess_repl.SubprocessRepl([powershell_command, '-noprofile', '-File', '-']) self.proxy = powershell_proxy.ReplProxy(repl)
def __init__(self, **kwargs): """ Constructor """ Kernel.__init__(self, **kwargs); opt = ""; if "LOG4J_CONF_FILE" in os.environ: opt += " -4 " + os.environ["LOG4J_CONF_FILE"]; # Start grunt self.pig = pexpect.spawn("/opt/pig-0.15.0/bin/pig -x local " + opt); # Wait until grunt start self.pig.expect(GRUNT_NEW_LINE_MODEL, timeout=GRUNT_START_TIMEOUT);
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_ncl() try: self.hist_file = os.path.join(locate_profile(),'ncl_kernel.hist') except: self.hist_file = None self.log.warn('No default profile found, history unavailable') self.max_hist_cache = 1000 self.hist_cache = [] #self._default_matches=cPickle.load(open('data/inbuilt_list', 'rb')) self._default_matches=self.inbuiltlist()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) # Instantiate IPython.core.debugger.Pdb here, pass it a phony # stdout that provides a dummy flush() method and a write() method # that internally sends data using a function so that it can # be initialized to use self.send_response() write_func = lambda s: self.send_response(self.iopub_socket, 'stream', {'name': 'stdout', 'text': s}) sys.excepthook = functools.partial(BdbQuit_excepthook, excepthook=sys.excepthook) self.debugger = Pdb(stdout=PhonyStdout(write_func)) self.debugger.set_trace(sys._getframe().f_back)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) ON_POSIX = 'posix' in sys.builtin_module_names def enqueue_output(out, queue): for line in iter(out.readline, b''): queue.put(line) out.close() self._gforth = Popen('gforth', stdin=PIPE, stdout=PIPE, bufsize=2, close_fds=ON_POSIX) self._gforth_queue = Queue() t = Thread(target=enqueue_output, args=(self._gforth.stdout, self._gforth_queue)) t.daemon = True t.start()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_magma()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._ = None self.executable = None self.silent = False
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_egison()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = subprocess_repl.SubprocessRepl( ['C:\\cygwin64\\bin\\bash.exe', '-i']) self.proxy = cygwin_bash_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.tcl = Tkinter.Tcl() self.execution_count = 0 putsredef = 'rename puts original_puts \nproc puts {args} {\n if {[llength $args] == 1} {\n return "=> [lindex $args 0]"\n } else {\n eval original_puts $args\n }\n}\n' self.tcl.eval(putsredef)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_spark()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_smlnj()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.server = httpSPAD() self.spadcmds = spadkernel.spadcmd.spad_commands
def __init__(self, **kwargs): # path to connection_file. In case we need it in the close future #from ipykernel import get_connection_file #s = get_connection_file() #writeln("########## " + str(s)) self._port = DYALOG_PORT # lets find first available port, starting from default DYALOG_PORT (:4502) # this makes sense only if Dyalog APL and Jupyter executables are on the same host (localhost) if DYALOG_HOST == '127.0.0.1': while True: sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) result = sock.connect_ex((str(DYALOG_HOST).strip(),self._port)) sock.close() #port is available if result !=0: break else: #try next port self._port += 1 # if Dyalog APL and Jupyter executables are on the same host (localhost) let's start instance of Dyalog if DYALOG_HOST == '127.0.0.1': if sys.platform.lower().startswith('win'): #Windows. Let's find an installed version to use hklmReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE) dyalogKey = OpenKey(hklmReg, r"SOFTWARE\Dyalog") installCount = QueryInfoKey(dyalogKey)[0] for n in range(installCount): currInstall = EnumKey(dyalogKey, installCount - (n + 1)) if currInstall[:12] == "Dyalog APL/W": break lastKey = OpenKey(hklmReg, r"SOFTWARE\\Dyalog\\" + currInstall) dyalogPath = QueryValueEx(lastKey,"dyalog")[0] + "\\dyalog.exe" CloseKey(dyalogKey) CloseKey(lastKey) self.dyalog_subprocess = subprocess.Popen([dyalogPath,"RIDE_SPAWNED=1",'RIDE_INIT=SERVE::' + str(self._port).strip(), os.path.dirname(os.path.abspath(__file__)) + '/init.dws']) else: #linux, darwin... etc dyalog_env = os.environ.copy() dyalog_env['RIDE_INIT'] = 'SERVE::' + str(self._port).strip() #start dyalog executable in xterm. Req: xterm must be installed. dyalog should be in the path #self.dyalog_subprocess = subprocess.Popen(['xterm', '-e', ('dyalog ' + os.path.dirname(os.path.abspath(__file__)) + '/init.dws')], env=dyalog_env) self.dyalog_subprocess = subprocess.Popen(['dyalog', '+s', '-q', os.path.dirname(os.path.abspath(__file__)) + '/init.dws'], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=dyalog_env) #disable auto closing of brackets/quotation marks. Not very useful in APL #Pass None instead of False to restore auto-closing feature c = ConfigManager() c.update('notebook', {'CodeCell': {'cm_config': {'autoCloseBrackets': False}}}) Kernel.__init__(self, **kwargs) self.dyalog_ride_connect()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.start_redis(**kwargs) self.get_commands() self.start_history()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.kotlin_shell = self.start_kotlin_shell()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = subprocess_repl.SubprocessRepl(['C:\\cygwin64\\bin\\bash.exe','-i']) self.proxy = cygwin_bash_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.cookery = Cookery(jupyter=True) self.cookery.log = self.log.getChild(self.implementation)
def __init__(self, **kwargs): """ >>> idl = IDL_kernel() """ Kernel.__init__(self, **kwargs) self.idl_post_reset()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_interpreter()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.omc = OMCSessionZMQ() self.matfile = None
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = subprocess_repl.SubprocessRepl(['/usr/local/package/simvascular/REPLACE_SV_TIMESTAMP/simvascular', '-python', '--', '-i']) self.proxy = simvascular_python_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.idris2repl = replwrap.REPLWrapper("idris2", "Main> ", None)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.client = command.Client() self.qsh = sh.QSh(self.client)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.server = httpSPAD() self.fricas_operations = fricas_operations self.fricas_constructors = fricas_constructors self.fricas_ids = sorted(fricas_operations + fricas_constructors)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = subprocess_repl.SubprocessRepl(['C:\\Program Files\\SimVascular\\SimVascular\\2019-02-05\\sv.bat', '-tcl', '--']) self.proxy = simvascular_tcl_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.tcl = Tkinter.Tcl() self.execution_count = 0
def __init__(self, **kwargs): start_time = time.time() Kernel.__init__(self, **kwargs) logger.debug("session %s %s", type(self.session), self.session) logger.debug("iopub_socket %s %s", type(self.iopub_socket), self.iopub_socket) self.original_iopub_socket = self.iopub_socket self.iopub_socket = Splitter([self.original_iopub_socket, self]) self.shell = self.shell_class.instance(parent=self, profile_dir=self.profile_dir, user_ns=self.user_ns, kernel=self) self.shell.displayhook.session = self.session self.shell.displayhook.pub_socket = self.iopub_socket self.shell.displayhook.topic = self._topic('execute_result') self.shell.display_pub.session = self.session self.shell.display_pub.pub_socket = self.iopub_socket self.comm_manager = CommManager(parent=self, kernel=self) self.shell.configurables.append(self.comm_manager) self.shell_handlers['comm_open'] = self.comm_open self.shell_handlers['comm_msg'] = self.comm_msg self.shell_handlers['comm_close'] = self.comm_close self.ansible_cfg = None self.ansible_process = None self.current_play = None self.next_task_file = None self.task_files = [] self.registered_variable = None self.playbook_file = None self.silent = False self.runner = None self.runner_thread = None self.shutdown_requested = False self.shutdown = False self.widgets = defaultdict(dict) self.widget_update_order = 0 self.vault_password = None self.default_inventory = "[all]\nlocalhost ansible_connection=local\n" self.default_play = yaml.dump( dict(hosts='localhost', name='default', gather_facts=False)) self.temp_dir = tempfile.mkdtemp(prefix="ansible_kernel_playbook") self.queue = None self.tasks_counter = 0 self.current_task = None logger.debug(self.temp_dir) os.mkdir(os.path.join(self.temp_dir, 'env')) os.mkdir(os.path.join(self.temp_dir, 'project')) os.mkdir(os.path.join(self.temp_dir, 'project', 'roles')) with open(os.path.join(self.temp_dir, 'env', 'settings'), 'w') as f: f.write(json.dumps(dict(idle_timeout=0, job_timeout=0))) self.do_inventory(self.default_inventory) self.shell.run_code("import json") self.do_execute_play(self.default_play) logger.info("Kernel init finished took %s", time.time() - start_time)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_prolog()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = subprocess_repl.SubprocessRepl(['C:\\Program Files\\SimVascular\\SimVascular\\REPLACE_SV_TIMESTAMP\\sv.bat', '-python', '--', '-i']) self.proxy = simvascular_python_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_bash()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.definitions = Definitions(add_builtin=True) # TODO Cache self.definitions.set_ownvalue('$Line', Integer(0)) # Reset the line number self.establish_comm_manager() # needed for ipywidgets and Manipulate[]
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.hostname = os.environ.get('CASSANDRA_HOSTNAME','localhost') self._start_cql()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._results = [] self._errors = [] self._fakerepl = fakerepl.FakeRepl(self._results.append, self._errors.append)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.engine = False
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.agda_version = self.readAgdaVersion()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.driver = DriverServiceStub(insecure_channel(BRANE_DRV_URL)) self.session_uuid = None
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) log('inside init') # Catch KeyboardInterrupt, cancel query, raise QueryCancelledError psycopg2.extensions.set_wait_callback(wait_select_inter) self._start_connection()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_tarantool()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.repl = ReplWrapper()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_pike()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.omc = OMCSession() self.matfile = None
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.jython = None self._init_jython()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_acl2()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.conn = None for code in ['sqlite://']: connection.Connection.get(code)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_gap()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) logger.debug(self.language_info) logger.debug(self.language_version) logger.debug(self.banner) self._start_mongo()