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

Issue:
Error when opening project and cancelling
## Description of your problem

**What steps will reproduce the problem?**
1. Click `Project > Open Project ...`
2. Click `Cancel` in the "Open project" window

**What is the expected output? What do you see instead?**

I get an error window saying "is not a Spyder project!". Instead, I expect nothing to happen.
## Versions and main components
- Spyder Version: 3.0 beta 6
- Python Version: 3.5
- Operating system: Linux



Discussion:

Resolving patch:
diff --git a/spyder/plugins/projects.py b/spyder/plugins/projects.py
--- a/spyder/plugins/projects.py
+++ b/spyder/plugins/projects.py
@@ -24,7 +24,7 @@
 from spyder.plugins import SpyderPluginMixin
 from spyder.py3compat import is_text_string, getcwd
 from spyder.utils import icon_manager as ima
-from spyder.utils.qthelpers import add_actions, create_action, get_icon
+from spyder.utils.qthelpers import add_actions, create_action
 from spyder.widgets.projects.explorer import ProjectExplorerWidget
 from spyder.widgets.projects.projectdialog import ProjectDialog
 from spyder.widgets.projects import EmptyProject
@@ -234,7 +234,8 @@ def open_project(self, path=None, restart_consoles=True):
                                         caption=_("Open project"),
                                         basedir=basedir)
             if not self.is_valid_project(path):
-                QMessageBox.critical(self, _('Error'),
+                if path:
+                    QMessageBox.critical(self, _('Error'),
                                 _("<b>%s</b> is not a Spyder project!" % path))
                 return
             else:


Test patch:
Repository: spyder-ide/spyder

Issue:
Editor autoindentation fails after list, dict
_From [patrick....@gmail.com](https://code.google.com/u/116784098090120188806/) on 2013-04-30T13:17:22Z_

Spyder Version:  2.1.12
Python Version:  2.7.3
Qt Version:      4.8.4, PyQt4 (API v2) 4.9.6 on Windows 

What steps will reproduce the problem?
1. Start a new file and type this:

def somenewfunc(arg1, 
                arg2=0, <enter>
                _

The editor helpfully autoindents leaving the cursor where the underscore is shown until you try something like a list or dict:

def somenewfunc(arg1,
                arg2=0, 
                arg3=[1], <enter>
_

OR

def somenewfunc(arg1,
                arg2=0, 
                arg3={1:'a'}, <enter>
_

Then it does not autoindent. There may be other objects which interfere with the autoindentation but I don't know what they are. It took a little while to observe the behavior was object-dependent rather than sporadic.

_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1373_



Discussion:
_From [ccordoba12](https://code.google.com/u/ccordoba12/) on 2015-01-02T18:54:45Z_

**Labels:** Cat-Editor MS-v2.4  


Resolving patch:
diff --git a/spyder/widgets/sourcecode/codeeditor.py b/spyder/widgets/sourcecode/codeeditor.py
--- a/spyder/widgets/sourcecode/codeeditor.py
+++ b/spyder/widgets/sourcecode/codeeditor.py
@@ -1957,8 +1957,10 @@ def fix_indent(self, forward=True, comment_or_string=False):
                                 break
                 else:
                     if prevtext.strip():
-                        prevexpr = re.split(r'\(|\{|\[', prevtext)[-1]
-                        correct_indent = len(prevtext)-len(prevexpr)
+                        if len(re.split(r'\(|\{|\[', prevtext)) > 1:
+                            #correct indent only if there are still opening brackets
+                            prevexpr = re.split(r'\(|\{|\[', prevtext)[-1]
+                            correct_indent = len(prevtext)-len(prevexpr)
                     else:
                         correct_indent = len(prevtext)
 


Test patch:
diff --git a/spyder/widgets/sourcecode/tests/test_autoindent.py b/spyder/widgets/sourcecode/tests/test_autoindent.py
--- a/spyder/widgets/sourcecode/tests/test_autoindent.py
+++ b/spyder/widgets/sourcecode/tests/test_autoindent.py
@@ -49,6 +49,9 @@ def test_def_with_indented_comment():
     text = get_indent_fix("def function():\n    # Comment\n")
     assert text == "def function():\n    # Comment\n    ", repr(text)
 
+def test_brackets_alone():
+    text = get_indent_fix("def function():\n    print []\n")
+    assert text == "def function():\n    print []\n    ", repr(text)
 
 # --- Failing tests
 # -----------------------------------------------------------------------------
@@ -70,11 +73,5 @@ def test_open_parenthesis():
     assert text == "open_parenthesis(\n    ", repr(text)
 
 
-@pytest.mark.xfail
-def test_brackets_alone():
-    text = get_indent_fix("def function():\n    print []\n")
-    assert text == "def function():\n    print []\n    ", repr(text)
-
-
 if __name__ == "__main__":
     pytest.main()
Repository: spyder-ide/spyder

Issue:
Error when reloading modules in the IPython Console in Python 2
A user reported in our mailing list:

I got the similar issue in Spyder 3.0.0 and even Spyder 3.0.1 after run the following code

``` python
import sys  
reload(sys)
```

The error code in internal console are as follows

``` python-traceback
>>> Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "C:\Anaconda\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply
    self.handle_exec_method(msg)
  File "C:\Anaconda\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 227, in handle_exec_method
    properties = ast.literal_eval(data['text/plain'])
KeyError: 'text/plain'
    handler(msg)
  File "C:\Anaconda\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply
    self.handle_exec_method(msg)
  File "C:\Anaconda\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 224, in handle_exec_method
    view = ast.literal_eval(data['text/plain'])
KeyError: 'text/plain'
```

---

@dalthviz, this is an easy one. Please add a verification before line 224 of `widgets/ipythonconsole/shell.py` to see if the dictionary `data` has a `'text/plain'` key. If that's not the case, please make `view` an empty dictionary :-)



Discussion:

Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py
--- a/spyder/widgets/ipythonconsole/shell.py
+++ b/spyder/widgets/ipythonconsole/shell.py
@@ -221,8 +221,11 @@ def handle_exec_method(self, msg):
                 reply = user_exp[expression]
                 data = reply.get('data')
                 if 'get_namespace_view' in method:
-                    view = ast.literal_eval(data['text/plain'])
-                    self.sig_namespace_view.emit(view)
+                    if 'text/plain' in data:
+                        view = ast.literal_eval(data['text/plain'])
+                        self.sig_namespace_view.emit(view)
+                    else:
+                        view = None
                 elif 'get_var_properties' in method:
                     properties = ast.literal_eval(data['text/plain'])
                     self.sig_var_properties.emit(properties)


Test patch:
Repository: spyder-ide/spyder

Issue:
Cannot press Enter after underscore in File Switcher
## Description of your problem

**What steps will reproduce the problem?**
1. Open a file with a `_` (underscore) character in the file name, e.g. `test_dataframeeditor.py`
2. Open the File Switcher (Ctrl-P)
3. Type `_`. The file name with the underscore character is selected.
4. Press Enter to switch to that file.
5. Nothing happens. The File Switcher does not close.

**What is the expected output? What do you see instead?**

Normally, when you press Enter, the File Switcher closes and the editor switches to the tab with the selected file. For some reason, this does not happen if the text typed into the File Switcher ends with an underscore.
## Versions and main components
- Spyder Version: 3.0.1
- Python Version: 3.5.2
- Operating system: Linux
## Dependencies

```
jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.3 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
numpy >=1.7      :  1.11.1 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
pep8 >=0.6       :  1.7.0 (OK)
psutil >=0.3     :  4.3.1 (OK)
pyflakes >=0.6.0 :  1.3.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.5.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
sympy >=0.7.3    :  1.0 (OK)
```



Discussion:
@dalthviz, this seems not that hard to solve, so please work on it :-)


Resolving patch:
diff --git a/spyder/widgets/fileswitcher.py b/spyder/widgets/fileswitcher.py
--- a/spyder/widgets/fileswitcher.py
+++ b/spyder/widgets/fileswitcher.py
@@ -237,7 +237,7 @@ def __init__(self, parent, tabs, data):
 
         # Either allow searching for a line number or a symbol but not both
         regex = QRegExp("([A-Za-z0-9_]{0,100}@[A-Za-z0-9_]{0,100})|" +
-                        "([A-Za-z]{0,100}:{0,1}[0-9]{0,100})")
+                        "([A-Za-z0-9_]{0,100}:{0,1}[0-9]{0,100})")
 
         # Widgets
         self.edit = QLineEdit(self)


Test patch:
Repository: spyder-ide/spyder

Issue:
Error when connecting to external kernels
qt 4.8.7 does not have this bug, but qt5.6 with mac will have

```
Spyder Internal Console

This console is used to report application
internal errors and to inspect Spyder
internals with the following commands:
  spy.app, spy.window, dir(spy)

Please don't use it to run your code

>>> WARNING:traitlets:kernel died: 3.0032799243927
Traceback (most recent call last):
  File "/Users/HWJ/anaconda3/lib/python3.5/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "/Users/HWJ/anaconda3/lib/python3.5/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 182, in _handle_execute_reply
    self.set_namespace_view_settings()
  File "/Users/HWJ/anaconda3/lib/python3.5/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 68, in set_namespace_view_settings
    settings = to_text_string(self.namespacebrowser.get_view_settings())
AttributeError: 'NoneType' object has no attribute 'get_view_settings'
```



Discussion:
This was fixed in Spyder 3.0.1, please update :-)

@ccordoba12 sorry but I was meeting this bug in spyder 3.0.1, please recheck it

But what code are trying to run when you get that message?

And for the next time, please don't dismiss the information we ask in our issue template :-) (like Spyder version, dependencies, etc)

@ccordoba12 , I was using anaconda, updated everything to the latest. I was just trying to connect to a remote kernel, and this error message came out. However, I can connect to a remote kernel using qt 4.8.7.

@fayeshine, were you trying to connect to a kernel through ssh?

@mariacamilaremolinagutierrez, an easy one for you :-) Please enclose these two lines

https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/ipythonconsole/namespacebrowser.py#L182-L183

inside an `if self.namespacebrowser is not None:` :-)


Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/namespacebrowser.py b/spyder/widgets/ipythonconsole/namespacebrowser.py
--- a/spyder/widgets/ipythonconsole/namespacebrowser.py
+++ b/spyder/widgets/ipythonconsole/namespacebrowser.py
@@ -179,8 +179,9 @@ def _handle_execute_reply(self, msg):
         # Refresh namespacebrowser after the kernel starts running
         exec_count = msg['content']['execution_count']
         if exec_count == 0 and self._kernel_is_starting:
-            self.set_namespace_view_settings()
-            self.refresh_namespacebrowser()
+            if self.namespacebrowser is not None:
+                self.set_namespace_view_settings()
+                self.refresh_namespacebrowser()
             self._kernel_is_starting = False
 
         # Handle silent execution of kernel methods


Test patch:
Repository: spyder-ide/spyder

Issue:
New release dialog is un-clickable
## Description

**What steps will reproduce the problem?**
1. Install the latest (windows) anaconda2 v4.2.9 with Spyder v3.0.0
2. Run Spyder.exe

**What is the expected output? What do you see instead?**
The "Spyder 3.0.1 is available!" QT pop-up that appears when spyder starts is un-clickable.  There are two links, "Releases", "Installation" as well as an "OK" button that all can't be clicked on.  The "X" button to kill the pop-up works fine.  

**Please provide any additional information below**
Interestingly, once the menu is clicked, the "tab" button can be used to tab to the "OK" button. The text inside the pop-up can't be highlighted.  
Windows10 Version 1607 (OS Build 14393.321)
Radeon Driver Packaging Version 16.40.2311-160916a-307101E
## Version and main components
- Spyder Version: 3.0.0 
- Python Version: 2.7.12
- Qt Versions: 5.6.0, PyQt5 5.6 on Windows
## Dependencies

```
pyflakes >=0.5.0 :  1.3.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
numpy >=1.7      :  1.11.1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
rope >=0.9.4     :  0.9.4 (OK)
jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.3 (OK)
sympy >=0.7.3    :  1.0 (OK)
pylint >=0.25    :  1.5.4 (OK)

```



Discussion:
Thanks for reporting. We already noticed it but we don't know why this is happening :-/

@malliwi88, could you work on this one please?

@mariacamilaremolinagutierrez, since we don't know where @malliwi88 is right now, I'm going to assign this one to you.

Please try to understand why the dialog is unclickable and solve this problem.


Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -2755,7 +2755,9 @@ def _check_updates_ready(self):
         box.set_checkbox_text(_("Check for updates on startup"))
         box.setStandardButtons(QMessageBox.Ok)
         box.setDefaultButton(QMessageBox.Ok)
-        box.setIcon(QMessageBox.Information)
+        #The next line is commented because it freezes the dialog.
+        #For now there is then no info icon. This solves issue #3609.
+        #box.setIcon(QMessageBox.Information)
 
         # Adjust the checkbox depending on the stored configuration
         section, option = 'main', 'check_updates_on_startup'


Test patch:
Repository: spyder-ide/spyder

Issue:
Autocompletion on Python consoles is crashing in master
@rlaverde 

Using tab key for completion on python console, I see this

![seleccion_012](https://cloud.githubusercontent.com/assets/5307894/19971674/b7d1756a-a1ad-11e6-949f-54aebc7725b5.png)

It's related with your lastest PR or Devs?


Discussion:
@rlaverde this is yours

yes, my fault, I introduced that error, It can't be assumed that editor will have `linenumber` attribute

I will revert that line to:
`point.setX(point.x()+self.textedit.get_linenumberarea_width())`

The long term solution should be to create a more general function that will return the total width of panels, and should call panels that have been register in the editor.

Yes, agreed!


Resolving patch:
diff --git a/spyder/widgets/sourcecode/base.py b/spyder/widgets/sourcecode/base.py
--- a/spyder/widgets/sourcecode/base.py
+++ b/spyder/widgets/sourcecode/base.py
@@ -103,7 +103,7 @@ def show_list(self, completion_list, automatic=True):
         screen_bottom = srect.bottom()
         
         point = self.textedit.cursorRect().bottomRight()
-        point.setX(point.x()+self.textedit.linenumberarea.get_width())
+        point.setX(point.x()+self.textedit.get_linenumberarea_width())
         point = self.textedit.mapToGlobal(point)
 
         # Computing completion widget and its parent right positions


Test patch:
Repository: spyder-ide/spyder

Issue:
Variable explorer should display the value of numpy.int64 variables
Execute
```
import numpy
j = numpy.int64(17)
```
.

Now `j` shows up in the variable explorer, but the Value column displays `class 'numpy.int64`. It should display the value `17` instead.

(My current environment is described in #3562.)



Discussion:
@dalthviz, an easy one for you. Please make that all numeric Numpy types appear in the Variable Explorer :-)


Resolving patch:
diff --git a/spyder/widgets/variableexplorer/utils.py b/spyder/widgets/variableexplorer/utils.py
--- a/spyder/widgets/variableexplorer/utils.py
+++ b/spyder/widgets/variableexplorer/utils.py
@@ -44,16 +44,19 @@ class FakeObject(object):
 
 
 #==============================================================================
-# Numpy arrays support
+# Numpy arrays and numeric types support
 #==============================================================================
 try:
-    from numpy import ndarray, array, matrix, recarray
+    from numpy import (ndarray, array, matrix, recarray,
+                      int64, int32, float64, float32,
+                      complex64, complex128)
     from numpy.ma import MaskedArray
     from numpy import savetxt as np_savetxt
     from numpy import set_printoptions as np_set_printoptions
 except ImportError:
     ndarray = array = matrix = recarray = MaskedArray = np_savetxt = \
-    np_set_printoptions = FakeObject
+    np_set_printoptions = int64 = int32 = float64 = float32 = \
+    complex64 = complex128 = FakeObject
 
 def get_numpy_dtype(obj):
     """Return NumPy data type associated to obj
@@ -244,6 +247,8 @@ def unsorted_unique(lista):
 def value_to_display(value, minmax=False):
     """Convert value for display purpose"""
     try:
+        numeric_numpy_types = (int64, int32, float64, float32,
+                               complex128, complex64)
         if isinstance(value, recarray):
             fields = value.names
             display = 'Field names: ' + ', '.join(fields)
@@ -288,7 +293,8 @@ def value_to_display(value, minmax=False):
         elif is_text_string(value):
             display = value
         elif isinstance(value, NUMERIC_TYPES) or isinstance(value, bool) or \
-          isinstance(value, datetime.date):
+          isinstance(value, datetime.date) or \
+          isinstance(value, numeric_numpy_types):
             display = repr(value)
         else:
             # Note: Don't trust on repr's. They can be inefficient and


Test patch:
Repository: spyder-ide/spyder

Issue:
Syntax highlighting of decorators
In many code editors and in the ipython qtconsole decorators are highlighted with a specific color but not in spyder editor. It would be nice if they were.



Discussion:
Another one for your, @rlaverde :-)


Resolving patch:
diff --git a/spyder/utils/syntaxhighlighters.py b/spyder/utils/syntaxhighlighters.py
--- a/spyder/utils/syntaxhighlighters.py
+++ b/spyder/utils/syntaxhighlighters.py
@@ -290,7 +290,7 @@ def make_python_patterns(additional_keywords=[], additional_builtins=[]):
     kw = r"\b" + any("keyword", kwlist) + r"\b"
     builtin = r"([^.'\"\\#]\b|^)" + any("builtin", builtinlist) + r"\b"
     comment = any("comment", [r"#[^\n]*"])
-    instance = any("instance", [r"\bself\b"])
+    instance = any("instance", [r"\bself\b",r"^\s*@[a-zA-Z.]*"])
     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:
Spyder won't start because of "ValueError: unknown locale: UTF-8" in macOS
 ##I cannot get my spyder app running.
## I installed IRAF yesterday and ever since spyder won't start when I type the command in the terminal.
##Here's a screenshot of what i get:
![screen shot 2016-10-31 at 7 10 42 pm](https://cloud.githubusercontent.com/assets/23175158/19865858/3b919612-9f9e-11e6-9c79-56b2d4748a23.png)



Discussion:
For now, please follow this advice:

http://pythonhosted.org/spyder/installation.html#id3

We'll fix this error for good in Spyder 3.1 :-)

@malliwi88, this one is easy. Please add a try/except here:

https://github.com/spyder-ide/spyder/blob/master/spyder/config/base.py#L268

and make `locale_language = DEFAULT_LANGUAGE` in the except part. 


Resolving patch:
diff --git a/spyder/config/base.py b/spyder/config/base.py
--- a/spyder/config/base.py
+++ b/spyder/config/base.py
@@ -265,7 +265,12 @@ def get_interface_language():
     2.) Spyder provides ('en',  'fr', 'es' and 'pt_BR'), if the locale is
     either 'pt' or 'pt_BR', this function will return 'pt_BR'
     """
-    locale_language = locale.getdefaultlocale()[0]
+
+    # Solves issue #3627
+    try:
+        locale_language = locale.getdefaultlocale()[0]
+    except ValueError:
+        locale_language = DEFAULT_LANGUAGE
 
     language = DEFAULT_LANGUAGE
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Search for backslash (\) sign
WinPython-32bit-3.4.4.2

When searching for a line continuation sign (\) it disappears from the find textbox when I try to go to the _next_ result. Going _backwards_ works fine.



Discussion:
The problem is within `add_current_text` function, which is called in `keyPressEvent` and `find_next`:

```
#\widgets\comboboxes.py:114
def add_current_text(self):
    """Add current text to combo box history (convenient method)"""
    text = self.currentText()
    if osp.isdir(text):
        if text[-1] == os.sep:
            text = text[:-1]
    self.add_text(text)
```

Maybe this can fix it? `if text[-1] == os.sep and len(text)>1:`

Thanks for looking into this one. I'll try to fix it for Spyder 3.0 beta4 :-)

I think we should completely remove the magic here, since it doesn't work in every case. If the user wants to search for a filename without a backslash at the end, he can remove it himself.

@rlaverde, please work on this one.

Should all the "magic" be removed, or just add a condition to avoid removing "\" or "/"?


Resolving patch:
diff --git a/spyder/widgets/comboboxes.py b/spyder/widgets/comboboxes.py
--- a/spyder/widgets/comboboxes.py
+++ b/spyder/widgets/comboboxes.py
@@ -114,9 +114,6 @@ def set_current_text(self, text):
     def add_current_text(self):
         """Add current text to combo box history (convenient method)"""
         text = self.currentText()
-        if osp.isdir(text):
-            if text[-1] == os.sep:
-                text = text[:-1]
         self.add_text(text)
 
     def add_current_text_if_valid(self):
@@ -272,6 +269,17 @@ def selected(self):
         self.valid.emit(True, True)
         self.open_dir.emit(self.selected_text)
 
+    def add_current_text(self):
+        """
+        Add current text to combo box history (convenient method).
+        If path ends in os separator ("\" windows, "/" unix) remove it.
+        """
+        text = self.currentText()
+        if osp.isdir(text) and text:
+            if text[-1] == os.sep:
+                text = text[:-1]
+        self.add_text(text)
+
 
 class UrlComboBox(PathComboBox):
     """


Test patch:
Repository: spyder-ide/spyder

Issue:
Don't replace text in the find widget if there's text there
During the Spyder 3.0 cycle someone added the functionality of automatically selecting the text under the cursor when you press `Ctrl+F` to launch a search.

That's very nice if there's no previous text in that widget, but a nightmare if there's already text some text in there. So we need to avoid this side effect while preserving the previous addition.


Discussion:

Resolving patch:
diff --git a/spyder/widgets/findreplace.py b/spyder/widgets/findreplace.py
--- a/spyder/widgets/findreplace.py
+++ b/spyder/widgets/findreplace.py
@@ -215,7 +215,7 @@ def show(self):
                     pass
 
             # Now that text value is sorted out, use it for the search
-            if text:
+            if text and not self.search_text.currentText():
                 self.search_text.setEditText(text)
                 self.search_text.lineEdit().selectAll()
                 self.refresh()


Test patch: