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

Issue:
IOError when trying to write to stderr file
## 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 "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/site-packages/spyder/plugins/__init__.py", line 511, in <lambda>
    toggled=lambda checked: self.toggle_view(checked),
  File "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 725, in toggle_view
    self.create_new_client(give_focus=False)
  File "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 1033, in create_new_client
    self.connect_client_to_kernel(client)
  File "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 1059, in connect_client_to_kernel
    stderr_file)
  File "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 1482, in create_kernel_manager_and_kernel_client
    stderr = codecs.open(stderr_file, 'w', encoding='utf-8')
  File "/home/cui/anaconda2/envs/tensorflow/lib/python2.7/codecs.py", line 896, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 13] Permission denied: u'/tmp/spyder-cui/kernel-1e414308bce9.stderr'


## Version and main components

* Spyder Version: 3.2.6 
* Python Version: 2.7.11
* Qt Versions: 5.6.2, PyQt5 5.6 on Linux

## Dependencies
```
pyflakes >=0.5.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  None (NOK)
numpy >=1.7       :  1.13.3 (OK)
sphinx >=0.6.6    :  1.6.4 (OK)
rope >=0.9.4      :  0.10.7 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
psutil >=0.3      :  5.4.0 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.5.0 (OK)
pylint >=0.25     :  1.7.1 (OK)

```



Discussion:
Thanks for reporting. We'll fix this in our next release.

In the meantime, you need to be sure that the directory `/tmp/spyder-cui` has write permissions.
@dalthviz, the ideas is to catch *any* error at the place this error occurs.

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole.py b/spyder/plugins/ipythonconsole.py
--- a/spyder/plugins/ipythonconsole.py
+++ b/spyder/plugins/ipythonconsole.py
@@ -1495,7 +1495,12 @@ def create_kernel_manager_and_kernel_client(self, connection_file,
 
         # Save stderr in a file to read it later in case of errors
         if stderr_file is not None:
-            stderr = codecs.open(stderr_file, 'w', encoding='utf-8')
+            # Needed to prevent any error that could appear.
+            # See issue 6267
+            try:
+                stderr = codecs.open(stderr_file, 'w', encoding='utf-8')
+            except Exception:
+                stderr = None
         else:
             stderr = None
         kernel_manager.start_kernel(stderr=stderr)


Test patch:
Repository: spyder-ide/spyder

Issue:
Add the the Collapse All and Expand All buttons to the toolbar of the Outline Explorer
The `Collapse All` and `Expand All` actions appear in the context menu of the Outline Explorer, but not in the toolbar of the plugin, like for the actions `Collapse Selection` and `Expand Selection`.

I think this should be added to harmonize the toolbar and the context menu of the Outline Explorer plugin.

![image](https://user-images.githubusercontent.com/10170372/35696322-2cc717a4-0755-11e8-9185-5937408829d4.png)


Discussion:

Resolving patch:
diff --git a/spyder/widgets/editortools.py b/spyder/widgets/editortools.py
--- a/spyder/widgets/editortools.py
+++ b/spyder/widgets/editortools.py
@@ -528,20 +528,24 @@ def toggle_visibility(self, state):
             current_editor.setFocus()
             if state:
                 self.outlineexplorer_is_visible.emit()
-        
+
     def setup_buttons(self):
-        fromcursor_btn = create_toolbutton(self,
-                             icon=ima.icon('fromcursor'),
+        """Setup the buttons of the outline explorer widget toolbar."""
+        fromcursor_btn = create_toolbutton(
+                             self, icon=ima.icon('fromcursor'),
                              tip=_('Go to cursor position'),
                              triggered=self.treewidget.go_to_cursor_position)
-        collapse_btn = create_toolbutton(self)
-        collapse_btn.setDefaultAction(self.treewidget.collapse_selection_action)
-        expand_btn = create_toolbutton(self)
-        expand_btn.setDefaultAction(self.treewidget.expand_selection_action)
-        restore_btn = create_toolbutton(self)
-        restore_btn.setDefaultAction(self.treewidget.restore_action)
-        return (fromcursor_btn, collapse_btn, expand_btn, restore_btn)
-        
+
+        buttons = [fromcursor_btn]
+        for action in [self.treewidget.collapse_all_action,
+                       self.treewidget.expand_all_action,
+                       self.treewidget.restore_action,
+                       self.treewidget.collapse_selection_action,
+                       self.treewidget.expand_selection_action]:
+            buttons.append(create_toolbutton(self))
+            buttons[-1].setDefaultAction(action)
+        return buttons
+
     def set_current_editor(self, editor, fname, update, clear):
         if clear:
             self.remove_editor(editor)


Test patch:
Repository: spyder-ide/spyder

Issue:
Icon should be moved from share/pixmaps to share/icons
While /usr/share/pixmaps is in the icon path, ~/.local/share/pixmaps is not, so local installs (e.g. by pip install spyder3 --user) have no icon for the menu item. Moreover the spyder icon is a .png, not a .xpm, and the pixmap format (and location) is supported but (afaiu) deprecated.

I'm using spyder 3.2.6 with python 3.5.2 on Linux Mint 18.3


Discussion:
Thanks for reporting, we'll fix this in 3.2.7.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -79,11 +79,11 @@ def get_data_files():
     if sys.platform.startswith('linux'):
         if PY3:
             data_files = [('share/applications', ['scripts/spyder3.desktop']),
-                          ('share/pixmaps', ['img_src/spyder3.png']),
+                          ('share/icons', ['img_src/spyder3.png']),
                           ('share/metainfo', ['scripts/spyder3.appdata.xml'])]
         else:
             data_files = [('share/applications', ['scripts/spyder.desktop']),
-                          ('share/pixmaps', ['img_src/spyder.png'])]
+                          ('share/icons', ['img_src/spyder.png'])]
     elif os.name == 'nt':
         data_files = [('scripts', ['img_src/spyder.ico',
                                    'img_src/spyder_reset.ico'])]


Test patch:
Repository: spyder-ide/spyder

Issue:
FileNotFoundError history.py when running code in the IPython console
## Description

**What steps will reproduce the problem?**

1. Launch Spyder
2. Typing into IPython Console and entering raises error 
3. Running code from a file raises error once after typing into IPython Console but then doesn't raise error until typing into IPython Console again

**What is the expected output? What do you see instead?**
Expected Output is still the same except error is raised in separate window

**Please provide any additional information below**
Code still works and outputs the correct output when typing into IPython Console 

  File "C:\Users\Name\Anaconda3\lib\site-packages\spyder\widgets\mixins.py", line 758, in add_to_history
    encoding.write(text, self.history_filename, mode='ab')
  File "C:\Users\Name\Anaconda3\lib\site-packages\spyder\utils\encoding.py", line 227, in write
    with open(filename, mode) as textfile:
FileNotFoundError: [Errno 2] No such file or directory: '%USERPROFILE\\.spyder-py3\\history.py'


## Version and main components

* Spyder Version: 3.2.4 
* Python Version: 3.6.3
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.6.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.3 (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.1.0 (OK)
pylint >=0.25    :  1.7.4 (OK)

```



Discussion:
Thanks for reporting. We'll fix this problem in our next release.
@dalthviz, please catch OSError and IOError in this line

https://github.com/spyder-ide/spyder/blob/3.x/spyder/widgets/mixins.py#L758

and pass in the except part.

Resolving patch:
diff --git a/spyder/widgets/mixins.py b/spyder/widgets/mixins.py
--- a/spyder/widgets/mixins.py
+++ b/spyder/widgets/mixins.py
@@ -754,8 +754,12 @@ def add_to_history(self, command):
         if self.history_filename not in self.HISTORY_FILENAMES:
             self.HISTORY_FILENAMES.append(self.history_filename)
             text = self.SEPARATOR + text
-        
-        encoding.write(text, self.history_filename, mode='ab')
+        # Needed to prevent errors when writing history to disk
+        # See issue 6431
+        try:
+            encoding.write(text, self.history_filename, mode='ab')
+        except (IOError, OSError):
+            pass
         if self.append_to_history is not None:
             self.append_to_history.emit(self.history_filename, text)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
AttributeError in jedi_plugin.py:102
I am getting the following error with the current master:
```
Response error:Traceback (most recent call last):
  File "plugin_server.py", line 95, in run
    response['result'] = func(*args, **kwargs)
  File "/home/jitse/misc/spyder/spyder/utils/introspection/jedi_plugin.py", line 102, in get_info
    elif call_def.doc and '(' in call_def.doc.splitlines()[0]:
AttributeError: 'Definition' object has no attribute 'doc'
```
This is almost certainly due to a mistake on my part in #6497 that was not found by the automatic tests, so I will take care of it shortly.

To trigger, press `Ctrl+I` when the cursor is on `end_callbacks` on line 119 of spyder/widgets/editor.py .


Discussion:

Resolving patch:
diff --git a/spyder/utils/introspection/jedi_plugin.py b/spyder/utils/introspection/jedi_plugin.py
--- a/spyder/utils/introspection/jedi_plugin.py
+++ b/spyder/utils/introspection/jedi_plugin.py
@@ -99,7 +99,7 @@ def get_info(self, info):
             calltip = getsignaturefromtext(docstring, name)
             argspec = calltip[calltip.find('('):]
             docstring = docstring[docstring.find(')') + 3:]
-        elif call_def.doc and '(' in call_def.doc.splitlines()[0]:
+        elif docstring and '(' in docstring.splitlines()[0]:
             calltip = docstring.splitlines()[0]
             name = docstring.split('(')[0]
             docstring = docstring[docstring.find(')') + 3:]


Test patch:
diff --git a/spyder/utils/introspection/tests/test_jedi_plugin.py b/spyder/utils/introspection/tests/test_jedi_plugin.py
--- a/spyder/utils/introspection/tests/test_jedi_plugin.py
+++ b/spyder/utils/introspection/tests/test_jedi_plugin.py
@@ -41,6 +41,14 @@ def test_get_info():
     assert docs['calltip'].startswith('walk(') and docs['name'] == 'walk'
 
 
+def test_get_info_from_method():
+    """Regression test for issue 6516."""
+    source_code = "L = [1]; L.append"
+    docs = p.get_info(CodeInfo('info', source_code, len(source_code)))
+    assert docs['calltip'].startswith('L.append(')
+    assert docs['name'] == 'L.append'
+
+
 def test_get_completions():
     source_code = "import o"
     completions = p.get_completions(CodeInfo('completions', source_code,
Repository: spyder-ide/spyder

Issue:
Sphinx html_use_smartypants is deprecated as of 1.6 and removed in 1.7
http://www.sphinx-doc.org/en/stable/config.html#confval-smartquotes

This is used in spyder/utils/help/conf.py


Discussion:
@csabella, could this be related to issue #6549?

Resolving patch:
diff --git a/spyder/utils/help/conf.py b/spyder/utils/help/conf.py
--- a/spyder/utils/help/conf.py
+++ b/spyder/utils/help/conf.py
@@ -97,10 +97,13 @@
 # pages
 html_context = {}
 
-# If true, SmartyPants will be used to convert quotes and dashes to
+# If true, Smart Quotes will be used to convert quotes and dashes to
 # typographically correct entities.
 # Spyder: Disabled to fix conflict with qtwebview and mathjax. See issue #5514
-html_use_smartypants = False
+if sphinx_version < "1.7":
+    html_use_smartypants = False
+else:
+    smartquotes = False
 
 # If false, no module index is generated.
 html_use_modindex = False


Test patch:
Repository: spyder-ide/spyder

Issue:
Changing file in editor with [Ctl]+[tab] uncompatible with tiling window manager
## Problem Description
The widget opened when using [Ctl]+[tab] opens as full window with (i3) tiling window manager.
I think it should be opened as a floating window (just like the file switcher or symbol finder).

### What steps will reproduce the problem?
* Open Spyder with i3 window manager ;
* open two files ;
* switch file with [Ctl] + [Tab].


## Package Versions

* Spyder 3.2.7
* Python 3.5.2
* Qt 5.9.3
* PyQt5 5.9.2
* Linux 4.4.0-116-generic

### Dependencies

```
pyflakes >=0.6.0 :  1.1.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.1 (OK)
pandas >=0.13.1  :  0.17.1 (OK)
numpy >=1.7      :  1.14.1 (OK)
sphinx >=0.6.6   :  1.3.6 (OK)
rope >=0.9.4     :  0.10.7 (OK)
jedi >=0.9.0     :  0.11.1 (OK)
psutil >=0.3     :  3.4.2 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.23.4 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.2.1 (OK)
pylint >=0.25    :  1.5.2 (OK)
```



Discussion:
You're welcome to submit a PR for this. Unfortunately we don't have time to fix it.
I can try. Could you tell me in which file to look ?

Resolving patch:
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -338,7 +338,7 @@ class TabSwitcherWidget(QListWidget):
 
     def __init__(self, parent, stack_history, tabs):
         QListWidget.__init__(self, parent)
-        self.setWindowFlags(Qt.SubWindow | Qt.FramelessWindowHint | Qt.Dialog)
+        self.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog)
 
         self.editor = parent
         self.stack_history = stack_history
@@ -423,6 +423,17 @@ def keyPressEvent(self, event):
         elif event.key() == Qt.Key_Up:
             self.select_row(-1)
 
+    def focusOutEvent(self, event):
+        """Reimplement Qt method to close the widget when loosing focus."""
+        event.ignore()
+        # Inspired from CompletionWidget.focusOutEvent() in file
+        # widgets/sourcecode/base.py line 212
+        if sys.platform == "darwin":
+            if event.reason() != Qt.ActiveWindowFocusReason:
+                self.close()
+        else:
+            self.close()
+
 
 class EditorStack(QWidget):
     reset_statusbar = Signal()


Test patch:
Repository: spyder-ide/spyder

Issue:
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
## 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:\Users\usuario\ANACONDA\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 561, in show_time
    elapsed_time = time() - self.t0
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Traceback (most recent call last):
  File "C:\Users\usuario\ANACONDA\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 561, in show_time
    elapsed_time = time() - self.t0
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Traceback (most recent call last):
WARNING:traitlets:kernel died: 3.0197155475616455
  File "C:\Users\usuario\ANACONDA\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 561, in show_time
    elapsed_time = time() - self.t0
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Traceback (most recent call last):
  File "C:\Users\usuario\ANACONDA\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 561, in show_time
    elapsed_time = time() - self.t0
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Traceback (most recent call last):
  File "C:\Users\usuario\ANACONDA\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 561, in show_time
    ela


Discussion:
Thanks for reporting. We'll fix this problem in our next release.

@csabella, this one is yours :-) I think it happens when the kernel takes too much time to start.
This is the old code before my change in #6699, but we don't know what version of Spyder the OP is running.  @ccordoba12 , do you think one of the other fixes to the console would have helped with the kernel start up time?  Just thinking if @angelalarc99 updates to 3.2.8, then it may resolve their issue.

I will, however, also put in a check to make sure self.t0 isn't None.  :-)

Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/client.py b/spyder/widgets/ipythonconsole/client.py
--- a/spyder/widgets/ipythonconsole/client.py
+++ b/spyder/widgets/ipythonconsole/client.py
@@ -140,7 +140,7 @@ def __init__(self, plugin, id_,
 
         # Elapsed time
         self.time_label = None
-        self.t0 = None
+        self.t0 = time.monotonic()
         self.timer = QTimer(self)
 
         # --- Layout


Test patch:
Repository: spyder-ide/spyder

Issue:
AttributeError: Nonetype has no attribute "clear" when right clicking in the empty project explorer with no project open
```python-traceback
File "/usr/local/anaconda3/lib/python3.6/site-packages/spyder/widgets/explorer.py", line 480, in contextMenuEvent
    self.update_menu()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/spyder/widgets/explorer.py", line 458, in update_menu
    self.menu.clear()
AttributeError: 'NoneType' object has no attribute 'clear'
```
--------
click right button on mouse in cleared project manager window


Discussion:
Yup, was able to reproduce. Specifically, the window was "cleared" by closing the current project, then reopening it from the menu. @ccordoba12 , do we want to just catch the error and pass (or otherwise better handle it), or go further and disable opening the project explorer when no project is open, since it serves no real purpose?
Also, I get a series of followup errors:

```python-traceback
  File "C:\Anaconda3\lib\site-packages\qtconsole\console_widget.py", line 420, in eventFilter
    event.button() == QtCore.Qt.MidButton and \
AttributeError: 'QContextMenuEvent' object has no attribute 'button'
```

Which continue until I tell it to hide the error dialog for future errors (or presumably restart spyder).
> do we want to just catch the error and pass

Yep, I think it's the easiest thing to do.

> or go further and disable opening the project explorer when no project is open, since it serves no real purpose?

There's no harm in showing the project explorer empty.

> Also, I get a series of followup errors

This is odd. I don't know why those errors are generated.
Okay, cool. I'll get to it Soon™
@dalthviz, please work on this one by catching `AttributeError` in the right places.

Resolving patch:
diff --git a/spyder/widgets/explorer.py b/spyder/widgets/explorer.py
--- a/spyder/widgets/explorer.py
+++ b/spyder/widgets/explorer.py
@@ -477,8 +477,13 @@ def viewportEvent(self, event):
                 
     def contextMenuEvent(self, event):
         """Override Qt method"""
-        self.update_menu()
-        self.menu.popup(event.globalPos())
+        # Needed to handle not initialized menu.
+        # See issue 6975
+        try:
+            self.update_menu()
+            self.menu.popup(event.globalPos())
+        except AttributeError:
+            pass
 
     def keyPressEvent(self, event):
         """Reimplement Qt method"""


Test patch:
Repository: spyder-ide/spyder

Issue:
Include Matplotlib in Help > Dependencies
This will give users more helpful info about their installation and improve Spyder problem reports when users paste their installed dependencies list.

## Package Versions
* Spyder: 3.2.8


Discussion:
You're right. We'll do that for our next version.
@ccordoba12 If you get to it first, I've been meaning to do this for a long time but can we sort our dependency list alphabetically, and make the order consistent between the dialog/manually copyed dep list and the Report Error Help Menu item/automatic error report? This has been bugging me for a while and makes tracking down issues due to specific package versions (or ruling them out) that much harder.
> can we sort our dependency list alphabetically, and make the order consistent between the dialog/manually copyed dep list and the Report Error Help Menu item/automatic error report?

This is for another issue, and I don't have plans to solve it for now.
@ccordoba12 Okay, I'll try to get to it at some point—its been high in my queue due to how annoying it has been, but keeps getting bumped by more pressing matters.
@dalthviz, an easy one for you. Please add the dependency in `plugins/ipythonconsole.py`

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole.py b/spyder/plugins/ipythonconsole.py
--- a/spyder/plugins/ipythonconsole.py
+++ b/spyder/plugins/ipythonconsole.py
@@ -78,6 +78,10 @@
 dependencies.add("IPython", _("IPython interactive python environment"),
                  required_version=IPYTHON_REQVER)
 
+MATPLOTLIB_REQVER = '>=2.0.0'
+dependencies.add("matplotlib", _("Display 2D graphics in the IPython Console"),
+                 required_version=MATPLOTLIB_REQVER, optional=True)
+
 #------------------------------------------------------------------------------
 # Existing kernels
 #------------------------------------------------------------------------------


Test patch:
Repository: spyder-ide/spyder

Issue:
Add pythoncom and fastmat to the UMR blacklist
Reasons:

* fastmat: https://github.com/EMS-TU-Ilmenau/fastmat/issues/27
* pythoncom: https://stackoverflow.com/q/50439165/438386

@dalthviz, please work on this one.


Discussion:
`fastmat` only needs to be added for Python 2.

Resolving patch:
diff --git a/spyder/utils/site/sitecustomize.py b/spyder/utils/site/sitecustomize.py
--- a/spyder/utils/site/sitecustomize.py
+++ b/spyder/utils/site/sitecustomize.py
@@ -558,9 +558,12 @@ def __init__(self, namelist=None, pathlist=None):
         # Add other, necessary modules to the UMR blacklist
         # astropy: see issue 6962
         # pytorch: see issue 7041
-        other_modules = ['pytorch']
+        # fastmat: see issue 7190
+        # pythoncom: see issue 7190
+        other_modules = ['pytorch', 'pythoncom']
         if PY2:
-            other_modules.append('astropy')
+            py2_modules = ['astropy', 'fastmat']
+            other_modules = other_modules + py2_modules
         self.namelist = namelist + spy_modules + mpl_modules + other_modules
 
         if pathlist is None:


Test patch: