def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.log.setLevel(logging.INFO) identifier_regex = r'[^\d\W]\w*' function_call_regex = r'([^\d\W][\w\.]*)\([^\)\()]*' magic_prefixes = dict(magic='%', shell='!', help='?') magic_suffixes = dict(help='?') self.parser = Parser(identifier_regex, function_call_regex, magic_prefixes, magic_suffixes)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) # Signal handlers are inherited by forked processes, and we can't easily # reset it from the subprocess. Since kernelapp ignores SIGINT except in # message handlers, we need to temporarily reset the SIGINT handler here # so that bash and its children are interruptible. sig = signal.signal(signal.SIGINT, signal.SIG_DFL) try: self.bashwrapper = replwrap.bash() finally: signal.signal(signal.SIGINT, sig)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_idl() try: self.hist_file = os.path.join(locate_profile(),'idl_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): Kernel.__init__(self, **kwargs) # prepare keywords for auto-completion self.keywords = [] try: keywords_file = open("keywords.txt", "r") self.keywords = keywords_file.read().split() keywords_file.close() except: pass self._start_bash()
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 = powershell_repl.PowershellRepl( 'utf8', cmd=[powershell_command, '-noprofile', '-File', '-']) self.proxy = powershell_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) if os.path.exists(self.mysql_setting_file): with open(self.mysql_setting_file,"r") as f: self.mysql_config.update(json.load(f)) self.prompt = self.mysql_config["prompt"] self._start_process() self.table_names = [] self.use_pat1 = re.compile(r"use\s+(?P<schema>[a-z0-9_]+)\s*;") self.use_pat2 = re.compile(r"\\u\s+(?P<schema>[a-z0-9_]+)\s*") self.schema_pat = re.compile(r"[a-z0-9_]+") self.tail_pat = re.compile(r"(.*?)(;|\\g|\\G)\s*$") self.select_pat = re.compile(r"^\s*select.*",flags=re.IGNORECASE) if "select_limit" in self.mysql_config: self.select_limit = int(self.mysql_config["select_limit"]) self.select_limit_pat = re.compile(r".*?limit\s+\d+\s*$",flags=re.IGNORECASE) # NOTE: no ; or \g or \G
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) # TODO: Launch gforth 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=1, close_fds=ON_POSIX) self._gforth_que = Queue() t = Thread(target=enqueue_output, args=(self._gforth.stdout, self._gforth_que)) t.daemon = True # thread dies with the program t.start()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) if os.path.exists(self.mysql_setting_file): with open(self.mysql_setting_file, "r") as f: self.mysql_config.update(json.load(f)) self.prompt = self.mysql_config["prompt"] self._start_process() self.table_names = [] self.use_pat1 = re.compile(r"use\s+(?P<schema>[a-z0-9_]+)\s*;") self.use_pat2 = re.compile(r"\\u\s+(?P<schema>[a-z0-9_]+)\s*") self.schema_pat = re.compile(r"[a-z0-9_]+") self.tail_pat = re.compile(r"(.*?)(;|\\g|\\G)\s*$") self.select_pat = re.compile(r"^\s*select.*", flags=re.IGNORECASE) if "select_limit" in self.mysql_config: self.select_limit = int(self.mysql_config["select_limit"]) self.select_limit_pat = re.compile( r".*?limit\s+\d+\s*$", flags=re.IGNORECASE) # NOTE: no ; or \g or \G
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_bash()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) repl = powershell_repl.PowershellRepl('utf8', cmd=['powershell', '-noprofile', '-File', '-']) self.proxy = powershell_proxy.ReplProxy(repl)
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self.idl_initGConfig()
def __init__(self, **kwargs): Kernel.__init__(self, **kwargs) self._start_charmm()
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.app = theApp() self.app.start()