How to use the pudb.debugger.FileSourceCodeProvider function in pudb

To help you get started, we’ve selected a few pudb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inducer / pudb / test / test_source_code_providers.py View on Github external
def test_get_lines(self, mocker):
        provider = FileSourceCodeProvider(mocker.Mock(), 'test file name')
        result = provider.get_lines(mocker.MagicMock())
        assert len(result) == 1
        assert isinstance(result[0], SourceLine)
github inducer / pudb / test / test_source_code_providers.py View on Github external
def test_string_file_name(self, mocker):
        mock_debugger = mocker.Mock()
        mock_debugger.canonic = mocker.Mock(return_value='')
        provider = FileSourceCodeProvider(mock_debugger, 'test file name')
        result = provider.get_lines(mocker.MagicMock())
        assert len(result) == 1
        assert isinstance(result[0], SourceLine)
github inducer / pudb / pudb / debugger.py View on Github external
def show_mod(mod):
                filename = self.debugger.canonic(mod.__file__)

                base, ext = splitext(filename)
                if ext == ".pyc":
                    ext = ".py"
                    filename = base+".py"

                self.set_source_code_provider(
                        FileSourceCodeProvider(self.debugger, filename))
                self.source_list.set_focus(0)
github inducer / pudb / pudb / debugger.py View on Github external
filename = self.curframe.f_code.co_filename

        import linecache
        if not linecache.getlines(filename):
            code = self.curframe.f_globals.get("_MODULE_SOURCE_CODE")
            if code is not None:
                self.ui.set_current_line(lineno,
                        DirectSourceCodeProvider(
                            self.curframe.f_code.co_name, code))
            else:
                self.ui.set_current_line(lineno,
                        NullSourceCodeProvider())

        else:
            self.ui.set_current_line(lineno,
                FileSourceCodeProvider(self, filename))

        self.ui.update_var_view()
        self.ui.update_stack()

        self.ui.stack_list._w.set_focus(self.ui.translate_ui_stack_index(index))
github inducer / pudb / pudb / debugger.py View on Github external
def show_breakpoint(w, size, key):
            bp_entry, pos = self.bp_list._w.get_focus()

            if bp_entry is not None:
                bp = self._get_bp_list()[pos]
                self.show_line(bp.line,
                        FileSourceCodeProvider(self.debugger, bp.file))
github inducer / pudb / pudb / debugger.py View on Github external
None,
                ("Delete", "del"),
                ("Location", "loc"),
                ], title="Edit Breakpoint")

            if result is True:
                bp.enabled = enabled_checkbox.get_state()
                bp.ignore = int(ign_count_edit.value())
                cond = cond_edit.get_edit_text()
                if cond:
                    bp.cond = cond
                else:
                    bp.cond = None
            elif result == "loc":
                self.show_line(bp.line,
                        FileSourceCodeProvider(self.debugger, bp.file))
                self.columns.set_focus(0)
            elif result == "del":
                bp_source_identifier = \
                        self.source_code_provider.get_breakpoint_source_identifier()

                if bp_source_identifier is None:
                    self.message(
                        "Cannot currently delete a breakpoint here--"
                        "source code does not correspond to a file location. "
                        "(perhaps this is generated code)")

                if bp_source_identifier == bp.file:
                    self.source[bp.line-1].set_breakpoint(False)

                err = self.debugger.clear_break(bp.file, bp.line)
                if err: