Source code for core.interpreter.python

from code import InteractiveInterpreter


class Interpreter(InteractiveInterpreter):
[docs] @property def user_ns(self): return self.locals @user_ns.setter def user_ns(self, ns):
[docs] self.locals = ns def run_cell(self, raw_cell, **kwargs):
[docs] return self.runcode(raw_cell) def run_code(self, code_obj):
[docs] return self.runcode(code_obj) def reset(self, namespace=None, **kwargs):
[docs] self.locals.clear() if namespace: self.locals.update(namespace) def update(self, namespace, **kwargs):
[docs] namespace.update(self.locals) def push(self, variables, **kwargs):
[docs] self.locals.update(variables) def get(self, varnames, **kwargs):
[docs] dic = {} for name in varnames: dic[name] = self.locals[name] return dic def delete(self, varnames, **kwargs):
[docs] for name in varnames: del self.locals[name]