gurudesh/pytracebugs huggingface dataset:
# Buggy code
def process_signature(self, response):
    params = None
    calls = response["calls"]
    if len(calls) > 0:
        call = calls[0]
        callee = call["callee"]
        documentation = callee["synopsis"]
        call_label = callee["repr"]
        signatures = call["signatures"]
        arg_idx = call["arg_index"]

        signature = signatures[0]
        parameters = []
        names = []
        logger.debug(signature)
        for arg in signature["args"]:
            parameters.append({"label": arg["name"], "documentation": ""})
            names.append(arg["name"])

        func_args = ", ".join(names)
        call_label = "{0}({1})".format(call_label, func_args)

        base_signature = {
            "label": call_label,
            "documentation": documentation,
            "parameters": parameters,
        }
        # doc_signatures.append(base_signature)
        params = {
            "signatures": base_signature,
            "activeSignature": 0,
            "activeParameter": arg_idx,
        }
    return {"params": params}


# Traceback (TypeError)
File "C:\Users\Amin\Anaconda3\envs\pmeal\lib\site-packages\spyder\plugins\completion\kite\client.py", line 135, in perform_request
TypeError: 'NoneType' object is not subscriptable

# Fixed code
def process_signature(self, response):
    params = None
    if response is not None:
        calls = response["calls"]
        if len(calls) > 0:
            call = calls[0]
            callee = call["callee"]
            documentation = callee["synopsis"]
            call_label = callee["repr"]
            signatures = call["signatures"]
            arg_idx = call["arg_index"]

            signature = signatures[0]
            parameters = []
            names = []
            logger.debug(signature)
            for arg in signature["args"]:
                parameters.append({"label": arg["name"], "documentation": ""})
                names.append(arg["name"])

            func_args = ", ".join(names)
            call_label = "{0}({1})".format(call_label, func_args)

            base_signature = {
                "label": call_label,
                "documentation": documentation,
                "parameters": parameters,
            }
            # doc_signatures.append(base_signature)
            params = {
                "signatures": base_signature,
                "activeSignature": 0,
                "activeParameter": arg_idx,
            }
    return {"params": params}
# Buggy code
def __exec_cell(self):
    ls = self.get_line_separator()
    init_cursor = QTextCursor(self.textCursor())
    start_pos, end_pos = self.__save_selection()
    cursor, whole_file_selected = self.select_current_cell()
    self.setTextCursor(cursor)
    line_from, line_to = self.get_selection_bounds()
    block = self.get_selection_first_block()
    text = self.get_selection_as_executable_code()
    self.last_cursor_cell = init_cursor
    self.__restore_selection(start_pos, end_pos)
    if text is not None:
        text = ls * line_from + text
    return text, block


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def __exec_cell(self, cursor=None):
    """Get text and line number from cursor or current position."""
    if cursor is None:
        cursor = self.textCursor()
    ls = self.get_line_separator()
    cursor, whole_file_selected = self.select_current_cell(cursor)
    line_from, line_to = self.get_selection_bounds(cursor)
    block = self.get_selection_first_block(cursor)
    text = self.get_selection_as_executable_code(cursor)

    if text is not None:
        text = ls * line_from + text
    return text, block
# Buggy code
def get_cell_as_executable_code(self):
    """Return cell contents as executable code"""
    return self.__exec_cell()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_cell_as_executable_code(self, cursor=None):
    """Return cell contents as executable code."""
    return self.__exec_cell(cursor)
# Buggy code
def run_cell(self):
    """Run current cell."""
    text, block = self.get_current_editor().get_cell_as_executable_code()
    self._run_cell_text(text, block)


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def run_cell(self, debug=False):
    """Run current cell."""
    text, block = self.get_current_editor().get_cell_as_executable_code()
    finfo = self.get_current_finfo()
    editor = self.get_current_editor()
    cell_name = self._get_cell_name(block)
    filename = finfo.filename

    self._run_cell_text(text, editor, (filename, cell_name), debug)
# Buggy code
def re_run_last_cell(self):
    """Run the previous cell again."""
    last_cell = self.get_current_editor().get_last_cell_as_executable_code()
    if not last_cell:
        return
    self._run_cell_text(*last_cell)


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def re_run_last_cell(self):
    """Run the previous cell again."""
    if self.last_cell_call is None:
        return
    filename, cell_name = self.last_cell_call
    index = self.has_filename(filename)
    if index is None:
        return
    editor = self.data[index].editor

    try:
        text = editor.get_cell_code(cell_name)
    except RuntimeError:
        return

    self._run_cell_text(text, editor, (filename, cell_name))
# Buggy code
def _get_cell_name(self, block):
    """Get the cell name from the block."""
    oe_data = block.userData()
    if oe_data and oe_data.oedata:
        cell_name = oe_data.oedata.def_name
    else:
        if block.firstLineNumber() == 0:
            cell_name = "Cell at line 0"
        else:
            raise RuntimeError("Not a cell?")
    return cell_name


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def _get_cell_name(self, block):
    """Get the cell name from the block."""
    oe_data = block.userData()
    if oe_data and oe_data.oedata:
        if oe_data.oedata.has_name():
            cell_name = oe_data.oedata.def_name
        else:
            cell_name = oe_data.oedata.cell_index()
    else:
        if block.firstLineNumber() == 0:
            # There is no name for the first cell, refer by cell number
            cell_name = 0
        else:
            raise RuntimeError("Not a cell?")
    return cell_name
# Buggy code
def _run_cell_text(self, text, block):
    """Run cell code in the console.

    Cell code is run in the console by copying it to the console if
    `self.run_cell_copy` is ``True`` otherwise by using the `run_cell`
    function.

    Parameters
    ----------
    text : str
        The code in the cell as a string.
    line : int
        The starting line number of the cell in the file.
    """
    finfo = self.get_current_finfo()
    editor = self.get_current_editor()
    cell_name = self._get_cell_name(block)
    if finfo.editor.is_python() and text:
        self.run_cell_in_ipyclient.emit(
            text, cell_name, finfo.filename, self.run_cell_copy
        )
    editor.setFocus()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def _run_cell_text(self, text, editor, cell_id, debug=False):
    """Run cell code in the console.

    Cell code is run in the console by copying it to the console if
    `self.run_cell_copy` is ``True`` otherwise by using the `run_cell`
    function.

    Parameters
    ----------
    text : str
        The code in the cell as a string.
    line : int
        The starting line number of the cell in the file.
    """
    (filename, cell_name) = cell_id
    if editor.is_python() and text:
        args = (text, cell_name, filename, self.run_cell_copy)
        if debug:
            self.debug_cell_in_ipyclient.emit(*args)
        else:
            self.run_cell_in_ipyclient.emit(*args)
    editor.setFocus()
# Buggy code
def register_plugin(self):
    """Register plugin in Spyder's main window"""
    self.add_dockwidget()

    self.focus_changed.connect(self.main.plugin_focus_changed)
    self.edit_goto.connect(self.main.editor.load)
    self.edit_goto[str, int, str, bool].connect(
        lambda fname, lineno, word, processevents: self.main.editor.load(
            fname, lineno, word, processevents=processevents
        )
    )
    self.main.editor.breakpoints_saved.connect(self.set_spyder_breakpoints)
    self.main.editor.run_in_current_ipyclient.connect(self.run_script)
    self.main.editor.run_cell_in_ipyclient.connect(self.run_cell)
    self.main.workingdirectory.set_current_console_wd.connect(
        self.set_current_client_working_directory
    )
    self.tabwidget.currentChanged.connect(self.update_working_directory)
    self._remove_old_stderr_files()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def register_plugin(self):
    """Register plugin in Spyder's main window"""
    self.add_dockwidget()

    self.focus_changed.connect(self.main.plugin_focus_changed)
    self.edit_goto.connect(self.main.editor.load)
    self.edit_goto[str, int, str, bool].connect(
        lambda fname, lineno, word, processevents: self.main.editor.load(
            fname, lineno, word, processevents=processevents
        )
    )
    self.main.editor.breakpoints_saved.connect(self.set_spyder_breakpoints)
    self.main.editor.run_in_current_ipyclient.connect(self.run_script)
    self.main.editor.run_cell_in_ipyclient.connect(self.run_cell)
    self.main.editor.debug_cell_in_ipyclient.connect(self.debug_cell)
    self.main.workingdirectory.set_current_console_wd.connect(
        self.set_current_client_working_directory
    )
    self.tabwidget.currentChanged.connect(self.update_working_directory)
    self._remove_old_stderr_files()
# Buggy code
def write_to_stdin(self, line):
    """Send raw characters to the IPython kernel through stdin"""
    self.kernel_client.input(line)


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def write_to_stdin(self, line):
    """Send raw characters to the IPython kernel through stdin"""
    self._control.insert_text(line + "\n")
    self._reading = False
    self.kernel_client.input(line)
# Buggy code
def get_editorstack(self):
    """Get the current editorstack."""
    plugin = self.ipyclient.plugin
    if plugin.main.editor is not None:
        editor = plugin.main.editor
        return editor.get_current_editorstack()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_editorstack(self):
    """Get the current editorstack."""
    plugin = self.ipyclient.plugin
    if plugin.main.editor is not None:
        editor = plugin.main.editor
        return editor.get_current_editorstack()
    raise RuntimeError("No editorstack found.")
# Buggy code
def handle_save_files(self):
    """Save the open files."""
    editorstack = self.get_editorstack()
    if editorstack is not None:
        editorstack.save()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def handle_save_files(self):
    """Save the open files."""
    self.get_editorstack().save()
# Buggy code
def get_current_word(self, completion=False):
    """Return current word, i.e. word at cursor position"""
    ret = self.get_current_word_and_position(completion)
    if ret is not None:
        return ret[0]


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_current_word(self, completion=False):
    """Return current word, i.e. word at cursor position."""
    ret = self.get_current_word_and_position(completion)
    if ret is not None:
        return ret[0]
# Buggy code
def get_current_line(self):
    """Return current line's text"""
    cursor = self.textCursor()
    cursor.select(QTextCursor.BlockUnderCursor)
    return to_text_string(cursor.selectedText())


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_current_line(self):
    """Return current line's text."""
    cursor = self.textCursor()
    cursor.select(QTextCursor.BlockUnderCursor)
    return to_text_string(cursor.selectedText())
# Buggy code
def get_current_line_to_cursor(self):
    """Return text from prompt to cursor"""
    return self.get_text(self.current_prompt_pos, "cursor")


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_current_line_to_cursor(self):
    """Return text from prompt to cursor."""
    return self.get_text(self.current_prompt_pos, "cursor")
# Buggy code
def get_line_number_at(self, coordinates):
    """Return line number at *coordinates* (QPoint)"""
    cursor = self.cursorForPosition(coordinates)
    return cursor.blockNumber() + 1


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_line_number_at(self, coordinates):
    """Return line number at *coordinates* (QPoint)."""
    cursor = self.cursorForPosition(coordinates)
    return cursor.blockNumber() + 1
# Buggy code
def get_line_at(self, coordinates):
    """Return line at *coordinates* (QPoint)"""
    cursor = self.cursorForPosition(coordinates)
    cursor.select(QTextCursor.BlockUnderCursor)
    return to_text_string(cursor.selectedText()).replace("\u2029", "")


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_line_at(self, coordinates):
    """Return line at *coordinates* (QPoint)."""
    cursor = self.cursorForPosition(coordinates)
    cursor.select(QTextCursor.BlockUnderCursor)
    return to_text_string(cursor.selectedText()).replace("\u2029", "")
# Buggy code
def get_word_at(self, coordinates):
    """Return word at *coordinates* (QPoint)"""
    cursor = self.cursorForPosition(coordinates)
    cursor.select(QTextCursor.WordUnderCursor)
    if self._is_point_inside_word_rect(coordinates):
        word = to_text_string(cursor.selectedText())
    else:
        word = ""

    return word


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_word_at(self, coordinates):
    """Return word at *coordinates* (QPoint)."""
    cursor = self.cursorForPosition(coordinates)
    cursor.select(QTextCursor.WordUnderCursor)
    if self._is_point_inside_word_rect(coordinates):
        word = to_text_string(cursor.selectedText())
    else:
        word = ""

    return word
# Buggy code
def get_block_indentation(self, block_nb):
    """Return line indentation (character number)"""
    text = to_text_string(self.document().findBlockByNumber(block_nb).text())
    text = text.replace("\t", " " * self.tab_stop_width_spaces)
    return len(text) - len(text.lstrip())


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_block_indentation(self, block_nb):
    """Return line indentation (character number)."""
    text = to_text_string(self.document().findBlockByNumber(block_nb).text())
    text = text.replace("\t", " " * self.tab_stop_width_spaces)
    return len(text) - len(text.lstrip())
# Buggy code
def get_selection_bounds(self):
    """Return selection bounds (block numbers)"""
    cursor = self.textCursor()
    start, end = cursor.selectionStart(), cursor.selectionEnd()
    block_start = self.document().findBlock(start)
    block_end = self.document().findBlock(end)
    return sorted([block_start.blockNumber(), block_end.blockNumber()])


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_selection_bounds(self, cursor=None):
    """Return selection bounds (block numbers)."""
    if cursor is None:
        cursor = self.textCursor()
    start, end = cursor.selectionStart(), cursor.selectionEnd()
    block_start = self.document().findBlock(start)
    block_end = self.document().findBlock(end)
    return sorted([block_start.blockNumber(), block_end.blockNumber()])
# Buggy code
def get_selection_first_block(self):
    """Return the first block of the selection."""
    cursor = self.textCursor()
    start, end = cursor.selectionStart(), cursor.selectionEnd()
    if start > 0:
        start = start - 1
    return self.document().findBlock(start)


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_selection_first_block(self, cursor=None):
    """Return the first block of the selection."""
    if cursor is None:
        cursor = self.textCursor()
    start = cursor.selectionStart()
    if start > 0:
        start = start - 1
    return self.document().findBlock(start)
# Buggy code
def has_selected_text(self):
    """Returns True if some text is selected"""
    return bool(to_text_string(self.textCursor().selectedText()))


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def has_selected_text(self):
    """Returns True if some text is selected."""
    return bool(to_text_string(self.textCursor().selectedText()))
# Buggy code
def get_selected_text(self):
    """
    Return text selected by current text cursor, converted in unicode

    Replace the unicode line separator character \u2029 by
    the line separator characters returned by get_line_separator
    """
    return to_text_string(self.textCursor().selectedText()).replace(
        "\u2029", self.get_line_separator()
    )


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def get_selected_text(self, cursor=None):
    """
    Return text selected by current text cursor, converted in unicode.

    Replace the unicode line separator character \u2029 by
    the line separator characters returned by get_line_separator
    """
    if cursor is None:
        cursor = self.textCursor()
    return to_text_string(cursor.selectedText()).replace(
        "\u2029", self.get_line_separator()
    )
# Buggy code
def remove_selected_text(self):
    """Delete selected text"""
    self.textCursor().removeSelectedText()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def remove_selected_text(self):
    """Delete selected text."""
    self.textCursor().removeSelectedText()
# Buggy code
def replace(self, text, pattern=None):
    """Replace selected text by *text*
    If *pattern* is not None, replacing selected text using regular
    expression text substitution"""
    cursor = self.textCursor()
    cursor.beginEditBlock()
    if pattern is not None:
        seltxt = to_text_string(cursor.selectedText())
    cursor.removeSelectedText()
    if pattern is not None:
        text = re.sub(
            to_text_string(pattern), to_text_string(text), to_text_string(seltxt)
        )
    cursor.insertText(text)
    cursor.endEditBlock()


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def replace(self, text, pattern=None):
    """Replace selected text by *text*.

    If *pattern* is not None, replacing selected text using regular
    expression text substitution."""
    cursor = self.textCursor()
    cursor.beginEditBlock()
    if pattern is not None:
        seltxt = to_text_string(cursor.selectedText())
    cursor.removeSelectedText()
    if pattern is not None:
        text = re.sub(
            to_text_string(pattern), to_text_string(text), to_text_string(seltxt)
        )
    cursor.insertText(text)
    cursor.endEditBlock()
# Buggy code
def find_multiline_pattern(self, regexp, cursor, findflag):
    """Reimplement QTextDocument's find method

    Add support for *multiline* regular expressions"""
    pattern = to_text_string(regexp.pattern())
    text = to_text_string(self.toPlainText())
    try:
        regobj = re.compile(pattern)
    except sre_constants.error:
        return
    if findflag & QTextDocument.FindBackward:
        # Find backward
        offset = min([cursor.selectionEnd(), cursor.selectionStart()])
        text = text[:offset]
        matches = [_m for _m in regobj.finditer(text, 0, offset)]
        if matches:
            match = matches[-1]
        else:
            return
    else:
        # Find forward
        offset = max([cursor.selectionEnd(), cursor.selectionStart()])
        match = regobj.search(text, offset)
    if match:
        pos1, pos2 = sh.get_span(match)
        fcursor = self.textCursor()
        fcursor.setPosition(pos1)
        fcursor.setPosition(pos2, QTextCursor.KeepAnchor)
        return fcursor


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def find_multiline_pattern(self, regexp, cursor, findflag):
    """Reimplement QTextDocument's find method.

    Add support for *multiline* regular expressions."""
    pattern = to_text_string(regexp.pattern())
    text = to_text_string(self.toPlainText())
    try:
        regobj = re.compile(pattern)
    except sre_constants.error:
        return
    if findflag & QTextDocument.FindBackward:
        # Find backward
        offset = min([cursor.selectionEnd(), cursor.selectionStart()])
        text = text[:offset]
        matches = [_m for _m in regobj.finditer(text, 0, offset)]
        if matches:
            match = matches[-1]
        else:
            return
    else:
        # Find forward
        offset = max([cursor.selectionEnd(), cursor.selectionStart()])
        match = regobj.search(text, offset)
    if match:
        pos1, pos2 = sh.get_span(match)
        fcursor = self.textCursor()
        fcursor.setPosition(pos1)
        fcursor.setPosition(pos2, QTextCursor.KeepAnchor)
        return fcursor
# Buggy code
def get_value(self):
    """Return modified array -- this is *not* a copy"""
    # It is import to avoid accessing Qt C++ object as it has probably
    # already been destroyed, due to the Qt.WA_DeleteOnClose attribute
    return self.data


# Traceback (ValueError)
File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\variableexplorer\widgets\arrayeditor.py", line 279, in data
/ (float(self.vmax) - self.vmin))
ValueError: could not convert string to float: 'fsd'

# Fixed code
def get_value(self):
    """Return modified array -- this is *not* a copy"""
    # It is important to avoid accessing Qt C++ object as it has probably
    # already been destroyed, due to the Qt.WA_DeleteOnClose attribute
    return self.data
# Buggy code
def createWindow(self, webwindowtype):
    import webbrowser

    webbrowser.open(to_text_string(self.url().toString()))


# Traceback (ValueError)
File "C:\Users\mckay\Anaconda3\lib\site-packages\spyder\widgets\browser.py", line 168, in createWindow
webbrowser.open(to_text_string(self.url().toString()))
File "C:\Users\mckay\Anaconda3\lib\webbrowser.py", line 78, in open
if browser.open(url, new, autoraise):
File "C:\Users\mckay\Anaconda3\lib\webbrowser.py", line 582, in open
os.startfile(url)
ValueError: startfile: filepath too long for Windows

# Fixed code
def createWindow(self, webwindowtype):
    import webbrowser

    # See: spyder-ide/spyder#9849
    try:
        webbrowser.open(to_text_string(self.url().toString()))
    except ValueError:
        pass
# Buggy code
def load_data(self, profdatafile):
    """Load profiler data saved by profile/cProfile module"""
    import pstats

    try:
        stats_indi = [
            pstats.Stats(profdatafile),
        ]
    except (OSError, IOError):
        return
    self.profdata = stats_indi[0]

    if self.compare_file is not None:
        try:
            stats_indi.append(pstats.Stats(self.compare_file))
        except (OSError, IOError) as e:
            QMessageBox.critical(
                self, _("Error"), _("Error when trying to load profiler results")
            )
            debug_print("Error when calling pstats, {}".format(e))
            self.compare_file = None
    map(lambda x: x.calc_callees(), stats_indi)
    self.profdata.calc_callees()
    self.stats1 = stats_indi
    self.stats = stats_indi[0].stats


# Traceback (AttributeError)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 264, in <lambda>
self.finished(ec, es))
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 335, in finished
self.show_data(justanalyzed=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 362, in show_data
self.datatree.show_tree()
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 526, in show_tree
rootkey = self.find_root()  # This root contains profiler overhead
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 507, in find_root
self.profdata.sort_stats("cumulative")
AttributeError: 'NoneType' object has no attribute 'sort_stats'

# Fixed code
def load_data(self, profdatafile):
    """Load profiler data saved by profile/cProfile module"""
    import pstats

    # Fixes spyder-ide/spyder#6220
    try:
        stats_indi = [
            pstats.Stats(profdatafile),
        ]
    except (OSError, IOError):
        self.profdata = None
        return
    self.profdata = stats_indi[0]

    if self.compare_file is not None:
        # Fixes spyder-ide/spyder#5587
        try:
            stats_indi.append(pstats.Stats(self.compare_file))
        except (OSError, IOError) as e:
            QMessageBox.critical(
                self,
                _("Error"),
                _(
                    "Error when trying to load profiler results. "
                    "The error was<br><br>"
                    "<tt>{0}</tt>"
                ).format(e),
            )
            self.compare_file = None
    map(lambda x: x.calc_callees(), stats_indi)
    self.profdata.calc_callees()
    self.stats1 = stats_indi
    self.stats = stats_indi[0].stats
# Buggy code
def save_data(self, filename):
    """"""
    self.stats1[0].dump_stats(filename)


# Traceback (AttributeError)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 264, in <lambda>
self.finished(ec, es))
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 335, in finished
self.show_data(justanalyzed=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 362, in show_data
self.datatree.show_tree()
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 526, in show_tree
rootkey = self.find_root()  # This root contains profiler overhead
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 507, in find_root
self.profdata.sort_stats("cumulative")
AttributeError: 'NoneType' object has no attribute 'sort_stats'

# Fixed code
def save_data(self, filename):
    """Save profiler data."""
    self.stats1[0].dump_stats(filename)
# Buggy code
def find_root(self):
    """Find a function without a caller"""
    self.profdata.sort_stats("cumulative")
    for func in self.profdata.fcn_list:
        if ("~", 0) != func[0:2] and not func[2].startswith("<built-in method exec>"):
            # This skips the profiler function at the top of the list
            # it does only occur in Python 3
            return func


# Traceback (AttributeError)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 264, in <lambda>
self.finished(ec, es))
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 335, in finished
self.show_data(justanalyzed=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 362, in show_data
self.datatree.show_tree()
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 526, in show_tree
rootkey = self.find_root()  # This root contains profiler overhead
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 507, in find_root
self.profdata.sort_stats("cumulative")
AttributeError: 'NoneType' object has no attribute 'sort_stats'

# Fixed code
def find_root(self):
    """Find a function without a caller"""
    # Fixes spyder-ide/spyder#8336
    if self.profdata is not None:
        self.profdata.sort_stats("cumulative")
    else:
        return
    for func in self.profdata.fcn_list:
        if ("~", 0) != func[0:2] and not func[2].startswith("<built-in method exec>"):
            # This skips the profiler function at the top of the list
            # it does only occur in Python 3
            return func
# Buggy code
def load_data(self, profdatafile):
    """Load profiler data saved by profile/cProfile module"""
    import pstats

    try:
        stats_indi = [
            pstats.Stats(profdatafile),
        ]
    except (OSError, IOError):
        return
    self.profdata = stats_indi[0]

    if self.compare_file is not None:
        try:
            stats_indi.append(pstats.Stats(self.compare_file))
        except (OSError, IOError) as e:
            QMessageBox.critical(
                self, _("Error"), _("Error when trying to load profiler results")
            )
            logger.debug("Error when calling pstats, {}".format(e))
            self.compare_file = None
    map(lambda x: x.calc_callees(), stats_indi)
    self.profdata.calc_callees()
    self.stats1 = stats_indi
    self.stats = stats_indi[0].stats


# Traceback (AttributeError)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 264, in <lambda>
self.finished(ec, es))
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 335, in finished
self.show_data(justanalyzed=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 362, in show_data
self.datatree.show_tree()
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 526, in show_tree
rootkey = self.find_root()  # This root contains profiler overhead
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 507, in find_root
self.profdata.sort_stats("cumulative")
AttributeError: 'NoneType' object has no attribute 'sort_stats'

# Fixed code
def load_data(self, profdatafile):
    """Load profiler data saved by profile/cProfile module"""
    import pstats

    # Fixes spyder-ide/spyder#6220
    try:
        stats_indi = [
            pstats.Stats(profdatafile),
        ]
    except (OSError, IOError):
        self.profdata = None
        return
    self.profdata = stats_indi[0]

    if self.compare_file is not None:
        # Fixes spyder-ide/spyder#5587
        try:
            stats_indi.append(pstats.Stats(self.compare_file))
        except (OSError, IOError) as e:
            QMessageBox.critical(
                self,
                _("Error"),
                _(
                    "Error when trying to load profiler results. "
                    "The error was<br><br>"
                    "<tt>{0}</tt>"
                ).format(e),
            )
            self.compare_file = None
    map(lambda x: x.calc_callees(), stats_indi)
    self.profdata.calc_callees()
    self.stats1 = stats_indi
    self.stats = stats_indi[0].stats
# Buggy code
def read_output(self, error=False):
    if error:
        self.process.setReadChannel(QProcess.StandardError)
    else:
        self.process.setReadChannel(QProcess.StandardOutput)
    qba = QByteArray()
    while self.process.bytesAvailable():
        if error:
            qba += self.process.readAllStandardError()
        else:
            qba += self.process.readAllStandardOutput()
    text = to_text_string(locale_codec.toUnicode(qba.data()))
    if error:
        self.error_output += text
    else:
        self.output += text


# Traceback (AttributeError)
File "c:\program files\enthought\canopy\edm\envs\py36\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 262, in <lambda>
lambda: self.read_output(error=True))
File "c:\program files\enthought\canopy\edm\envs\py36\lib\site-packages\spyder_profiler\widgets\profilergui.py", line 323, in read_output
text = to_text_string( locale_codec.toUnicode(qba.data()) )
AttributeError: 'NoneType' object has no attribute 'toUnicode'
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 404, 'json': {'message': 'Not Found', 'documentation_url': 'https://developer.github.com/v3/issues/#create-an-issue'}}

# Fixed code
def read_output(self, error=False):
    if error:
        self.process.setReadChannel(QProcess.StandardError)
    else:
        self.process.setReadChannel(QProcess.StandardOutput)
    qba = QByteArray()
    while self.process.bytesAvailable():
        if error:
            qba += self.process.readAllStandardError()
        else:
            qba += self.process.readAllStandardOutput()
    text = to_text_string(qba.data(), encoding="utf-8")
    if error:
        self.error_output += text
    else:
        self.output += text