internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: spyder-ide/spyder

Issue:
Add icons for Latex file type
The icons are located here:

https://github.com/vscode-icons/vscode-icons/blob/master/icons/file_type_light_tex.svg
https://github.com/vscode-icons/vscode-icons/blob/master/icons/file_type_tex.svg

@juanis2112, the idea is to move both the black and white versions to our repo, make the corresponding entry in NOTICE.txt and add them to the icons dictionary you and Daniel created before.


Discussion:

Resolving patch:
diff --git a/spyder/utils/icon_manager.py b/spyder/utils/icon_manager.py
--- a/spyder/utils/icon_manager.py
+++ b/spyder/utils/icon_manager.py
@@ -432,6 +432,13 @@ def get_icon_by_extension(fname, scale_factor):
                 else:
                     icon_by_extension = QIcon(
                         get_image_path('notebook_light.svg'))
+            elif extension == '.tex':
+                if is_dark_interface():
+                    icon_by_extension = QIcon(
+                        get_image_path('file_type_tex.svg'))
+                else:
+                    icon_by_extension = QIcon(
+                        get_image_path('file_type_light_tex.svg'))
             elif mime_type is not None:
                 try:
                     # Fix for issue 5080. Even though


Test patch:
Repository: spyder-ide/spyder

Issue:
Improve the "Open recent" menu
@juanis2112, I refer to this menu:

![Selección_024](https://user-images.githubusercontent.com/365293/56051450-ee65ec00-5d4e-11e9-80b3-90ed4218a6e1.png)

I would like to see the following improvements:

- [x] Create entries on it after a file is opened in the Editor. Right now, we only create an entry after the file is closed, which is odd and counter-intuitive.
- [x] Display the icon type corresponding to the file on its left. Right now we are displaying the same icon for all files, which is not so good. If a file doesn't have an icon, then we should show the same generic icon that we're displaying now.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor/plugin.py b/spyder/plugins/editor/plugin.py
--- a/spyder/plugins/editor/plugin.py
+++ b/spyder/plugins/editor/plugin.py
@@ -1653,14 +1653,15 @@ def update_recent_file_menu(self):
         """Update recent file menu"""
         recent_files = []
         for fname in self.recent_files:
-            if self.is_file_opened(fname) is None and osp.isfile(fname):
+            if osp.isfile(fname):
                 recent_files.append(fname)
         self.recent_file_menu.clear()
         if recent_files:
             for fname in recent_files:
-                action = create_action(self, fname,
-                                       icon=ima.icon('FileIcon'),
-                                       triggered=self.load)
+                action = create_action(
+                    self, fname,
+                    icon=ima.get_icon_by_extension(fname, scale_factor=1.0),
+                    triggered=self.load)
                 action.setData(to_qvariant(fname))
                 self.recent_file_menu.addAction(action)
         self.clear_recent_action.setEnabled(len(recent_files) > 0)


Test patch:
Repository: spyder-ide/spyder

Issue:
Hide debugger panel for files that are not Python ones
This is how things look for Markdown files (for example):

![Selección_002](https://user-images.githubusercontent.com/365293/56750869-0133e400-6785-11e9-8a89-0fc09b92a0eb.png)

which is really odd. Besides, our debugger only works for Python files (and that will probably stay the same in the future).

@juanis2112, the idea is to make this change in the `setup_editor` method of `CodeEditor`, using the `language` parameter passed to it.


Discussion:
I think the most useful approach is to add a new parameter to `setup_editor` called `debug_panel=False`, and then create a new method called `set_debug_panel(self, debug_panel, language)` that takes care of removing or showing that panel.
And please also use a similar approach to show/hide the Folding panel, with a new parameter to `setup_editor` called `folding=True` and a new method called `set_folding(self, folding)`.

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -630,7 +630,9 @@ def setup_editor(self,
                      occurrence_timeout=1500,
                      show_class_func_dropdown=False,
                      indent_guides=False,
-                     scroll_past_end=False):
+                     scroll_past_end=False,
+                     debug_panel=True,
+                     folding=True):
 
         self.set_close_parentheses_enabled(close_parentheses)
         self.set_close_quotes_enabled(close_quotes)
@@ -638,6 +640,12 @@ def setup_editor(self,
         self.set_auto_unindent_enabled(auto_unindent)
         self.set_indent_chars(indent_chars)
 
+        # Show/hide the debug panel depending on the language and parameter
+        self.set_debug_panel(debug_panel, language)
+
+        # Show/hide folding panel depending on parameter
+        self.set_folding_panel(folding)
+
         # Scrollbar flag area
         self.scrollflagarea.set_enabled(scrollflagarea)
 
@@ -981,6 +989,19 @@ def notify_close(self):
             return params
 
     # -------------------------------------------------------------------------
+    def set_debug_panel(self, debug_panel, language):
+        """Enable/disable debug panel."""
+        debugger_panel = self.panels.get(DebuggerPanel)
+        if language == 'py' and debug_panel:
+            debugger_panel.setVisible(True)
+        else:
+            debugger_panel.setVisible(False)
+
+    def set_folding_panel(self, folding):
+        """Enable/disable folding panel."""
+        folding_panel = self.panels.get(FoldingPanel)
+        folding_panel.setVisible(folding)
+
     def set_tab_mode(self, enable):
         """
         enabled = tab always indent


Test patch:
Repository: spyder-ide/spyder

Issue:
Hovers, tooltips and calltips are shown at the wrong position on Linux
I just tested PR #9191 and I'm seeing all those widgets placed incorrectly. Here are a couple of examples:

![Selección_001](https://user-images.githubusercontent.com/365293/57333332-dcdced80-711c-11e9-8150-dead1ee49307.png)

![Selección_002](https://user-images.githubusercontent.com/365293/57333383-f67e3500-711c-11e9-8640-2ef27584ce6f.png)

@goanpeca, please take a look at this one. Thanks!



Discussion:
Is this Linux?
Yep, Kubuntu 18.10

Resolving patch:
diff --git a/spyder/widgets/calltip.py b/spyder/widgets/calltip.py
--- a/spyder/widgets/calltip.py
+++ b/spyder/widgets/calltip.py
@@ -19,6 +19,7 @@
 # Standard library imports
 from unicodedata import category
 import os
+import sys
 
 # Third party imports
 from qtpy.QtCore import (QBasicTimer, QCoreApplication, QEvent, Qt, QTimer,
@@ -53,13 +54,14 @@ def __init__(self, parent=None, as_tooltip=False):
         self._timer_hide = QTimer()
 
         # Setup
-        self._timer_hide.setInterval(500)
-        self.setTextInteractionFlags(Qt.TextSelectableByMouse)
-        if os.name == 'nt':
-            self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
-        else:
+        if sys.platform == 'darwin':
+            # This keeps the hints below other applications
             self.setWindowFlags(Qt.SplashScreen)
+        else:
+            self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
 
+        self._timer_hide.setInterval(500)
+        self.setTextInteractionFlags(Qt.TextSelectableByMouse)
         self.setTextInteractionFlags(Qt.TextBrowserInteraction)
         self.setOpenExternalLinks(False)
         self.setForegroundRole(QPalette.ToolTipText)
@@ -183,11 +185,13 @@ def __init__(self, text_edit, hide_timer_on=False, as_tooltip=False):
         self._text_edit = text_edit
 
         # Setup
-        self.setTextInteractionFlags(Qt.TextSelectableByMouse)
-        if os.name != 'nt':
-            self.setWindowFlags(Qt.SplashScreen)  # This is needed on OSX
+        if sys.platform == 'darwin':
+            # This keeps the hints below other applications
+            self.setWindowFlags(Qt.SplashScreen)
         else:
-            pass
+            self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
+
+        self.setTextInteractionFlags(Qt.TextSelectableByMouse)
         self.setFont(text_edit.document().defaultFont())
         self.setForegroundRole(QPalette.ToolTipText)
         self.setBackgroundRole(QPalette.ToolTipBase)


Test patch:
Repository: spyder-ide/spyder

Issue:
using BeautifulSoup4 to webscrape wikipedia
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

import urlopen and BeautifulSoup, parse the wiki url for Belarus, findAll tables


### Traceback
```python-traceback
    documentation=documentation,
    res = self._check_signature_and_format(signature, parameter)
    parameter=parameter,
    parameter=parameter,
IndexError: tuple index out of range

Traceback (most recent call last):
    msg = self.format(record)
    return fmt.format(record)
    record.message = record.getMessage()
    msg = msg % self.args
ValueError: incomplete format
Call stack:
    sys.exit(main())
    mainwindow.main()
    mainwindow = run_spyder(app, options, args)
    app.exec_()
    handler(resp['result'], req_id)
    {'params': response})
    handler(params)
    self.log_lsp_handle_errors("Error when processing signature")
    logger.error('%', 1, stack_info=True)
Arguments: (1,)
```

## Versions

* Spyder version: 4.0.0b2 
* Python version: 3.7.0
* Qt version: 5.9.6
* PyQt5 version: 5.9.2
* Operating System: Darwin 18.6.0

### Dependencies

```
pygments >=2.0     :  2.3.1 (OK)
qdarkstyle >=2.6.4 :  2.6.8 (OK)
sphinx >=0.6.6     :  1.8.5 (OK)
psutil >=0.3       :  5.6.1 (OK)
pyls >=0.19.0;<0.25:  0.24.0 (OK)
nbconvert >=4.0    :  5.4.1 (OK)
pandas >=0.13.1    :  0.24.2 (OK)
numpy >=1.7        :  1.16.2 (OK)
sympy >=0.7.3      :  1.3 (OK)
cython >=0.21      :  0.29.6 (OK)
qtconsole >=4.2.0  :  4.4.3 (OK)
IPython >=4.0      :  7.4.0 (OK)
matplotlib >=2.0.0 :  3.0.3 (OK)
pylint >=0.25      :  2.3.1 (OK)
```



Discussion:
@Tique19 it seems to be a problem with the `CalltipWidget` what method where you calling?
findAll in the BeautifulSoup Library


Resolving patch:
diff --git a/spyder/widgets/mixins.py b/spyder/widgets/mixins.py
--- a/spyder/widgets/mixins.py
+++ b/spyder/widgets/mixins.py
@@ -359,6 +359,11 @@ def _check_signature_and_format(self, signature_or_text, parameter=None):
         has_multisignature = False
         language = getattr(self, 'language', '').lower()
         signature_or_text = signature_or_text.replace('\\*', '*')
+
+        # Remove special symbols that could itefere with ''.format
+        signature_or_text = signature_or_text.replace('{', '&#123;')
+        signature_or_text = signature_or_text.replace('}', '&#125;')
+
         lines = signature_or_text.split('\n')
         inspect_word = None
 


Test patch:
diff --git a/spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py b/spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py
--- a/spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py
+++ b/spyder/plugins/editor/widgets/tests/test_hints_and_calltips.py
@@ -15,7 +15,7 @@
 
 # Constants
 PY2 = sys.version[0] == '2'
-TEST_SIG = 'some_function(hello=None)'
+TEST_SIG = 'some_function(foo={}, hello=None)'
 TEST_DOCSTRING = "This is the test docstring."
 TEST_TEXT = """'''Testing something'''
 def {SIG}:
Repository: spyder-ide/spyder

Issue:
Only require PyWebEngine on Python 3+ to avoid blocking py2 compat in pip wheels
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

## Problem Description

Currently, Spyder 3.3.4 cannot be installed on Python 2.7.x via ``pip``, because it requires ``PyQtWebEngine`` which is not available for Python 2. However, this is not required, because PyQt 5.12 (which requires it) isn't compatible with Python 2 anyway, so this blocks Python 2 compat unnecessarily. Therefore, per @ccordoba12 's , we should not require ``PyQtWebEngine`` on Python 2.


## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 3.3.4
* Python version: 2.7.x
* Qt version: <5.12 
* PyQt version: <5.12
* Operating System name/version: Any, but mostly Linux



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -241,7 +241,7 @@ def run(self):
     'pyqt5<5.13;python_version>="3"',
     # pyqt5 5.12 split WebEngine into the
     # pyqtwebengine module
-    'pyqtwebengine<5.13'
+    'pyqtwebengine<5.13;python_version>="3"'
 ]
 
 extras_require = {
@@ -250,7 +250,7 @@ def run(self):
              'pytest-qt',
              'pytest-mock',
              'pytest-cov',
-             'pytest-xvfb',
+             'pytest-xvfb;platform_system=="Linux"',
              'mock',
              'flaky',
              'pandas',


Test patch:
Repository: spyder-ide/spyder

Issue:
Code cells that fill the whole screen lose their background highlight
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [ ] Tried basic troubleshooting (if a bug/error)
    * [ ] Restarted Spyder
    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [ ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

If a code cell fills the whole screen it loses the code cell highlighting.

![Code cell unhighlight](https://user-images.githubusercontent.com/10513354/58441311-473ed900-809e-11e9-8944-c47d12c04e28.gif)

### What steps reproduce the problem?

1. Make a code cell bigger than the screen space of the editor
2. Scroll until the top of the cell is out of the screen

### What is the expected output? What do you see instead?

It should stay highlighted so the user knows that they are still in a cell.

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: master
 


Discussion:

Resolving patch:
diff --git a/spyder/plugins/outlineexplorer/editor.py b/spyder/plugins/outlineexplorer/editor.py
--- a/spyder/plugins/outlineexplorer/editor.py
+++ b/spyder/plugins/outlineexplorer/editor.py
@@ -36,7 +36,7 @@ def get_cursor_line_number(self):
 
     def get_outlineexplorer_data(self):
         oe_data = self._editor.get_outlineexplorer_data()
-        self._editor.has_cell_separators = oe_data.pop(
+        self._editor.has_cell_separators = oe_data.get(
             'found_cell_separators', False)
         return oe_data
 
diff --git a/spyder/utils/syntaxhighlighters.py b/spyder/utils/syntaxhighlighters.py
--- a/spyder/utils/syntaxhighlighters.py
+++ b/spyder/utils/syntaxhighlighters.py
@@ -470,6 +470,7 @@ def __init__(self, parent, font=None, color_scheme='Spyder'):
     def highlight_block(self, text):
         """Implement specific highlight for Python."""
         text = to_text_string(text)
+        self.found_cell_separators = False
         prev_state = tbh.get_state(self.currentBlock().previous())
         if prev_state == self.INSIDE_DQ3STRING:
             offset = -4


Test patch:
Repository: spyder-ide/spyder

Issue:
Under the dark theme, the right warning display sidebar is not offset to match the scroll bar position
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

First discussed on #8068 , but issue opened on request of @ccordoba12 .

When using the dark theme, the right sidebar that shows error/warning/etc. markers throughout the document is not offset to match the scrollbar like with the light theme, so the latter is not usable as an indicator of which should be visible. Compare the light theme:

![image](https://user-images.githubusercontent.com/17051931/58411225-6eaf8a80-8039-11e9-8593-3d401c3c7f68.png)

With the dark theme:

![image](https://user-images.githubusercontent.com/17051931/58411047-08c30300-8039-11e9-96a4-d9005a94ec59.png)

Presumably, the warning bar needs to be offset by a distance equal to the scroll arrow widget on the top and bottom on the dark theme to avoid this problem.


## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.0 ``master``, since dark theme implementation
* Python version: 3.6-3.7
* Qt version: 5.9.7
* PyQt version: 5.9.2
* Operating System name/version: Windows 8.1 Pro x64

### Dependencies

``qdarkstyle 2.6.8``


Discussion:
@jnsebgosselin, do you have any ideas about how we could solve this?
> 
> 
> @jnsebgosselin, do you have any ideas about how we could solve this?

Yes I know why. I will fix it.
Thanks @jnsebgosselin and @ccordoba12 !
Thanks a lot @jnsebgosselin!

Resolving patch:
diff --git a/spyder/plugins/editor/panels/scrollflag.py b/spyder/plugins/editor/panels/scrollflag.py
--- a/spyder/plugins/editor/panels/scrollflag.py
+++ b/spyder/plugins/editor/panels/scrollflag.py
@@ -50,7 +50,7 @@ def offset(self):
         """This property holds the vertical offset of the scroll flag area
         relative to the top of the text editor."""
         vsb = self.editor.verticalScrollBar()
-        style = vsb.style()
+        style = QApplication.instance().style()
         opt = QStyleOptionSlider()
         vsb.initStyleOption(opt)
 
@@ -172,7 +172,7 @@ def get_scrollbar_position_height(self):
         """Return the pixel span height of the scrollbar area in which
         the slider handle may move"""
         vsb = self.editor.verticalScrollBar()
-        style = vsb.style()
+        style = QApplication.instance().style()
         opt = QStyleOptionSlider()
         vsb.initStyleOption(opt)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
The vertical position of the tab switcher dialog window is wrong in Spyder 4
## Problem Description

The position of the tab switcher dialog window is wrong in Spyder 4 because we need to take into account the height of the filename `QLablel` that was added at the top of the editor in a previous PR.

![image](https://user-images.githubusercontent.com/10170372/58906735-90181280-86da-11e9-9cb6-25991da3da29.png)

I was about to fix this as part of PR #9452 but then I decided it would be better to do this in another PR, so that the issue and fix does not go unnoticed for the sake of properly documenting things.

## Versions

* Spyder version: Spyder 4.0.0.dev0 (Commit: 64a9d6ad9) 
* Python version: Python 3.7.1 64-bit
* Qt version: Qt 5.9.6
* PyQt version: PyQt5 5.9.2
* Operating System name/version: Windows 10 



Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/editor.py b/spyder/plugins/editor/widgets/editor.py
--- a/spyder/plugins/editor/widgets/editor.py
+++ b/spyder/plugins/editor/widgets/editor.py
@@ -363,7 +363,8 @@ def select_row(self, steps):
     def set_dialog_position(self):
         """Positions the tab switcher in the top-center of the editor."""
         left = self.editor.geometry().width()/2 - self.width()/2
-        top = self.editor.tabs.tabBar().geometry().height()
+        top = (self.editor.tabs.tabBar().geometry().height() +
+               self.editor.fname_label.geometry().height())
 
         self.move(self.editor.mapToGlobal(QPoint(left, top)))
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Bug with default actions for Ctrl+Tab and Ctrl+Backtab in the Editor
## Problem Description

1. When the `Ctrl + Tab` key sequence is not assigned to any shortcut, pressing this key sequence in the Editor results in two actions: (1) indentation of the current line + (2) the tabs of the Editor get cycle forward .<br><br>I think that pressing `Ctrl + Tab`  should only cycle forward through the files and not cause any indentation.

2. When `Ctrl + Shift + Tab` key sequence is not assigned to any shortcut and this key sequence is pressed in the Editor, it only causes the current line to unindent.<br><br>I think that pressing `Ctrl + Shift + Tab` should cycle backward through the files and not cause any unindentation.

## Versions
* Spyder version: Spyder 4.0.0.dev0 (Commit: 64a9d6ad9) 
* Python version: Python 3.7.1 64-bit
* Qt version: Qt 5.9.6
* PyQt version: PyQt5 5.9.2
* Operating System name/version: Windows 10 


Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -3272,7 +3272,7 @@ def keyPressEvent(self, event):
                 if ind(leading_text) == ind(prevtxt):
                     self.unindent(force=True)
             TextEditBaseWidget.keyPressEvent(self, event)
-        elif key == Qt.Key_Tab:
+        elif key == Qt.Key_Tab and not ctrl:
             # Important note: <TAB> can't be called with a QShortcut because
             # of its singular role with respect to widget focus management
             if not has_selection and not self.tab_mode:
@@ -3280,7 +3280,7 @@ def keyPressEvent(self, event):
             else:
                 # indent the selected text
                 self.indent_or_replace()
-        elif key == Qt.Key_Backtab:
+        elif key == Qt.Key_Backtab and not ctrl:
             # Backtab, i.e. Shift+<TAB>, could be treated as a QShortcut but
             # there is no point since <TAB> can't (see above)
             if not has_selection and not self.tab_mode:


Test patch: