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

Issue:
Python console is stealing focus at startup because of message about its removal
Since @dalthviz added a message about the removal of the Python console, now the Python console is focused at startup before giving focus to the IPython console.

@dalthviz, please fix that :-)


Discussion:

Resolving patch:
diff --git a/spyder/plugins/externalconsole.py b/spyder/plugins/externalconsole.py
--- a/spyder/plugins/externalconsole.py
+++ b/spyder/plugins/externalconsole.py
@@ -715,11 +715,6 @@ def process_started(self, shell_id):
             self.help.set_shell(shell.shell)
         if self.variableexplorer is not None:
             self.variableexplorer.add_shellwidget(shell)
-        shell.shell.write("NOTE: The Python console is going to "
-                          "be REMOVED in Spyder 3.2. Please start "
-                          "to migrate your work to the "
-                          "IPython console instead.\n\n", prompt=True)
-        shell.shell.new_prompt("")
 
     def process_finished(self, shell_id):
         index = self.get_shell_index_from_id(shell_id)
diff --git a/spyder/widgets/shell.py b/spyder/widgets/shell.py
--- a/spyder/widgets/shell.py
+++ b/spyder/widgets/shell.py
@@ -82,6 +82,10 @@ def __init__(self, parent, history_filename, profile=False):
         
         # Buffer to increase performance of write/flush operations
         self.__buffer = []
+        self.__buffer.append("NOTE: The Python console is going to "
+                             "be REMOVED in Spyder 3.2. Please start "
+                             "to migrate your work to the "
+                             "IPython console instead.\n\n")
         self.__timestamp = 0.0
         self.__flushtimer = QTimer(self)
         self.__flushtimer.setSingleShot(True)


Test patch:
Repository: spyder-ide/spyder

Issue:
The message about the removal of the Python console is also shown on the Internal console
@dalthviz, please fix this one. The message must only appear on the Python console (of course).


Discussion:

Resolving patch:
diff --git a/spyder/widgets/externalshell/pythonshell.py b/spyder/widgets/externalshell/pythonshell.py
--- a/spyder/widgets/externalshell/pythonshell.py
+++ b/spyder/widgets/externalshell/pythonshell.py
@@ -42,7 +42,12 @@ class ExtPythonShellWidget(PythonShellWidget):
     focus_changed = Signal()
     
     def __init__(self, parent, history_filename, profile=False):
-        PythonShellWidget.__init__(self, parent, history_filename, profile)
+        initial_message = _("NOTE: The Python console is going to "
+                            "be REMOVED in Spyder 3.2. Please start "
+                            "to migrate your work to the "
+                            "IPython console instead.\n\n")
+        PythonShellWidget.__init__(self, parent, history_filename, profile,
+                                   initial_message=initial_message)
         self.path = []
     
     def set_externalshell(self, externalshell):
diff --git a/spyder/widgets/shell.py b/spyder/widgets/shell.py
--- a/spyder/widgets/shell.py
+++ b/spyder/widgets/shell.py
@@ -51,7 +51,8 @@ class ShellBaseWidget(ConsoleBaseWidget, SaveHistoryMixin):
     execute = Signal(str)
     append_to_history = Signal(str, str)
     
-    def __init__(self, parent, history_filename, profile=False):
+    def __init__(self, parent, history_filename, profile=False,
+                 initial_message=None):
         """
         parent : specifies the parent widget
         """
@@ -82,10 +83,9 @@ def __init__(self, parent, history_filename, profile=False):
         
         # Buffer to increase performance of write/flush operations
         self.__buffer = []
-        self.__buffer.append("NOTE: The Python console is going to "
-                             "be REMOVED in Spyder 3.2. Please start "
-                             "to migrate your work to the "
-                             "IPython console instead.\n\n")
+        if initial_message:
+            self.__buffer.append(initial_message)
+
         self.__timestamp = 0.0
         self.__flushtimer = QTimer(self)
         self.__flushtimer.setSingleShot(True)
@@ -682,8 +682,9 @@ class PythonShellWidget(TracebackLinksMixin, ShellBaseWidget,
     SEPARATOR = '%s##---(%s)---' % (os.linesep*2, time.ctime())
     go_to_error = Signal(str)
     
-    def __init__(self, parent, history_filename, profile=False):
-        ShellBaseWidget.__init__(self, parent, history_filename, profile)
+    def __init__(self, parent, history_filename, profile=False, initial_message=None):
+        ShellBaseWidget.__init__(self, parent, history_filename, profile,
+                                 initial_message)
         TracebackLinksMixin.__init__(self)
         GetHelpMixin.__init__(self)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Tab switcher dialog is not populated completely
I did a simple test after merging PR #4302 in `master` and our tab switcher dialog is not populated after pressing `Ctrl+Tab`. I mean, it only appears the first tab there and nothing else.

@rlaverde, please take a look at it.


Discussion:

Resolving patch:
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -326,6 +326,12 @@ def remove(self, tab_index):
         if _id in self.history:
             self.history.remove(_id)
 
+    def remove_and_append(self, index):
+        """Remove previous entrances of a tab, and add it as the latest."""
+        while index in self:
+            self.remove(index)
+        self.append(index)
+
 
 class TabSwitcherWidget(QListWidget):
     """Show tabs in mru order and change between them."""
@@ -1255,7 +1261,10 @@ def set_current_filename(self, filename, focus=True):
             editor = self.data[index].editor
             if focus:
                 editor.setFocus()
-            return editor
+            else:
+                self.stack_history.remove_and_append(index)
+
+            return editor  
 
     def is_file_opened(self, filename=None):
         if filename is None:
@@ -1584,10 +1593,8 @@ def current_changed(self, index, set_focus=True):
         self.opened_files_list_changed.emit()
 
         self.stack_history.refresh()
+        self.stack_history.remove_and_append(index)
 
-        while index in self.stack_history:
-            self.stack_history.remove(index)
-        self.stack_history.append(index)
         if DEBUG_EDITOR:
             print("current_changed:", index, self.data[index].editor, end=' ', file=STDOUT)
             print(self.data[index].editor.get_document_id(), file=STDOUT)


Test patch:
Repository: spyder-ide/spyder

Issue:
Add more annotation keywords to the Editor (e.g. BUG, OPTIMIZE, etc)
Code annotation analysis makes a blue check sign in the editor, which is a useful feature to find TODOs or FIXMEs.

But could it add more words? On the net, and more importantly in [pep8 index](https://www.python.org/dev/peps/pep-0350/#mnemonics), we can find many other tags, eg BUG, HACK, OPTIMIZE, etc.


Discussion:
We don't have time to do this, but you're welcome to send us a pull request to add more annotation keywords.

Resolving patch:
diff --git a/spyder/utils/codeanalysis.py b/spyder/utils/codeanalysis.py
--- a/spyder/utils/codeanalysis.py
+++ b/spyder/utils/codeanalysis.py
@@ -24,7 +24,8 @@
 #==============================================================================
 # Pyflakes/pep8 code analysis
 #==============================================================================
-TASKS_PATTERN = r"(^|#)[ ]*(TODO|FIXME|XXX|HINT|TIP|@todo)([^#]*)"
+TASKS_PATTERN = r"(^|#)[ ]*(TODO|FIXME|XXX|HINT|TIP|@todo|" \
+                r"HACK|BUG|OPTIMIZE|!!!|\?\?\?)([^#]*)"
 
 #TODO: this is a test for the following function
 def find_tasks(source_code):


Test patch:
Repository: spyder-ide/spyder

Issue:
Missing manpage for spyder
Please consider enhancing the documentation to include the generation of a suitable manpage for `spyder`. The GNU guidelines and most Linux distributions highly recommend command-line tools be distributed with corresponding manpages. The [Debian policy](https://www.debian.org/doc/debian-policy/ch-docs.html#s12.1) considers the lack of a manpage a bug.

Thanks,


Discussion:
Man pages are mainly for command line applications, and Spyder is not one of those.

So we'll gladly accept PRs for this, but we don't have time to work on this one, sorry.
> Man pages are mainly for command line applications

FYI, all GNOME applications (nautilus, evince, totem...) have corresponding manpages with the following structure:
```
NAME
SYNOPSIS
DESCRIPTION
OPTIONS
BUGS
AUTHORS
```
I'm not saying we don't want to do this, I'm just saying the gain is really minimal and we don't have time to do it.

Of course, we're welcome to receive a PR for it.

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -192,3 +192,16 @@
 
 # If false, no module index is generated.
 #latex_use_modindex = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+        ('manpage', 'spyder', 'Scientific PYthon Development EnviRonment',
+            ['Ghislain Antony Vaillant <ghisvail@gmail.com>'], 1)
+        ]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False


Test patch:
Repository: spyder-ide/spyder

Issue:
spyder_io_hdf5 plugin not available
## Description

spyder_io_hdf5 plugin doesn't seem to be registered although h5py installed correctly.

**What steps will reproduce the problem?**

1. Ensure h5py installed
2. Go to variable editor pane
3. Click import, note lack of .h5 extension being available

**What is the expected output? What do you see instead?**


**Please provide any additional information below**
This code change fixes it (line 51 and down of otherplugins.py):

****************
    for name in os.listdir(plugin_path):
        # Is this a Spyder plugin?
        if not name.startswith(PLUGIN_PREFIX):
            continue
        # Ensure right type of plugin
        if is_io != name.startswith(IO_PREFIX):
            continue

        # Import the plugin
        _import_plugin(name, plugin_path, modnames, modlist)
**************
## Version and main components

* Spyder Version: 3.1.4 
* Python Version: 3.5.2
* Qt Versions: 5.7.0, PyQt5 5.7 on Linux

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
numpy >=1.7      :  1.12.0 (OK)
sphinx >=0.6.6   :  1.6.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.2 (OK)
matplotlib >=1.0 :  2.0.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
pylint >=0.25    :  1.7.1 (OK)

```



Discussion:
Could you open a pull request about this? You can do it using the Github web interface for that.
But please do it against the `3.x` branch and not master (`3.x` is our current maintenance branch).

Resolving patch:
diff --git a/spyder/otherplugins.py b/spyder/otherplugins.py
--- a/spyder/otherplugins.py
+++ b/spyder/otherplugins.py
@@ -49,9 +49,13 @@ def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
         return
 
     for name in os.listdir(plugin_path):
-        if is_io and not name.startswith(IO_PREFIX):
+        # This is needed in order to register the spyder_io_hdf5 plugin.
+        # See issue 4487
+        # Is this a Spyder plugin?
+        if not name.startswith(PLUGIN_PREFIX):
             continue
-        if not name.startswith(PLUGIN_PREFIX) or name.startswith(IO_PREFIX):
+        # Ensure right type of plugin
+        if is_io != name.startswith(IO_PREFIX):
             continue
 
         # Import the plugin


Test patch:
Repository: spyder-ide/spyder

Issue:
Error in syntaxhighlighting of decorators



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
@@ -292,7 +292,7 @@ def make_python_patterns(additional_keywords=[], additional_builtins=[]):
     comment = any("comment", [r"#[^\n]*"])
     instance = any("instance", [r"\bself\b",
                                 (r"^\s*@([a-zA-Z_][a-zA-Z0-9_]*)"
-                                     r"(.[a-zA-Z_][a-zA-Z0-9_]*)*")])
+                                     r"(\.[a-zA-Z_][a-zA-Z0-9_]*)*")])
     number = any("number",
                  [r"\b[+-]?[0-9]+[lLjJ]?\b",
                   r"\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b",


Test patch:
Repository: spyder-ide/spyder

Issue:
Multiple whitespaces as a separator in variable explorer
Currently the data import wizard doesn't play nicely with text data with multiple spaces as delimiters(or maybe I don't play nicely with the data importer ;-). This is common in fixed width data sets like this:
```
FIRST  LAST           STATE     TELEPHONE      AGE   WEIGHT
John   Smith          WA        418-Y11-4111    26    3.0456
Mary   Hartford       CA        319-Z19-4341     5   13.5687
Evan   Nolan          IL        219-532-c301   145   45.7890
```
Putting a `' '` (a space) in a the 'other' text box gives this:

![screenshot from 2017-06-09 22-54-23](https://user-images.githubusercontent.com/10513354/27000139-d82be01e-4d67-11e7-8744-60a5ccf6eaf8.png)

When it could give this:

![screenshot from 2017-06-09 22-59-21](https://user-images.githubusercontent.com/10513354/27000146-f6d744e0-4d67-11e7-8119-212dbf0b212f.png)

I can submit a pull request to add a "whitespace" radio button to have this option, if you think that's a good direction to go.








Discussion:
> I can submit a pull request to add a "whitespace" radio button to have this option, if you think that's a good direction to go.

Sounds good to me, but I don't understand where that option would be placed.
something like this:

![image](https://user-images.githubusercontent.com/10513354/27006211-92650a18-4deb-11e7-8812-11f877270537.png)



Resolving patch:
diff --git a/spyder/widgets/variableexplorer/importwizard.py b/spyder/widgets/variableexplorer/importwizard.py
--- a/spyder/widgets/variableexplorer/importwizard.py
+++ b/spyder/widgets/variableexplorer/importwizard.py
@@ -142,6 +142,9 @@ def __init__(self, parent, text):
         self.tab_btn = QRadioButton(_("Tab"))
         self.tab_btn.setChecked(False)
         col_btn_layout.addWidget(self.tab_btn)
+        self.ws_btn = QRadioButton(_("Whitespace"))
+        self.ws_btn.setChecked(False)
+        col_btn_layout.addWidget(self.ws_btn)
         other_btn_col = QRadioButton(_("other"))
         other_btn_col.setChecked(True)
         col_btn_layout.addWidget(other_btn_col)
@@ -231,6 +234,8 @@ def get_col_sep(self):
         """Return the column separator"""
         if self.tab_btn.isChecked():
             return u"\t"
+        elif self.ws_btn.isChecked():
+            return None
         return to_text_string(self.line_edt.text())
 
     def get_row_sep(self):
@@ -462,7 +467,10 @@ def open_data(self, text, colsep=u"\t", rowsep=u"\n",
         if pd:
             self.pd_text = text
             self.pd_info = dict(sep=colsep, lineterminator=rowsep,
-                skiprows=skiprows,comment=comments)
+                skiprows=skiprows, comment=comments)
+            if colsep is None:
+                self.pd_info = dict(lineterminator=rowsep, skiprows=skiprows,
+                    comment=comments, delim_whitespace=True)
         self._table_view.process_data(text, colsep, rowsep, transpose,
                                       skiprows, comments)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Spyder hangs after Introduction Tour
## Description

Spyder hangs after doing interactive tour (Help --> Interactive Tour --> Introduction Tour).  Actually, this happens after many things but this one is reproducible.  By 'hang' I mean that it does not respond to the keyboard or mouse.  It's necessary to kill it from TaskManager.

**What steps will reproduce the problem?**

1. start spyder
2. click through interactive tour
3. at the end, click the X on the interactive tour box

**What is the expected output? What do you see instead?**

Spyder goes back to normal operation.

**Please provide any additional information below**

Running on Windows 10 with latest updates as of 6/3/17

## Version and main components

* Spyder Version: 3.1.4 
* Python Version: 3.5.3
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
nbconvert >=4.0  :  5.2.1 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
matplotlib >=1.0 :  2.0.2 (OK)
sympy >=0.7.3    :  1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:
Thanks for reporting. We'll take a look at this before releasing 3.2.
@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/app/tour.py b/spyder/app/tour.py
--- a/spyder/app/tour.py
+++ b/spyder/app/tour.py
@@ -928,20 +928,22 @@ def __init__(self, parent):
 
     def _resized(self, event):
         """ """
-        size = event.size()
-        self.canvas.setFixedSize(size)
-        self.canvas.update_canvas()
+        if self.is_running:
+            size = event.size()
+            self.canvas.setFixedSize(size)
+            self.canvas.update_canvas()
 
-        if self.is_tour_set:
-            self._set_data()
+            if self.is_tour_set:
+                self._set_data()
 
     def _moved(self, event):
         """ """
-        pos = event.pos()
-        self.canvas.move(QPoint(pos.x(), pos.y()))
+        if self.is_running:
+            pos = event.pos()
+            self.canvas.move(QPoint(pos.x(), pos.y()))
 
-        if self.is_tour_set:
-            self._set_data()
+            if self.is_tour_set:
+                self._set_data()
 
     def _close_canvas(self):
         """ """
@@ -1200,7 +1202,9 @@ def start_tour(self):
     def close_tour(self):
         """ """
         self.tips.fade_out(self._close_canvas)
-        self.tips.show()
+        self.canvas.set_interaction(False)
+        self._set_modal(True, [self.tips])
+        self.canvas.hide()
 
         try:
             # set the last played frame by updating the available tours in 


Test patch:
Repository: spyder-ide/spyder

Issue:
Move to support only Rope 0.10.5+
That's because 0.10.5 is the first version to support Python 2 and 3 in the same package.


Discussion:
@rlaverde, the idea of this is to update our setup.py, README and docs to mention that we now support Rope 0.10.5+

Since this version supports Python 2 and 3 with the same codebase, we can drop the dependency in `rope_py3k` in our `setup.py`.

That will allow us to create universal wheels, and for that you need to add also a file like

https://github.com/spyder-ide/qtpy/blob/master/setup.cfg

to Spyder.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -272,7 +272,7 @@ def run(self):
     import setuptools     # analysis:ignore
 
 install_requires = [
-    'rope_py3k' if PY3 else 'rope>=0.9.4',
+    'rope>=0.10.5',
     'jedi>=0.9.0',
     'pyflakes',
     'pygments>=2.0',


Test patch:
Repository: spyder-ide/spyder

Issue:
Editors not gaining focus when changing by tab click
With 2 or more files open on the editor, clicking on different tabs should give the focus to the editor (cursor should start blinking) and the outline explorer should update because of this focus gain. Currently the focus is not given to the editor. This does works with the file switcher.

This is on 3.x but not on 3.1.x.


Discussion:
@dalthviz, please take a look at this one. Since this is a bug that appeared in 3.x, please use `git bisect` to detect the commit that introduced it.
I introduced this bug in https://github.com/spyder-ide/spyder/pull/3946/commits/2228e83b656a476683f27e9ddd5e234a08135be6 while fixing #1170, giving the focus  to the Editor caused the unwanted scrolling, should we revert it?
@ccordoba12 ?
No, we should find a new way to give focus to the current tab. #1170 was very annoying.

@rlaverde, please work on this one.

Resolving patch:
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -717,7 +717,7 @@ def setup_editorstack(self, parent, layout):
             # a crash when the editor is detached from the main window
             # Fixes Issue 561
             self.tabs.setDocumentMode(True)
-        self.tabs.currentChanged.connect(self.current_changed_tabs)
+        self.tabs.currentChanged.connect(self.current_changed)
 
         if sys.platform == 'darwin':
             tab_container = QWidget()
@@ -1210,7 +1210,11 @@ def set_stack_title(self, index, is_modified):
         is_readonly = finfo.editor.isReadOnly()
         tab_text = self.get_tab_text(index, is_modified, is_readonly)
         tab_tip = self.get_tab_tip(fname, is_modified, is_readonly)
-        self.tabs.setTabText(index, tab_text)
+
+        # Only update tab text if have changed, otherwise an unwanted scrolling
+        # will happen when changing tabs. See Issue #1170.
+        if tab_text != self.tabs.tabText(index):
+            self.tabs.setTabText(index, tab_text)
         self.tabs.setTabToolTip(index, tab_tip)
 
 
@@ -1621,17 +1625,14 @@ def get_todo_results(self):
         if self.data:
             return self.data[self.get_stack_index()].todo_results
 
-    def  current_changed_tabs(self, index):
-        self.current_changed(index, set_focus=False)
-
-    def current_changed(self, index, set_focus=True):
+    def current_changed(self, index):
         """Stack index has changed"""
 #        count = self.get_stack_count()
 #        for btn in (self.filelist_btn, self.previous_btn, self.next_btn):
 #            btn.setEnabled(count > 1)
 
         editor = self.get_current_editor()
-        if index != -1 and set_focus:
+        if index != -1:
             editor.setFocus()
             if DEBUG_EDITOR:
                 print("setfocusto:", editor, file=STDOUT)


Test patch: