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

Issue:
Error when copying data from a dataframe
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

  File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 1103, in copy
    obj.to_csv(output, sep='\t', index=True, header=True)
  File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\frame.py", line 1403, in to_csv
    formatter.save()
  File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\io\formats\format.py", line 1592, in save
    self._save()
  File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\io\formats\format.py", line 1693, in _save
    self._save_chunk(start_i, end_i)
  File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\io\formats\format.py", line 1719, in _save_chunk
    lib.write_csv_rows(self.data, ix, self.nlevels, self.cols, self.writer)
  File "pandas\_libs\lib.pyx", line 1118, in pandas._libs.lib.write_csv_rows
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 78: ordinal not in range(128)


## Version and main components

* Spyder Version: 3.2.3 
* Python Version: 2.7.13
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.5.0  :  1.5.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  0.20.3 (OK)
numpy >=1.7       :  1.13.1 (OK)
sphinx >=0.6.6    :  1.6.3 (OK)
rope >=0.9.4      :  0.10.5 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.26.1 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.4.1 (OK)
pylint >=0.25     :  1.7.2 (OK)

```



Discussion:
Thanks for reporting. We'll fix this in our next version.

Resolving patch:
diff --git a/spyder/widgets/variableexplorer/collectionseditor.py b/spyder/widgets/variableexplorer/collectionseditor.py
--- a/spyder/widgets/variableexplorer/collectionseditor.py
+++ b/spyder/widgets/variableexplorer/collectionseditor.py
@@ -1128,7 +1128,13 @@ def copy(self):
             elif isinstance(obj, (DataFrame, Series)) \
               and DataFrame is not FakeObject:
                 output = io.StringIO()
-                obj.to_csv(output, sep='\t', index=True, header=True)
+                try:
+                    obj.to_csv(output, sep='\t', index=True, header=True)
+                except Exception:
+                    QMessageBox.warning(self, _("Warning"),
+                                        _("It was not possible to copy "
+                                          "this dataframe"))
+                    return
                 if PY3:
                     obj = output.getvalue()
                 else:


Test patch:
Repository: spyder-ide/spyder

Issue:
Error when dropping files in the Editor
## Description

### What steps will reproduce the problem?

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

I AM UNABLE TO PASTE THE CODE AND COPY THE FILE IN EDITOR

### Traceback
```python-traceback
  File "C:\Users\anant\Anaconda3\lib\site-packages\spyder\widgets\editor.py", line 2397, in dropEvent
    files = [f for f in files if encoding.is_text_file(f)]
TypeError: 'NoneType' object is not iterable
```

## Versions

* Spyder version: 3.3.1 
* Python version: 3.6.5
* Qt version: 5.9.4
* PyQt5 version: 5.9.2
* Operating System: Windows 10

### Dependencies

```
pyflakes >=0.6.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
sphinx >=0.6.6    :  1.7.4 (OK)
rope >=0.9.4      :  0.10.7 (OK)
jedi >=0.9.0      :  0.12.0 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  0.23.0 (OK)
numpy >=1.7       :  1.14.3 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.28.2 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0     :  6.4.0 (OK)
matplotlib >=2.0.0:  2.2.2 (OK)
pylint >=0.25     :  1.8.4 (OK)
```



Discussion:
I don't understand exactly what you're trying to do, so please try to describe it in detail.

If you're unable to do that, we simply catch this error and pass on it.

Resolving patch:
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -2392,7 +2392,10 @@ def dropEvent(self, event):
         """Reimplement Qt method
         Unpack dropped data and handle it"""
         source = event.mimeData()
-        if source.hasUrls():
+        # The second check is necessary when mimedata2url(source)
+        # returns None.
+        # Fixes issue 7742
+        if source.hasUrls() and mimedata2url(source):
             files = mimedata2url(source)
             files = [f for f in files if encoding.is_text_file(f)]
             files = set(files or [])
@@ -2401,7 +2404,9 @@ def dropEvent(self, event):
         elif source.hasText():
             editor = self.get_current_editor()
             if editor is not None:
-                editor.insert_text( source.text() )
+                editor.insert_text(source.text())
+        else:
+            event.ignore()
         event.acceptProposedAction()
 
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Error after upgrading to Python 3.7
## Description

### What steps will reproduce the problem?

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

1. Upgrade to python 3.7
2. Start spyder

Issue reporter appears immediately.
Internal console says:

>>> Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\spyder\widgets\pydocgui.py", line 39, in run
    self.callback(pydoc._start_server(pydoc._url_handler, self.port))
TypeError: _start_server() missing 1 required positional argument: 'port'


I'm using Anaconda3 on Windows 10 (64bit) with Python 3.7.0, IPython 6.5.0, Spyder 3.3.1

### Traceback
```python-traceback
TypeError: _start_server() missing 1 required positional argument: 'port'
```

## Versions

* Spyder version: 3.3.1 
* Python version: 3.7.0
* Qt version: 5.9.6
* PyQt5 version: 5.9.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.6 (OK)
rope >=0.9.4      :  0.11.0 (OK)
jedi >=0.9.0      :  0.12.1 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  None (NOK)
numpy >=1.7       :  1.15.0 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.28.5 (OK)
qtconsole >=4.2.0 :  4.4.0 (OK)
IPython >=4.0     :  6.5.0 (OK)
matplotlib >=2.0.0:  2.2.3 (OK)
pylint >=0.25     :  2.1.1 (OK)
```



Discussion:
Thanks for reporting. We'll fix this in our next release.

Resolving patch:
diff --git a/spyder/widgets/pydocgui.py b/spyder/widgets/pydocgui.py
--- a/spyder/widgets/pydocgui.py
+++ b/spyder/widgets/pydocgui.py
@@ -36,7 +36,14 @@ def run(self):
         import pydoc
         if PY3:
             # Python 3
-            self.callback(pydoc._start_server(pydoc._url_handler, self.port))
+            try:
+                self.callback(pydoc._start_server(pydoc._url_handler,
+                                                  port=self.port))
+            except TypeError:
+                # Python 3.7
+                self.callback(pydoc._start_server(pydoc._url_handler,
+                                                  hostname='localhost',
+                                                  port=self.port))
         else:
             # Python 2
             pydoc.serve(self.port, self.callback, self.completer)


Test patch:
Repository: spyder-ide/spyder

Issue:
Closing a Python file in Spyder cause a LSP error
## Problem Description

Closing any python file in Spyder causes the following error after PR #7994 :


### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback
 File "C:\Users\User\spyder\spyder\plugins\editor\plugin.py", line 652, in send_lsp_request
    self.main.lspmanager.send_request(language, request, params)
  File "C:\Users\User\spyder\spyder\plugins\lspmanager.py", line 775, in send_request
    client.perform_request(request, params)
  File "C:\Users\User\spyder\spyder\plugins\editor\lsp\client.py", line 228, in perform_request
    _id = handler(params)
  File "C:\Users\User\spyder\spyder\plugins\editor\lsp\decorators.py", line 20, in wrapper
    params = req(self, *args, **kwargs)
  File "C:\Users\User\spyder\spyder\plugins\editor\lsp\providers\document.py", line 210, in document_did_close
    file_signal = params['signal']
KeyError: 'signal'
```

## 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:  Spyder 4.0.0.dev0 
* Python version: Python 3.6.5 64-bit
* Qt version: Qt 5.9.3
* PyQt version: PyQt5 5.9.2
* Operating System name/version: Windows 10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
pygments >=2.0    :  2.2.0 (OK)
sphinx >=0.6.6    :  1.7.1 (OK)
pyls >=0.19.0     :  0.19.0 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  0.22.0 (OK)
numpy >=1.7       :  1.13.0 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.27.3 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0     :  6.2.1 (OK)
matplotlib >=2.0.0:  2.2.0 (OK)
pylint >=0.25     :  1.8.3 (OK)
```



Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor/lsp/providers/document.py b/spyder/plugins/editor/lsp/providers/document.py
--- a/spyder/plugins/editor/lsp/providers/document.py
+++ b/spyder/plugins/editor/lsp/providers/document.py
@@ -207,7 +207,7 @@ def document_will_save_notification(self, params):
     @send_request(method=LSPRequestTypes.DOCUMENT_DID_CLOSE,
                   requires_response=False)
     def document_did_close(self, params):
-        file_signal = params['signal']
+        codeeditor = params['codeeditor']
         debug_print('[{0}] File: {1}'.format(
             LSPRequestTypes.DOCUMENT_DID_CLOSE, params['file']))
         filename = path_as_uri(params['file'])
@@ -222,8 +222,8 @@ def document_did_close(self, params):
         else:
             editors = self.watched_files[filename]
             idx = -1
-            for i, signal in enumerate(editors):
-                if id(file_signal) == id(signal):
+            for i, editor in enumerate(editors):
+                if id(codeeditor) == id(editor):
                     idx = i
                     break
             if idx > 0:


Test patch:
Repository: spyder-ide/spyder

Issue:
'ClientWidget' object has no attribute 'show_time_action'
## Description

### What steps will reproduce the problem?

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

1. Open the preferences dialog > IPython console > Display
2. check "Show elapsed time"

### Traceback
```python-traceback
  File "C:\Users\raeckman\git\spyder\spyder\preferences\configdialog.py", line 224, in button_clicked
    configpage.apply_changes()
  File "C:\Users\raeckman\git\spyder\spyder\preferences\configdialog.py", line 105, in apply_changes
    self.apply_callback()
  File "C:\Users\raeckman\git\spyder\spyder\preferences\configdialog.py", line 270, in <lambda>
    self.apply_settings(self.changed_options))
  File "C:\Users\raeckman\git\spyder\spyder\plugins\ipythonconsole\plugin.py", line 760, in apply_plugin_settings
    client.show_time_action.setChecked(show_time_o)
AttributeError: 'ClientWidget' object has no attribute 'show_time_action'
```

## Versions

* Spyder version: 4.0.0.dev0 
* Python version: 3.6.6
* Qt version: 5.9.4
* PyQt5 version: 5.9.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    :  2.0.0 (OK)
rope >=0.9.4      :  0.11.0 (OK)
jedi >=0.11.0     :  0.12.1 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
pandas >=0.13.1   :  0.23.4 (OK)
numpy >=1.7       :  1.15.0 (OK)
sympy >=0.7.3     :  1.2 (OK)
cython >=0.21     :  0.28.5 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0     :  6.5.0 (OK)
matplotlib >=2.0.0:  2.2.3 (OK)
pylint >=0.25     :  2.1.1 (OK)
```



Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/widgets/client.py b/spyder/plugins/ipythonconsole/widgets/client.py
--- a/spyder/plugins/ipythonconsole/widgets/client.py
+++ b/spyder/plugins/ipythonconsole/widgets/client.py
@@ -152,6 +152,8 @@ def __init__(self, plugin, id_,
         self.time_label = None
         self.t0 = time.monotonic()
         self.timer = QTimer(self)
+        self.show_time_action = create_action(self, _("Show elapsed time"),
+                                         toggled=self.set_elapsed_time_visible)
 
         # --- Layout
         vlayout = QVBoxLayout()
@@ -363,9 +365,6 @@ def get_options_menu(self):
                                      icon=ima.icon('editdelete'),
                                      triggered=self.reset_namespace)
 
-        self.show_time_action = create_action(self, _("Show elapsed time"),
-                                         toggled=self.set_elapsed_time_visible)
-
         env_action = create_action(
                         self,
                         _("Show environment variables"),


Test patch:
Repository: spyder-ide/spyder

Issue:
Shift-Tab moves focus outside of current Editor pane in Spyder 4
<!--- **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

As discussed in #8015 , in Spyder 4 latest ``master`` (and ``master`` only), Shift-Tab in the Editor will not only reduce the indent level as it should, but also move the focus to the previous widget in the tab order, typically the tab bar; it doesn't seem to be properly trapped by the currently focused editor. It was confirmed to be present in Beta 1 as well, so it wasn't introduced by @jnsebgosselin 's recent shortcut PRs. However, he said he'd take a look at it.


### What steps reproduce the problem?

1. Place cursor at e.g. the beginning of a line with some tabs to its left.
2. Press ``Shift-Tab``
3. Try to execute other keyboard editing commands, noting the position of the focus



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
@@ -2976,6 +2976,7 @@ def keyPressEvent(self, event):
             else:
                 # indent the selected text
                 self.unindent()
+            event.accept()
         elif not event.isAccepted():
             TextEditBaseWidget.keyPressEvent(self, event)
             if self.is_completion_widget_visible() and text:


Test patch:
Repository: spyder-ide/spyder

Issue:
Custom interpreters are not shown in "Preferences > Python interpreter"
This happens when the Default interpreter is selected and (previously) custom interpreters were selected by the user. We have to fix this.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/configdialog.py b/spyder/plugins/configdialog.py
--- a/spyder/plugins/configdialog.py
+++ b/spyder/plugins/configdialog.py
@@ -700,7 +700,6 @@ def create_file_combobox(self, text, choices, option, default=NoDefault,
         if tip is not None:
             combobox.setToolTip(tip)
         combobox.addItems(choices)
-        self.comboboxes[combobox] = (option, default)
 
         msg = _('Invalid file path')
         self.validate_data[edit] = (osp.isfile, msg)


Test patch:
Repository: spyder-ide/spyder

Issue:
The pyls process opens a black DOS windows under Windows10
trying under Windows Python-3.7.1rc1 the spyder-master of 2018-10-13 (commit https://github.com/spyder-ide/spyder/commit/31f49d10ee407ea19b9bd78a14352f77869d2133)

The Python-langage-Server process opens a Dos window, that remains by default in front of Spyder screen.
Would it be possible to have an option to launch it hidden ?
![image](https://user-images.githubusercontent.com/4312421/46908675-9fb5d180-cf26-11e8-9295-e7f6fbdf578d.png)


Besides that, startup time looks twice quicker than spyder-3, on my very old machine.


Discussion:
We'll hide it by default. Thanks for reporting.
@dalthviz, we need to expand the creation flags we use to start the server here:

https://github.com/spyder-ide/spyder/blob/19c5f471b6f3c45ef18097cf9b39dffe1552ee9e/spyder/plugins/editor/lsp/client.py#L127

with this flag

https://github.com/spyder-ide/spyder-kernels/blob/c28b8908ece65aa52668a8cab455f6c05995dc6b/spyder_kernels/customize/spydercustomize.py#L166

Please test that this change effectively doesn't show a cmd for pyls, but in an environment where all packages are installed by pip.

Resolving patch:
diff --git a/spyder/plugins/editor/lsp/client.py b/spyder/plugins/editor/lsp/client.py
--- a/spyder/plugins/editor/lsp/client.py
+++ b/spyder/plugins/editor/lsp/client.py
@@ -124,7 +124,8 @@ def start(self):
                 ' '.join(self.server_args)))
             creation_flags = 0
             if WINDOWS:
-                creation_flags = subprocess.CREATE_NEW_PROCESS_GROUP
+                creation_flags = (subprocess.CREATE_NEW_PROCESS_GROUP
+                                  | 0x08000000)  # CREATE_NO_WINDOW
             self.lsp_server = subprocess.Popen(
                 self.server_args,
                 stdout=self.lsp_server_log,


Test patch:
Repository: spyder-ide/spyder

Issue:
Title field of error dialog is too small in macOS
This can be clearly seen in the following image:

![imagen](https://user-images.githubusercontent.com/365293/49333052-faae9100-f585-11e8-96a7-3033fbd160c8.png)

----

@juanis2112, this field is defined here:

https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/reporterror.py#L158

I don't know exactly how to do this, but QLineEdit has several methods to define its size (e.g. `setMinimumWidth` or `setMaximumWidth`). You can find the full list here:

http://doc.qt.io/qt-5/qlineedit-members.html

I'm sure one of them will allow us to set the QLineEdit width to expand to the size of the report error dialog.


Discussion:
Maybe another way to address this would be to explicitly set the [FieldGrowthPolicy](http://doc.qt.io/qt-5/qformlayout.html#fieldGrowthPolicy-prop) of the `QFormLayout` to `QFormLayout.ExpandingFieldsGrow`. By default, it is set to `FieldsStayAtSizeHint` for MacOS.

If you still want to go with the `setMinimumWidth`, I suggest to calculate the width with `QFontMetrics` instead of harcoding a value.
Thanks for the tip @jnsebgosselin!

Resolving patch:
diff --git a/spyder/widgets/reporterror.py b/spyder/widgets/reporterror.py
--- a/spyder/widgets/reporterror.py
+++ b/spyder/widgets/reporterror.py
@@ -160,6 +160,7 @@ def __init__(self, parent=None, is_report=False):
         self.title_chars_label = QLabel(_("{} more characters "
                                           "to go...").format(TITLE_MIN_CHARS))
         form_layout = QFormLayout()
+        form_layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
         red_asterisk = '<font color="Red">*</font>'
         title_label = QLabel(_("<b>Title</b>: {}").format(red_asterisk))
         form_layout.setWidget(0, QFormLayout.LabelRole, title_label)


Test patch:
Repository: spyder-ide/spyder

Issue:
AttributeError: 'WebView' object has no attribute 'setBackgroundColor'
## Problem Description
I was trying to test PR #8494 in a linux machine (WLS) since test are passing in my windows 10 machine. So I made a new clone of Spyder from github in the linux machine. Now I cannot run Spyder in bootstrap mode.
I also made a new recent clone in my windows machine. The same problem appears as well.

1 . Windows machine
![image](https://user-images.githubusercontent.com/22060413/50571281-0caa6c00-0d9e-11e9-8810-c3dc35e2e78b.png)

2. linux machine (WLS)
![image](https://user-images.githubusercontent.com/22060413/50571253-5181d300-0d9d-11e9-99b7-a5efd66c373d.png)

https://github.com/spyder-ide/spyder/blob/c0b8950904907a463f00eb8eec96117f56615218/spyder/plugins/help/widgets.py#L103

This was updated 5 days ago. I believe the problem is related to this new update. The old forked clone I have runs just fine.





Discussion:
@dalthviz, did you test PR #8497 in a Qt version that has Webkit instead of Webengine?
@ccordoba12 nop, I missed that, sorry. I'm working in the fix
Ok, thanks!

Resolving patch:
diff --git a/spyder/plugins/help/widgets.py b/spyder/plugins/help/widgets.py
--- a/spyder/plugins/help/widgets.py
+++ b/spyder/plugins/help/widgets.py
@@ -100,8 +100,8 @@ def __init__(self, parent):
             self.webview.web_widget.page().setBackgroundColor(
                 QColor(MAIN_BG_COLOR))
         else:
-            self.webview.web_widget.setBackgroundColor(
-                QColor(MAIN_BG_COLOR))
+            self.webview.web_widget.setStyleSheet(
+                "background:{}".format(MAIN_BG_COLOR))
         self.find_widget = FindReplace(self)
         self.find_widget.set_editor(self.webview.web_widget)
         self.find_widget.hide()
diff --git a/spyder/plugins/ipythonconsole/widgets/client.py b/spyder/plugins/ipythonconsole/widgets/client.py
--- a/spyder/plugins/ipythonconsole/widgets/client.py
+++ b/spyder/plugins/ipythonconsole/widgets/client.py
@@ -159,7 +159,8 @@ def __init__(self, plugin, id_,
         if WEBENGINE:
             self.infowidget.page().setBackgroundColor(QColor(MAIN_BG_COLOR))
         else:
-            self.infowidget.setBackgroundColor(QColor(MAIN_BG_COLOR))
+            self.infowidget.setStyleSheet(
+                "background:{}".format(MAIN_BG_COLOR))
         self.set_infowidget_font()
         self.blank_page = self._create_blank_page()
         self.loading_page = self._create_loading_page()


Test patch: