Пример #1
0
def V(text, stack=S, dictionary=D):
    tp = TracePrinter()
    try:
        run(text, stack, dictionary, tp.viewer)
    except:
        exc = format_exc()
        tp.print_()
        print '-' * 73
        print exc
    else:
        tp.print_()
Пример #2
0
 def interpret(self, command):
     self.stack, _, self.dictionary = run(
         command,
         self.stack,
         self.dictionary,
     )
     self.print_stack()
Пример #3
0
 def handle(self, message):
     if (isinstance(message, ModifyMessage)
             and message.subject is self.stack_holder):
         self._log_lines('', '%s <-' % self.format_stack())
     if not isinstance(message, CommandMessage):
         return
     c, s, d = message.command, self.stack_holder[0], self.dictionary
     self._log_lines('', '-> %s' % (c, ))
     self.stack_holder[0], _, self.dictionary = run(c, s, d)
     mm = ModifyMessage(self, self.stack_holder, content_id=self.stack_id)
     self.notify(mm)
Пример #4
0
    def do_execute(
      self,
      code,
      silent,
      store_history=True,
      user_expressions=None,
      allow_stdin=False,
      ):
      self.S = run(code, self.S, self.D)[0]
      if not silent:
        stream_content = {
          'name': 'stdout',
          'text': stack_to_string(self.S),
          }
        self.send_response(self.iopub_socket, 'stream', stream_content)

      return {'status': 'ok',
              # The base class increments the execution count
              'execution_count': self.execution_count,
              'payload': [],
              'user_expressions': {},
             }
Пример #5
0
def J(text, stack=S, dictionary=D):
    print stack_to_string(run(text, stack, dictionary)[0])
Пример #6
0
 def f():
   self.S = run(code, self.S, self.D)[0]