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

Issue:
Align plugin tabs to the left and center dockwidget tabs for all OSes
<!--- **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
Plugin tabs are not aligned to the left in Mac OS

![Screen Shot 2019-07-05 at 7 27 06 PM](https://user-images.githubusercontent.com/18587879/60749132-3a45bd00-9f5b-11e9-936f-6d720a8b448a.png)


Discussion:

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -2937,6 +2937,8 @@ def _dialog_finished(result_code):
 
         if self.prefs_dialog_instance is None:
             dlg = ConfigDialog(self)
+            dlg.setStyleSheet("QTabWidget::tab-bar {"
+                              "alignment: left;}")
             self.prefs_dialog_instance = dlg
 
             # Signals
diff --git a/spyder/widgets/dock.py b/spyder/widgets/dock.py
--- a/spyder/widgets/dock.py
+++ b/spyder/widgets/dock.py
@@ -29,6 +29,10 @@ def __init__(self, dock_tabbar, main):
         self.main = main
         self.from_index = None
 
+        # Center dockwidget tabs to differentiate them from plugin tabs.
+        # See spyder-ide/spyder#9763
+        self.dock_tabbar.setStyleSheet("QTabBar {alignment: center;}")
+
     def eventFilter(self, obj, event):
         """Filter mouse press events.
 
@@ -218,6 +222,7 @@ def install_tab_event_filter(self, value):
                 if title == self.title:
                     dock_tabbar = tabbar
                     break
+
         if dock_tabbar is not None:
             self.dock_tabbar = dock_tabbar
             # Install filter only once per QTabBar
diff --git a/spyder/widgets/tabs.py b/spyder/widgets/tabs.py
--- a/spyder/widgets/tabs.py
+++ b/spyder/widgets/tabs.py
@@ -257,6 +257,9 @@ def __init__(self, parent, actions=None, menu=None,
         self.corner_widgets = {}
         self.menu_use_tooltips = menu_use_tooltips
 
+        self.setStyleSheet("QTabWidget::tab-bar {"
+                           "alignment: left;}")
+
         if menu is None:
             self.menu = QMenu(self)
             if actions:


Test patch:
Repository: spyder-ide/spyder

Issue:
Fail to Launch Spyder Tutorial
## Description

### What steps will reproduce the problem?

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

After updating to spyder 4, when I click Help and than click to start spyder tutorial, it does not start the tutorial and will lead me to issue reporter.

### Traceback
```python-traceback
  File "C:\Users\fengyy\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\plugins\help\plugin.py", line 453, in show_tutorial
    text = open(tutorial).read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\fengyy\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\spyder\\plugins\\help\\utils\\tutorial.rst'
```

## Versions

* Spyder version: 4.0.0b3 
* Python version: 3.6.8
* Qt version: 5.9.6
* PyQt5 version: 5.9.2
* Operating System: Windows 7

### Dependencies

```
pygments >=2.0    :  2.4.2 (OK)
qdarkstyle >=2.6.4:  2.7 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
pyls >=0.27.0     :  0.27.0 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.23.4 (OK)
numpy >=1.7       :  1.16.4 (OK)
sympy >=0.7.3     :  1.4 (OK)
cython >=0.21     :  0.29.11 (OK)
qtconsole >=4.5.0 :  4.5.1 (OK)
IPython >=4.0     :  7.6.0 (OK)
matplotlib >=2.0.0:  3.1.0 (OK)
pylint >=0.25     :  2.3.1 (OK)
```



Discussion:
Thanks for noticing it. We'll fix this in our next beta.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -140,7 +140,7 @@ def run(self):
 # Files added to the package
 #==============================================================================
 EXTLIST = ['.pot', '.po', '.mo', '.svg', '.png', '.css', '.html', '.js',
-           '.ini', '.txt', '.qss', '.ttf', '.json']
+           '.ini', '.txt', '.qss', '.ttf', '.json', '.rst']
 if os.name == 'nt':
     SCRIPTS += ['spyder.bat']
     EXTLIST += ['.ico']


Test patch:
Repository: spyder-ide/spyder

Issue:
Control-click URL in tutorial causes ValueError
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

In the Spyder tutorial, the 'Recommended first steps for Python beginners' section, control-left click on the 'IPython interpreter' link.

I did this because I thought it might open the URL in a new window.  It opens the URL successfully (in my web browser, same as a normal left-click), but it issues the "Spyder has encountered an internal problem!" bug report page.

I'm using windows 10, 64-bit.  Default browser is Firefox.

### Traceback
```python-traceback
  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
```

## Versions

* Spyder version: 3.3.1 
* Python version: 3.7.0
* Qt version: 5.8.0
* PyQt5 version: 5.8.2
* Operating System: Windows 10

### Dependencies

```
pyflakes >=0.6.0  :  2.0.0 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
sphinx >=0.6.6    :  1.7.9 (OK)
rope >=0.9.4      :  0.11.0 (OK)
jedi >=0.9.0      :  0.12.1 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
numpy >=1.7       :  1.15.1 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.28.5 (OK)
qtconsole >=4.2.0 :  4.4.1 (OK)
IPython >=4.0     :  6.5.0 (OK)
matplotlib >=2.0.0:  3.0.3 (OK)
pylint >=0.25     :  2.1.1 (OK)
```



Discussion:
Thanks for reporting. We'll fix this in Spyder 4.

@steff456, simply catch this error in a try/except and `pass` if it appears.

Resolving patch:
diff --git a/spyder/widgets/browser.py b/spyder/widgets/browser.py
--- a/spyder/widgets/browser.py
+++ b/spyder/widgets/browser.py
@@ -168,7 +168,11 @@ def zoom_in(self):
     #------ QWebEngineView API -------------------------------------------------------
     def createWindow(self, webwindowtype):
         import webbrowser
-        webbrowser.open(to_text_string(self.url().toString()))
+        # See: spyder-ide/spyder#9849
+        try:
+            webbrowser.open(to_text_string(self.url().toString()))
+        except ValueError:
+            pass
 
     def contextMenuEvent(self, event):
         menu = QMenu(self)


Test patch:
Repository: spyder-ide/spyder

Issue:
Improve shortcuts table UI
Right now there's very hard for people to know that they can customize our keyboard shortcuts in our Preferences. That's because there's no message mentioning that and no UI element signaling the possibility.

To fix this I think that we could do the following:

1. Add this message on top of the shortcuts table:
    > Here you can browse the list of all available shortcuts in Spyder. You can also customize them by clicking on any entry in this table.

2. Change the cursor to be a hand when hovering the shortcuts table and make a single click open the dialog to change shortcuts.

@goanpeca, @jnsebgosselin, what do you think about my suggestions?


Discussion:
Hi @ccordoba12. I think the message should suffice :-), but i see no harm in adding the hand as well
Great! @steff456, please work on implementing my suggestions then.

Resolving patch:
diff --git a/spyder/preferences/shortcuts.py b/spyder/preferences/shortcuts.py
--- a/spyder/preferences/shortcuts.py
+++ b/spyder/preferences/shortcuts.py
@@ -796,6 +796,7 @@ def keyPressEvent(self, event):
     def mouseDoubleClickEvent(self, event):
         """Qt Override."""
         self.show_editor()
+        self.update()
 
 
 class ShortcutsConfigPage(GeneralConfigPage):
@@ -808,12 +809,20 @@ def setup_page(self):
         self.table = ShortcutsTable(self, text_color=ima.MAIN_FG_COLOR)
         self.finder = ShortcutFinder(self.table, self.table.set_regex)
         self.table.finder = self.finder
+        self.table.finder.setPlaceholderText(
+            _("Search for a shortcut in the table above"))
         self.label_finder = QLabel(_('Search: '))
         self.reset_btn = QPushButton(_("Reset to default values"))
+        self.top_label = QLabel(
+            _("Here you can browse the list of all available shortcuts in "
+              "Spyder. You can also customize them by double-clicking on any "
+              "entry in this table."))
+        self.top_label.setWordWrap(True)
 
         # Layout
         hlayout = QHBoxLayout()
         vlayout = QVBoxLayout()
+        vlayout.addWidget(self.top_label)
         hlayout.addWidget(self.label_finder)
         hlayout.addWidget(self.finder)
         vlayout.addWidget(self.table)


Test patch:
Repository: spyder-ide/spyder

Issue:
Make changing the working directory via the toolbar work with local external Spyder kernels
<!--- **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

Opened by the request of @ccordoba12 

It would be very nice to make changing the working directory in the Spyder toolbar work with external local consoles. Currently, the UX is rather confusing since the toolbar updates with the actual working directory when it is changed in the console, and it allows me to appear to "change" this directory via typing  it in or the file browser, but it doesn't change the the console's actual working directory and goes back to showing the actual working dir when running a file, changing tabs. 


### What steps reproduce the problem?

1. Open an external kernel with ``spyder-kernels`` and connect to it with Spyder
2. Change the working directory via the file browser or direct entry on the toolbar
3. Check the actual working directory in the console

### What is the expected output? What do you see instead?

Ideally, it would be nice for changing it via the GUI to work (I'm not sure why it couldn't), but if not then we should disable changing it there so as to not confuse/frustrate the user.

Considering I can simply type ``%cd path/to/dir`` into the console in Spyder and it works, and Spyder can successfully read it from the console, I would think there should be some straightforward way to set it from the Spyder GUI, even just sending silent %cd commands to the console at worst.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/plugin.py b/spyder/plugins/ipythonconsole/plugin.py
--- a/spyder/plugins/ipythonconsole/plugin.py
+++ b/spyder/plugins/ipythonconsole/plugin.py
@@ -404,7 +404,7 @@ def register_plugin(self):
         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.set_current_client_working_directory)
         self.tabwidget.currentChanged.connect(self.update_working_directory)
         self._remove_old_stderr_files()
 
diff --git a/spyder/plugins/ipythonconsole/widgets/shell.py b/spyder/plugins/ipythonconsole/widgets/shell.py
--- a/spyder/plugins/ipythonconsole/widgets/shell.py
+++ b/spyder/plugins/ipythonconsole/widgets/shell.py
@@ -145,7 +145,7 @@ def set_cwd(self, dirname):
         if os.name == 'nt':
             dirname = dirname.replace(u"\\", u"\\\\")
 
-        if not self.external_kernel:
+        if self.ipyclient.hostname is None:
             self.call_kernel(interrupt=True).set_cwd(dirname)
             self._cwd = dirname
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Plots plugin doesn't show plots generated in local, external Spyder kernels
<!--- **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

Across multiple Spyder/Spyder-Kernels versions, the Plots plugin appears to be unable to show plots generated by a local, externally-started ``spyder-kernels`` console (it just remains blank); while both inline and interactive plots work fine once the console backend is manually set to them. 

Other than this, all Spyder's main features work in externally-started consoles started with ``spyder-kernels`` just the same as Snyder-started ones, so it would be really nice to get this to work as well.

@jnsebgosselin @ccordoba12 


Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/plugin.py b/spyder/plugins/ipythonconsole/plugin.py
--- a/spyder/plugins/ipythonconsole/plugin.py
+++ b/spyder/plugins/ipythonconsole/plugin.py
@@ -1231,8 +1231,8 @@ def update_execution_state_kernel(self):
 
     def connect_external_kernel(self, shellwidget):
         """
-        Connect an external kernel to the Variable Explorer and Help, if
-        it is a Spyder kernel.
+        Connect an external kernel to the Variable Explorer, Help and
+        Plots, but only if it is a Spyder kernel.
         """
         sw = shellwidget
         kc = shellwidget.kernel_client
@@ -1244,6 +1244,10 @@ def connect_external_kernel(self, shellwidget):
             sw.refresh_namespacebrowser()
             kc.stopped_channels.connect(lambda :
                 self.main.variableexplorer.remove_shellwidget(id(sw)))
+        if self.main.plots is not None:
+            self.main.plots.add_shellwidget(sw)
+            kc.stopped_channels.connect(lambda :
+                self.main.plots.remove_shellwidget(id(sw)))
 
     #------ Public API (for tabs) ---------------------------------------------
     def add_tab(self, widget, name, filename=''):
diff --git a/spyder/plugins/ipythonconsole/widgets/kernelconnect.py b/spyder/plugins/ipythonconsole/widgets/kernelconnect.py
--- a/spyder/plugins/ipythonconsole/widgets/kernelconnect.py
+++ b/spyder/plugins/ipythonconsole/widgets/kernelconnect.py
@@ -159,6 +159,7 @@ def __init__(self, parent=None):
         layout.addWidget(self.rm_group)
         layout.addLayout(btns_layout)
 
+        self.cf.setFocus()
         self.load_connection_settings()
 
     def load_connection_settings(self):


Test patch:
Repository: spyder-ide/spyder

Issue:
Remove "No match" entry in editor's code completion widget
When there's no match in the code completion widget we're showing a "No match" entry that makes no sense to me:

![Selección_018](https://user-images.githubusercontent.com/365293/62838973-92bb5900-bc83-11e9-9814-48bae0bdd3a2.png)

@steff456, please take care of removing it.


Discussion:
@ccordoba12, @andfoy already made this fix in the code snippets PR #9850
Yeah, I noticed it, but I don't know when that PR is going to be merged. Could you take that fix and create a new PR with it? Thanks!

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/base.py b/spyder/plugins/editor/widgets/base.py
--- a/spyder/plugins/editor/widgets/base.py
+++ b/spyder/plugins/editor/widgets/base.py
@@ -52,8 +52,6 @@ def __init__(self, parent, ancestor):
         self.completion_list = None
         self.completion_position = None
         self.automatic = False
-        # Text to be displayed if no match is found.
-        self.empty_text = 'No match'
 
     def setup_appearance(self, size, font):
         self.resize(*size)
@@ -63,8 +61,6 @@ def is_empty(self):
         """Check if widget is empty."""
         if self.count() == 0:
             return True
-        if self.count() == 1 and self.item(0).text() == self.empty_text:
-            return True
         return False
 
     def show_list(self, completion_list, position, automatic):
@@ -102,8 +98,7 @@ def show_list(self, completion_list, position, automatic):
             return
 
         # If only one, must be chosen if not automatic
-        single_match = (self.count() == 1 and
-                        self.item(0).text() != self.empty_text)
+        single_match = self.count() == 1
         if single_match and not self.automatic:
             self.item_selected()
             self.hide()
@@ -206,7 +201,7 @@ def update_list(self, filter_text):
             self.scrollTo(self.currentIndex(),
                           QAbstractItemView.PositionAtTop)
         else:
-            self.addItem(QListWidgetItem(self.empty_text))
+            self.hide()
 
     def hide(self):
         """Hide the widget."""


Test patch:
diff --git a/spyder/plugins/editor/widgets/tests/test_introspection.py b/spyder/plugins/editor/widgets/tests/test_introspection.py
--- a/spyder/plugins/editor/widgets/tests/test_introspection.py
+++ b/spyder/plugins/editor/widgets/tests/test_introspection.py
@@ -117,9 +117,7 @@ def test_automatic_completions(lsp_codeeditor, qtbot):
     assert "from" in [x['label'] for x in sig.args[0]]
     # qtbot.keyPress(code_editor, Qt.Key_Tab)
 
-    with qtbot.waitSignal(completion.sig_show_completions,
-                          timeout=10000) as sig:
-        qtbot.keyClicks(code_editor, 'rom')
+    qtbot.keyClicks(code_editor, 'rom')
 
     # Due to automatic completion, the completion widget may appear before
     stop = False
Repository: spyder-ide/spyder

Issue:
Syntax Highlighter is supressing outlined QTextCharFormat style
## Problem Description
Outlined text is not displayed correctly when the syntax highlighter is active for a file, this prevents the correct visualization of the upcoming code snippets editor extension (#9568).


### What is the expected output? What do you see instead?
![ezgif com-video-to-gif(8)](https://user-images.githubusercontent.com/1878982/62345551-6d2a9480-b4b8-11e9-9e3d-809c428d72e9.gif)



Discussion:

Resolving patch:
diff --git a/spyder/utils/syntaxhighlighters.py b/spyder/utils/syntaxhighlighters.py
--- a/spyder/utils/syntaxhighlighters.py
+++ b/spyder/utils/syntaxhighlighters.py
@@ -250,7 +250,6 @@ def setup_formats(self, font=None):
         for name, (color, bold, italic) in list(colors.items()):
             format = QTextCharFormat(base_format)
             format.setForeground(QColor(color))
-            format.setBackground(QColor(self.background_color))
             if bold:
                 format.setFontWeight(QFont.Bold)
             format.setFontItalic(italic)


Test patch:
Repository: spyder-ide/spyder

Issue:
Spyder hangs if you open the Issue reporter while Preferences is open
## Description

### What steps will reproduce the problem?

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

1. Open Spyder
2. Open the Preferences dialog
3. Open the Issue reporter via the help menu

At this point Spyder hangs. The Issue reporter dialog doesn't appear, you can't close preferences or Spyder, or otherwise interact with Spyder in any way.

If I perform only steps 1 and 3 then the Issue reporter dialog appears and Spyder is responsive. 



## Versions

* Spyder version: 4.0.0b4 
* Python version: 3.7.3
* Qt version: 5.9.6
* PyQt5 version: 5.9.2
* Operating System: Windows 7

### Dependencies

```
pygments >=2.0    :  2.4.2 (OK)
qdarkstyle >=2.6.4:  2.7 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
pyls >=0.27.0     :  0.28.2 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.25.1 (OK)
numpy >=1.7       :  1.16.4 (OK)
sympy >=0.7.3     :  1.4 (OK)
cython >=0.21     :  0.29.13 (OK)
qtconsole >=4.5.2 :  4.5.4 (OK)
IPython >=4.0     :  7.8.0 (OK)
matplotlib >=2.0.0:  3.1.1 (OK)
pylint >=0.25     :  2.3.1 (OK)
```



Discussion:
@goanpeca, this is caused by Preferences appearing on top of everything else and our error report dialog being modal.

I think the problem with our Preferences was introduced here:

https://github.com/spyder-ide/spyder/pull/9740/files#diff-0218c339b4429cfe6796ab926aacb433R151

(which was made in one of your PRs), so I think perhaps we should revert it?
By the way, that change also makes that our Preferences stay on top of any other window on Linux even if Spyder's main window loses focus (which I find very annoying).

Resolving patch:
diff --git a/spyder/preferences/configdialog.py b/spyder/preferences/configdialog.py
--- a/spyder/preferences/configdialog.py
+++ b/spyder/preferences/configdialog.py
@@ -147,7 +147,6 @@ def __init__(self, parent=None):
         # (e.g. the editor's analysis thread in Spyder), thus leading to
         # a segmentation fault on UNIX or an application crash on Windows
         self.setAttribute(Qt.WA_DeleteOnClose)
-        self.setWindowFlags(Qt.Dialog | Qt.WindowStaysOnTopHint)
         self.setWindowTitle(_('Preferences'))
         self.setWindowIcon(ima.icon('configure'))
         self.contents_widget.setMovement(QListView.Static)


Test patch:
Repository: spyder-ide/spyder

Issue:
Issue reporter dialog should not be modal
## Description

### What steps will reproduce the problem?

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

This may be intentional, but the Issue reporter window is modal. I've wanted to cut/paste code from my editor to this Window, and or test aspects of what I'm reporting, but I cannot do that since this window is modal. I suggest making the window non-modal, as with the Preferences window.



## Versions

* Spyder version: 4.0.0b4 
* Python version: 3.7.3
* Qt version: 5.9.6
* PyQt5 version: 5.9.2
* Operating System: Windows 7

### Dependencies

```
pygments >=2.0    :  2.4.2 (OK)
qdarkstyle >=2.6.4:  2.7 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
pyls >=0.27.0     :  0.28.2 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.25.1 (OK)
numpy >=1.7       :  1.16.4 (OK)
sympy >=0.7.3     :  1.4 (OK)
cython >=0.21     :  0.29.13 (OK)
qtconsole >=4.5.2 :  4.5.4 (OK)
IPython >=4.0     :  7.8.0 (OK)
matplotlib >=2.0.0:  3.1.1 (OK)
pylint >=0.25     :  2.3.1 (OK)
```



Discussion:
This is a good point and something that was mentioned before. @dalthviz, please work on it.

Resolving patch:
diff --git a/spyder/widgets/reporterror.py b/spyder/widgets/reporterror.py
--- a/spyder/widgets/reporterror.py
+++ b/spyder/widgets/reporterror.py
@@ -129,7 +129,6 @@ def __init__(self, parent=None, is_report=False):
         QDialog.__init__(self, parent)
         self.is_report = is_report
         self.setWindowTitle(_("Issue reporter"))
-        self.setModal(True)
 
         # To save the traceback sent to the internal console
         self.error_traceback = ""


Test patch: