Esempio n. 1
0
    def __init__(self,color_scheme='NoColor',completekey=None,
                 stdin=None, stdout=None):

        # Parent constructor:
        if has_pydb and completekey is None:
            OldPdb.__init__(self,stdin=stdin,stdout=io.stdout)
        else:
            OldPdb.__init__(self,completekey,stdin,stdout)

        self.prompt = prompt # The default prompt is '(Pdb)'

        # IPython changes...
        self.is_pydb = has_pydb

        self.shell = ipapi.get()

        if self.is_pydb:

            # interactiveshell.py's ipalias seems to want pdb's checkline
            # which located in pydb.fn
            import pydb.fns
            self.checkline = lambda filename, lineno: \
                             pydb.fns.checkline(self, filename, lineno)

            self.curframe = None
            self.do_restart = self.new_do_restart

            self.old_all_completions = self.shell.Completer.all_completions
            self.shell.Completer.all_completions=self.all_completions

            self.do_list = decorate_fn_with_doc(self.list_command_pydb,
                                                OldPdb.do_list)
            self.do_l     = self.do_list
            self.do_frame = decorate_fn_with_doc(self.new_do_frame,
                                                 OldPdb.do_frame)

        self.aliases = {}

        # Create color table: we copy the default one from the traceback
        # module and add a few attributes needed for debugging
        self.color_scheme_table = exception_colors()

        # shorthands
        C = coloransi.TermColors
        cst = self.color_scheme_table

        cst['NoColor'].colors.breakpoint_enabled = C.NoColor
        cst['NoColor'].colors.breakpoint_disabled = C.NoColor

        cst['Linux'].colors.breakpoint_enabled = C.LightRed
        cst['Linux'].colors.breakpoint_disabled = C.Red

        cst['LightBG'].colors.breakpoint_enabled = C.LightRed
        cst['LightBG'].colors.breakpoint_disabled = C.Red

        self.set_colors(color_scheme)

        # Add a python parser so we can syntax highlight source while
        # debugging.
        self.parser = PyColorize.Parser()
Esempio n. 2
0
    def __init__(self,color_scheme='NoColor',completekey=None,
                 stdin=None, stdout=None):

        # Parent constructor:
        if has_pydb and completekey is None:
            OldPdb.__init__(self,stdin=stdin,stdout=io.stdout)
        else:
            OldPdb.__init__(self,completekey,stdin,stdout)

        self.prompt = prompt # The default prompt is '(Pdb)'

        # IPython changes...
        self.is_pydb = has_pydb

        self.shell = ipapi.get()

        if self.is_pydb:

            # interactiveshell.py's ipalias seems to want pdb's checkline
            # which located in pydb.fn
            import pydb.fns
            self.checkline = lambda filename, lineno: \
                             pydb.fns.checkline(self, filename, lineno)

            self.curframe = None
            self.do_restart = self.new_do_restart

            self.old_all_completions = self.shell.Completer.all_completions
            self.shell.Completer.all_completions=self.all_completions

            self.do_list = decorate_fn_with_doc(self.list_command_pydb,
                                                OldPdb.do_list)
            self.do_l     = self.do_list
            self.do_frame = decorate_fn_with_doc(self.new_do_frame,
                                                 OldPdb.do_frame)

        self.aliases = {}

        # Create color table: we copy the default one from the traceback
        # module and add a few attributes needed for debugging
        self.color_scheme_table = exception_colors()

        # shorthands
        C = coloransi.TermColors
        cst = self.color_scheme_table

        cst['NoColor'].colors.breakpoint_enabled = C.NoColor
        cst['NoColor'].colors.breakpoint_disabled = C.NoColor

        cst['Linux'].colors.breakpoint_enabled = C.LightRed
        cst['Linux'].colors.breakpoint_disabled = C.Red

        cst['LightBG'].colors.breakpoint_enabled = C.LightRed
        cst['LightBG'].colors.breakpoint_disabled = C.Red

        self.set_colors(color_scheme)

        # Add a python parser so we can syntax highlight source while
        # debugging.
        self.parser = PyColorize.Parser()
Esempio n. 3
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     while True:
         try:
             OldPdb.interaction(self, frame, traceback)
         except KeyboardInterrupt:
             self.shell.write("\nKeyboardInterrupt\n")
         else:
             break
Esempio n. 4
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     while True:
         try:
             OldPdb.interaction(self, frame, traceback)
         except KeyboardInterrupt:
             self.shell.write("\nKeyboardInterrupt\n")
         else:
             break
Esempio n. 5
0
        def __init__(self,
                     color_scheme='NoColor',
                     completekey=None,
                     stdin=None,
                     stdout=None):

            # Parent constructor:
            if has_pydb and completekey is None:
                OldPdb.__init__(self, stdin=stdin, stdout=stdout)
            else:
                OldPdb.__init__(self, completekey, stdin, stdout)
                self.prompt = prompt  # The default prompt is '(Pdb)'

            # IPython changes...
            self.is_pydb = has_pydb

            if self.is_pydb:

                # iplib.py's ipalias seems to want pdb's checkline
                # which located in pydb.fn
                import pydb.fns
                self.checkline = lambda filename, lineno: \
                                 pydb.fns.checkline(self, filename, lineno)

                self.curframe = None
                self.do_restart = self.new_do_restart

                self.old_all_completions = __IPYTHON__.Completer.all_completions
                __IPYTHON__.Completer.all_completions = self.all_completions

                self.do_list = decorate_fn_with_doc(self.list_command_pydb,
                                                    OldPdb.do_list)
                self.do_l = self.do_list
                self.do_frame = decorate_fn_with_doc(self.new_do_frame,
                                                     OldPdb.do_frame)

            self.aliases = {}

            # Create color table: we copy the default one from the traceback
            # module and add a few attributes needed for debugging
            self.color_scheme_table = ExceptionColors.copy()

            # shorthands
            C = ColorANSI.TermColors
            cst = self.color_scheme_table

            cst['NoColor'].colors.breakpoint_enabled = C.NoColor
            cst['NoColor'].colors.breakpoint_disabled = C.NoColor

            cst['Linux'].colors.breakpoint_enabled = C.LightRed
            cst['Linux'].colors.breakpoint_disabled = C.Red

            cst['LightBG'].colors.breakpoint_enabled = C.LightRed
            cst['LightBG'].colors.breakpoint_disabled = C.Red

            self.set_colors(color_scheme)
Esempio n. 6
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     while True:
         try:
             OldPdb.interaction(self, frame, traceback)
         except KeyboardInterrupt:
             self.shell.write('\n' + self.shell.get_exception_only())
             break
         else:
             break
Esempio n. 7
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     while True:
         try:
             OldPdb.interaction(self, frame, traceback)
         except KeyboardInterrupt:
             self.shell.write('\n' + self.shell.get_exception_only())
             break
         else:
             break
Esempio n. 8
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     while True:
         try:
             OldPdb.interaction(self, frame, traceback)
             break
         except KeyboardInterrupt:
             self.shell.write('\n' + self.shell.get_exception_only())
             break
         finally:
             # Pdb sets readline delimiters, so set them back to our own
             self.shell.readline.set_completer_delims(self.shell.readline_delims)
Esempio n. 9
0
 def new_do_quit(self, arg):
     
     if hasattr(self, 'old_all_completions'):
         __IPYTHON__.Completer.all_completions=self.old_all_completions
     
     
     return OldPdb.do_quit(self, arg)
Esempio n. 10
0
    def new_do_quit(self, arg):

        if hasattr(self, 'old_all_completions'):
            self.shell.Completer.all_completions=self.old_all_completions


        return OldPdb.do_quit(self, arg)
Esempio n. 11
0
 def new_do_quit(self, arg):
     
     if hasattr(self, 'old_all_completions'):
         __IPYTHON__.Completer.all_completions=self.old_all_completions
     
     
     return OldPdb.do_quit(self, arg)
Esempio n. 12
0
    def new_do_quit(self, arg):

        if hasattr(self, 'old_all_completions'):
            self.shell.Completer.all_completions=self.old_all_completions


        return OldPdb.do_quit(self, arg)
Esempio n. 13
0
    def new_do_quit(self, arg):

        if hasattr(self, 'old_all_completions'):
            self.shell.Completer.all_completions = self.old_all_completions

        # Pdb sets readline delimiters, so set them back to our own
        self.shell.readline.set_completer_delims(self.shell.readline_delims)

        return OldPdb.do_quit(self, arg)
Esempio n. 14
0
    def new_do_quit(self, arg):

        if hasattr(self, "old_all_completions"):
            self.shell.Completer.all_completions = self.old_all_completions

        # Pdb sets readline delimiters, so set them back to our own
        self.shell.readline.set_completer_delims(self.shell.readline_delims)

        return OldPdb.do_quit(self, arg)
Esempio n. 15
0
 def list_command_pydb(self, arg):
     """List command to use if we have a newer pydb installed"""
     filename, first, last = OldPdb.parse_list_cmd(self, arg)
     if filename is not None:
         self.print_list_lines(filename, first, last)
Esempio n. 16
0
 def new_do_frame(self, arg):
     OldPdb.do_frame(self, arg)
     self.shell.set_completer_frame(self.curframe)
Esempio n. 17
0
    def __init__(self, color_scheme="NoColor", completekey=None, stdin=None, stdout=None):

        # Parent constructor:
        if has_pydb and completekey is None:
            OldPdb.__init__(self, stdin=stdin, stdout=io.stdout)
        else:
            OldPdb.__init__(self, completekey, stdin, stdout)

        # IPython changes...
        self.is_pydb = has_pydb

        self.shell = get_ipython()

        if self.shell is None:
            # No IPython instance running, we must create one
            from IPython.terminal.interactiveshell import TerminalInteractiveShell

            self.shell = TerminalInteractiveShell.instance()

        if self.is_pydb:

            # interactiveshell.py's ipalias seems to want pdb's checkline
            # which located in pydb.fn
            import pydb.fns

            self.checkline = lambda filename, lineno: pydb.fns.checkline(self, filename, lineno)

            self.curframe = None
            self.do_restart = self.new_do_restart

            self.old_all_completions = self.shell.Completer.all_completions
            self.shell.Completer.all_completions = self.all_completions

            self.do_list = decorate_fn_with_doc(self.list_command_pydb, OldPdb.do_list)
            self.do_l = self.do_list
            self.do_frame = decorate_fn_with_doc(self.new_do_frame, OldPdb.do_frame)

        self.aliases = {}

        # Create color table: we copy the default one from the traceback
        # module and add a few attributes needed for debugging
        self.color_scheme_table = exception_colors()

        # shorthands
        C = coloransi.TermColors
        cst = self.color_scheme_table

        cst["NoColor"].colors.prompt = C.NoColor
        cst["NoColor"].colors.breakpoint_enabled = C.NoColor
        cst["NoColor"].colors.breakpoint_disabled = C.NoColor

        cst["Linux"].colors.prompt = C.Green
        cst["Linux"].colors.breakpoint_enabled = C.LightRed
        cst["Linux"].colors.breakpoint_disabled = C.Red

        cst["LightBG"].colors.prompt = C.Blue
        cst["LightBG"].colors.breakpoint_enabled = C.LightRed
        cst["LightBG"].colors.breakpoint_disabled = C.Red

        self.set_colors(color_scheme)

        # Add a python parser so we can syntax highlight source while
        # debugging.
        self.parser = PyColorize.Parser()

        # Set the prompt
        Colors = cst.active_colors
        self.prompt = u"%s%s%s" % (Colors.prompt, prompt, Colors.Normal)  # The default prompt is '(Pdb)'
Esempio n. 18
0
 def list_command_pydb(self, arg):
     """List command to use if we have a newer pydb installed"""
     filename, first, last = OldPdb.parse_list_cmd(self, arg)
     if filename is not None:
         self.print_list_lines(filename, first, last)
Esempio n. 19
0
 def new_do_frame(self, arg):
     OldPdb.do_frame(self, arg)
     self.shell.set_completer_frame(self.curframe)
Esempio n. 20
0
    def __init__(self,color_scheme='NoColor',completekey=None,
                 stdin=None, stdout=None, context=5):

        # Parent constructor:
        try:
            self.context=int(context)
            if self.context <= 0:
                raise ValueError("Context must be a positive integer")
        except (TypeError, ValueError):
                raise ValueError("Context must be a positive integer")

        if has_pydb and completekey is None:
            OldPdb.__init__(self,stdin=stdin,stdout=io.stdout)
        else:
            OldPdb.__init__(self,completekey,stdin,stdout)

        # IPython changes...
        self.is_pydb = has_pydb

        self.shell = get_ipython()

        if self.shell is None:
            # No IPython instance running, we must create one
            from IPython.terminal.interactiveshell import \
                TerminalInteractiveShell
            self.shell = TerminalInteractiveShell.instance()

        if self.is_pydb:

            # interactiveshell.py's ipalias seems to want pdb's checkline
            # which located in pydb.fn
            import pydb.fns
            self.checkline = lambda filename, lineno: \
                             pydb.fns.checkline(self, filename, lineno)

            self.curframe = None
            self.do_restart = self.new_do_restart

            self.old_all_completions = self.shell.Completer.all_completions
            self.shell.Completer.all_completions=self.all_completions

            self.do_list = decorate_fn_with_doc(self.list_command_pydb,
                                                OldPdb.do_list)
            self.do_l     = self.do_list
            self.do_frame = decorate_fn_with_doc(self.new_do_frame,
                                                 OldPdb.do_frame)

        self.aliases = {}

        # Create color table: we copy the default one from the traceback
        # module and add a few attributes needed for debugging
        self.color_scheme_table = exception_colors()

        # shorthands
        C = coloransi.TermColors
        cst = self.color_scheme_table

        cst['NoColor'].colors.prompt = C.NoColor
        cst['NoColor'].colors.breakpoint_enabled = C.NoColor
        cst['NoColor'].colors.breakpoint_disabled = C.NoColor

        cst['Linux'].colors.prompt = C.Green
        cst['Linux'].colors.breakpoint_enabled = C.LightRed
        cst['Linux'].colors.breakpoint_disabled = C.Red

        cst['LightBG'].colors.prompt = C.Blue
        cst['LightBG'].colors.breakpoint_enabled = C.LightRed
        cst['LightBG'].colors.breakpoint_disabled = C.Red

        self.set_colors(color_scheme)

        # Add a python parser so we can syntax highlight source while
        # debugging.
        self.parser = PyColorize.Parser()

        # Set the prompt - the default prompt is '(Pdb)'
        Colors = cst.active_colors
        if color_scheme == 'NoColor':
            self.prompt = prompt
        else:
            # The colour markers are wrapped by bytes 01 and 02 so that readline
            # can calculate the width.
            self.prompt = u'\x01%s\x02%s\x01%s\x02' % (Colors.prompt, prompt, Colors.Normal)
Esempio n. 21
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     OldPdb.interaction(self, frame, traceback)
Esempio n. 22
0
 def interaction(self, frame, traceback):
     __IPYTHON__.set_completer_frame(frame)
     OldPdb.interaction(self, frame, traceback)
Esempio n. 23
0
 def interaction(self, frame, traceback):
     self.shell.set_completer_frame(frame)
     OldPdb.interaction(self, frame, traceback)
    def __init__(self,
                 color_scheme='NoColor',
                 completekey=None,
                 stdin=None,
                 stdout=None,
                 context=5):

        # Parent constructor:
        try:
            self.context = int(context)
            if self.context <= 0:
                raise ValueError("Context must be a positive integer")
        except (TypeError, ValueError):
            raise ValueError("Context must be a positive integer")

        if has_pydb and completekey is None:
            OldPdb.__init__(self, stdin=stdin, stdout=io.stdout)
        else:
            OldPdb.__init__(self, completekey, stdin, stdout)

        # IPython changes...
        self.is_pydb = has_pydb

        self.shell = get_ipython()

        if self.shell is None:
            # No IPython instance running, we must create one
            from IPython.terminal.interactiveshell import \
                TerminalInteractiveShell
            self.shell = TerminalInteractiveShell.instance()

        if self.is_pydb:

            # interactiveshell.py's ipalias seems to want pdb's checkline
            # which located in pydb.fn
            import pydb.fns
            self.checkline = lambda filename, lineno: \
                             pydb.fns.checkline(self, filename, lineno)

            self.curframe = None
            self.do_restart = self.new_do_restart

            self.old_all_completions = self.shell.Completer.all_completions
            self.shell.Completer.all_completions = self.all_completions

            self.do_list = decorate_fn_with_doc(self.list_command_pydb,
                                                OldPdb.do_list)
            self.do_l = self.do_list
            self.do_frame = decorate_fn_with_doc(self.new_do_frame,
                                                 OldPdb.do_frame)

        self.aliases = {}

        # Create color table: we copy the default one from the traceback
        # module and add a few attributes needed for debugging
        self.color_scheme_table = exception_colors()

        # shorthands
        C = coloransi.TermColors
        cst = self.color_scheme_table

        cst['NoColor'].colors.prompt = C.NoColor
        cst['NoColor'].colors.breakpoint_enabled = C.NoColor
        cst['NoColor'].colors.breakpoint_disabled = C.NoColor

        cst['Linux'].colors.prompt = C.Green
        cst['Linux'].colors.breakpoint_enabled = C.LightRed
        cst['Linux'].colors.breakpoint_disabled = C.Red

        cst['LightBG'].colors.prompt = C.Blue
        cst['LightBG'].colors.breakpoint_enabled = C.LightRed
        cst['LightBG'].colors.breakpoint_disabled = C.Red

        self.set_colors(color_scheme)

        # Add a python parser so we can syntax highlight source while
        # debugging.
        self.parser = PyColorize.Parser()

        # Set the prompt - the default prompt is '(Pdb)'
        Colors = cst.active_colors
        if color_scheme == 'NoColor':
            self.prompt = prompt
        else:
            # The colour markers are wrapped by bytes 01 and 02 so that readline
            # can calculate the width.
            self.prompt = u'\x01%s\x02%s\x01%s\x02' % (Colors.prompt, prompt,
                                                       Colors.Normal)
Esempio n. 25
0
 def new_do_frame(self, arg):
     OldPdb.do_frame(self, arg)
     __IPYTHON__.set_completer_frame(self.curframe)
Esempio n. 26
0
 def new_do_frame(self, arg):
     OldPdb.do_frame(self, arg)
     __IPYTHON__.set_completer_frame(self.curframe)
Esempio n. 27
0
 def interaction(self, frame, traceback):
     __IPYTHON__.set_completer_frame(frame)
     OldPdb.interaction(self, frame, traceback)