Пример #1
0
    def __init__(self, inp=None, out=None, opts={}):

        user_opts = DEFAULT_USER_SETTINGS.copy()
        user_opts.update(opts)

        from trepan.inout import input as Minput, output as Moutput

        atexit.register(self.finalize)
        self.interactive = True  # Or at least so we think initially
        self.input = inp or Minput.DebuggerUserInput()
        self.output = out or Moutput.DebuggerUserOutput()

        if self.input.use_history():
            self.complete = user_opts['complete']
            if self.complete:
                parse_and_bind("tab: complete")
                set_completer(self.complete)
                pass
            self.histfile = user_opts['histfile']
            if self.histfile:
                try:
                    read_history_file(histfile)
                except IOError:
                    pass
                except:
                    # PyPy read_history_file fails
                    return
                set_history_length(50)
                atexit.register(write_history_file, self.histfile)
                pass
        return
Пример #2
0
    def __init__(self, inp=None, out=None, opts={}):
        get_option = lambda key: Mmisc.option_set(opts, key,
                                                  DEFAULT_USER_SETTINGS)

        from trepan.inout import input as Minput, output as Moutput

        atexit.register(self.finalize)
        self.interactive = True  # Or at least so we think initially
        self.input = inp or Minput.DebuggerUserInput()
        self.output = out or Moutput.DebuggerUserOutput()

        if self.input.use_history():
            self.complete = get_option('complete')
            if self.complete:
                parse_and_bind("tab: complete")
                set_completer(self.complete)
                pass
            self.histfile = get_option('histfile')
            if self.histfile:
                try:
                    read_history_file(histfile)
                except IOError:
                    pass
                except:
                    # PyPy read_history_file may fail
                    return
                set_history_length(50)
                atexit.register(write_history_file, self.histfile)
                pass
        return
Пример #3
0
 def test_DebuggerInput(self):
     cmdhelper_file = os.path.join(srcdir, 'cmdhelper.py')
     inp = Minput.DebuggerUserInput(cmdhelper_file)
     self.assertTrue(inp, 'Should have gotten a TrepanInput object back')
     line = inp.readline()
     self.assertEqual('# -*- coding: utf-8 -*-', line)
     inp.close()
     # Should be okay
     inp.close()
     return
Пример #4
0
 def __init__(self, inp=None, out=None, opts=None):
     atexit.register(self.finalize)
     self.input       = inp or Minput.DebuggerUserInput()
     self.output      = out or Moutput.DebuggerUserOutput()
     self.pp          = pprint.PrettyPrinter()
     return