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

Issue:
Fix import in test_mainwindow after merge of #13828
* `from spyder.plugins.projects.api import EmptyProject` instead of `from spyder.plugins.projects.projecttypes import EmptyProject`
* Check if lines in `spyder/plugins/projects/plugin.py` are needed or not.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/projects/plugin.py b/spyder/plugins/projects/plugin.py
--- a/spyder/plugins/projects/plugin.py
+++ b/spyder/plugins/projects/plugin.py
@@ -396,7 +396,6 @@ def open_project(self, path=None, project=None, restart_consoles=True,
 
         self.current_active_project = project
         self.latest_project = project
-        self.notify_project_open(path)
         self.add_to_recent(path)
 
         self.set_option('current_project_path', self.get_active_project_path())


Test patch:
diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py
--- a/spyder/app/tests/test_mainwindow.py
+++ b/spyder/app/tests/test_mainwindow.py
@@ -54,7 +54,7 @@
 from spyder.plugins.help.widgets import ObjectComboBox
 from spyder.plugins.help.tests.test_plugin import check_text
 from spyder.plugins.ipythonconsole.utils.kernelspec import SpyderKernelSpec
-from spyder.plugins.projects.projecttypes import EmptyProject
+from spyder.plugins.projects.api import EmptyProject
 from spyder.plugins.run.widgets import RunConfiguration
 from spyder.py3compat import PY2, to_text_string
 from spyder.utils.programs import is_module_installed
Repository: spyder-ide/spyder

Issue:
Code analysis and profiler don't have shortcuts assigned
## Problem Description

Code analysis and profiler don't have shortcuts assigned
![Screen Shot 2020-07-30 at 11 57 04 PM](https://user-images.githubusercontent.com/18587879/89001666-7e230700-d2c0-11ea-81f5-5a8f17b9becd.png)

I suggest cmd+shift+R for profiler and cmd+shift+C for code analysis.


Discussion:
@dalthviz can you take a look at this one?

Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -365,6 +365,8 @@
               '_/switch to find_in_files': "Ctrl+Shift+F",
               '_/switch to explorer': "Ctrl+Shift+X",
               '_/switch to plots': "Ctrl+Shift+G",
+              '_/switch to pylint': "Ctrl+Shift+C",
+              '_/switch to profiler': "Ctrl+Shift+R",
               # -- In widgets/findreplace.py
               'find_replace/find text': "Ctrl+F",
               'find_replace/find next': "F3",


Test patch:
diff --git a/spyder/preferences/tests/test_shorcuts.py b/spyder/preferences/tests/test_shorcuts.py
--- a/spyder/preferences/tests/test_shorcuts.py
+++ b/spyder/preferences/tests/test_shorcuts.py
@@ -130,7 +130,7 @@ def test_shortcut_filtering_context(shortcut_table):
     shortcut_table.set_regex()
     # Verify the number of entries after the regex is 1
     # If a new shortcut is added to pylint, this needs to be changed
-    assert shortcut_table.model().rowCount() == 1
+    assert shortcut_table.model().rowCount() == 2
 
 
 # ---- Tests ShortcutEditor
Repository: spyder-ide/spyder

Issue:
TypeError: 'bool' object is not callable at Spyder startup
## Description

### What steps will reproduce the problem?

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

On startup Spyder, the following error is showed:

 File "C:\Users\renat\AppData\Roaming\Python\Python38\site-packages\spyder\app\mainwindow.py", line 995, in setup
    plugin = mod.PLUGIN_CLASS(self)
TypeError: 'bool' object is not callable


### Traceback
```python-traceback
  File "C:\Users\renat\AppData\Roaming\Python\Python38\site-packages\spyder\app\mainwindow.py", line 995, in setup
    plugin = mod.PLUGIN_CLASS(self)
TypeError: 'bool' object is not callable
```

## Versions

* Spyder version: 4.1.5 
* Python version: 3.8.6
* Qt version: 5.15.1
* PyQt5 version: 5.15.1
* Operating System: Windows 10

### Dependencies

```

# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  6.0.7 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  None (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.1 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.1 (OK)
qtconsole >=4.6.0              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  None (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.2 (OK)
numpy >=1.7                    :  1.19.2 (OK)
pandas >=0.13.1                :  1.1.3 (OK)
scipy >=0.17.0                 :  1.5.2 (OK)
sympy >=0.7.3                  :  None (OK)
```



Discussion:
Hi @RenatoWolf,

Have you tried to reset spyder's configuration to see if this fixes the problem?

```
spyder --reset
```

Please try it and let me know if this fixed your error

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -1034,7 +1034,9 @@ def create_edit_action(text, tr_text, icon):
 
                     dependencies.add(module, name, description,
                                      '', None, kind=dependencies.PLUGIN)
-
+            except TypeError:
+                # Fixes spyder-ide/spyder#13977
+                pass
             except Exception as error:
                 print("%s: %s" % (mod, str(error)), file=STDERR)
                 traceback.print_exc(file=STDERR)


Test patch:
Repository: spyder-ide/spyder

Issue:
Replace with | replace/find next | replace in selection | replace all
Hello!

The four "replace" in the replace box take too much space and force the editor to resize over 80 columns.

Replacing them with: "Replace w/", "/find next", "in selection" and "all" would save some space.
That would also enable to increase the size of the "replace string" QLineEdit which currently allows to display only the first 3 characters of the replacement string.
?
Thank you


Discussion:
i would like if u assign me on this issue 
Hi @mvillion this is a good point. Thanks for reporting this. I think we should not change the "Replace with" one but the other 3, we could change them for "Find next", "In selection" and "All". What is your thought on this @ccordoba12 ?

@TediaN97 thanks for offering to solve this. Once @ccordoba12 approves these changes, I'll assign you to this issue!
Here is a screenshot of the current replace box:
<img width="725" alt="Screenshot 2020-10-09 at 1 43 55 PM" src="https://user-images.githubusercontent.com/18587879/95620241-7b1d6300-0a35-11eb-92f1-6f54098adb4e.png">

> What is your thought on this @ccordoba12 ?

I agree, that's a very good suggestion @juanis2112! Let's implement those changes!

> @TediaN97 thanks for offering to solve this

Yeah, thanks a lot for that! Please don't forget to read our [Contributing guide](https://github.com/spyder-ide/spyder/blob/master/CONTRIBUTING.md) before getting started.

Resolving patch:
diff --git a/spyder/widgets/findreplace.py b/spyder/widgets/findreplace.py
--- a/spyder/widgets/findreplace.py
+++ b/spyder/widgets/findreplace.py
@@ -140,12 +140,12 @@ def __init__(self, parent, enable_replace=False):
         self.replace_text.valid.connect(
                     lambda _: self.replace_find(focus_replace_text=True))
         self.replace_button = create_toolbutton(self,
-                                     text=_('Replace/find next'),
+                                     text=_('Find next'),
                                      icon=ima.icon('DialogApplyButton'),
                                      triggered=self.replace_find,
                                      text_beside_icon=True)
         self.replace_sel_button = create_toolbutton(self,
-                                     text=_('Replace in selection'),
+                                     text=_('In selection'),
                                      icon=ima.icon('DialogApplyButton'),
                                      triggered=self.replace_find_selection,
                                      text_beside_icon=True)
@@ -153,7 +153,7 @@ def __init__(self, parent, enable_replace=False):
         self.replace_sel_button.clicked.connect(self.update_search_combo)
 
         self.replace_all_button = create_toolbutton(self,
-                                     text=_('Replace all'),
+                                     text=_('All'),
                                      icon=ima.icon('DialogApplyButton'),
                                      triggered=self.replace_find_all,
                                      text_beside_icon=True)


Test patch:
Repository: spyder-ide/spyder

Issue:
LSP Server Does Not Startup on macOS Application
## Problem Description
LSP server does not complete startup on macOS application

<img width="260" alt="Screen Shot 2020-11-03 at 8 31 56 PM" src="https://user-images.githubusercontent.com/9618975/98069438-a2d4d080-1e13-11eb-91b3-781cf299114c.png">

@ccordoba12, please assign to @mrclary

## 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: 4.2.0.dev0 0fe8907a73602c373be5b4c8d76cb6e173773951
* Python version: 3.8.6 64-bit
* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Darwin 19.6.0



Discussion:
It's probably an issue with Black (which is a dependency of pyls-black). I mention it because @dalthviz was seeing a similar problem with the Windows installer in PR #14059.

Resolving patch:
diff --git a/installers/macOS/setup.py b/installers/macOS/setup.py
--- a/installers/macOS/setup.py
+++ b/installers/macOS/setup.py
@@ -73,6 +73,10 @@ def make_app_bundle(dist_dir, make_lite=False):
     astroid :
         ImportError: cannot import name 'context' from 'astroid'
         (<path>/Resources/lib/python38.zip/astroid/__init__.pyc)
+    blib2to3 :
+        File "<frozen zipimport>", line 177, in get_data
+        KeyError: 'blib2to3/Users/rclary/Library/Caches/black/20.8b1/
+        Grammar3.8.6.final.0.pickle'
     ipykernel :
         ModuleNotFoundError: No module named 'ipykernel.datapub'
     ipython :
@@ -121,10 +125,10 @@ def make_app_bundle(dist_dir, make_lite=False):
     build_type = 'lite' if make_lite else 'full'
     logger.info('Creating %s app bundle...', build_type)
 
-    PACKAGES = ['alabaster', 'astroid', 'ipykernel', 'IPython', 'jedi',
-                'jinja2', 'keyring', 'parso', 'pygments', 'pyls', 'pyls_black',
-                'pyls_spyder', 'qtawesome', 'setuptools', 'sphinx', 'spyder',
-                'spyder_kernels']
+    PACKAGES = ['alabaster', 'astroid', 'blib2to3', 'ipykernel', 'IPython',
+                'jedi', 'jinja2', 'keyring', 'parso', 'pygments', 'pyls',
+                'pyls_black', 'pyls_spyder', 'qtawesome', 'setuptools',
+                'sphinx', 'spyder', 'spyder_kernels']
 
     if make_lite:
         INCLUDES = []
@@ -172,8 +176,10 @@ def make_app_bundle(dist_dir, make_lite=False):
     for dist in pkg_resources.working_set:
         if dist.egg_info is None:
             continue
-        dest = os.path.join(dest_dir, os.path.basename(dist.egg_info))
+        egg = os.path.basename(dist.egg_info)
+        dest = os.path.join(dest_dir, egg)
         shutil.copytree(dist.egg_info, dest)
+        logger.info(f'Copied {egg}')
 
     logger.info('App bundle complete.')
 


Test patch:
Repository: spyder-ide/spyder

Issue:
TypeError when getting text snippets
## Problem Description
The problem encountered by chance cannot be reproduced. It can be determined that the "sequence" is None under certain special circumstances.

![image](https://user-images.githubusercontent.com/1759365/98640830-b62cf200-2365-11eb-8d39-30bae45d4ab5.png)

## 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: 4.2.0
* Python version: 3.7.6
* Qt version: 5.12.9
* PyQt version: 5.12.3
* Operating System name/version: win10




Discussion:
I don't understand what you mean by this. Could you clarify it? 
Sorry, I understood it after seeing your screenshot. We'll fix it in our next version. 
I can confirm this issue. Not sure why it happens for me and @leavor, but for sure we are not alone, and as the bug window appear as soon as I start typing, it's a critical bug.

I propose a quick fix in #14185, that I suggest to be released as soon as possible.

Resolving patch:
diff --git a/spyder/plugins/completion/snippets/actor.py b/spyder/plugins/completion/snippets/actor.py
--- a/spyder/plugins/completion/snippets/actor.py
+++ b/spyder/plugins/completion/snippets/actor.py
@@ -87,6 +87,9 @@ def handle_msg(self, message):
             current_word = msg['current_word']
             snippets = []
 
+            if current_word is None:
+                return
+
             if language in self.language_snippets:
                 language_snippets = self.language_snippets[language]
                 if language_snippets[current_word]:


Test patch:
Repository: spyder-ide/spyder

Issue:
Improvements to the Windows installer
Some things we didn't have time to implement for 4.2.0, but that we'd like to have in our Windows installer are:

* Add a context menu entry to the Windows Explorer so that people can open files in Spyder directly from it.
* Add the [rtree wheel](https://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree) from Christoph Gohlke's unofficial wheels repository, so we can have code and text snippets in our Windows app. That's not part of our setup.py because there are no wheels available for that package and it's very hard to compile.


Discussion:
C Cordoba....what the hell have u guys done to spyder?????
its has been two months it all messed up
nothing works
have tried re-installing it...re-installing spyder kernels, and all the help on stackoverflow
nothing works

spyder doesnt just work at all

i want to throw it into dustbin

Resolving patch:
diff --git a/spyder/dependencies.py b/spyder/dependencies.py
--- a/spyder/dependencies.py
+++ b/spyder/dependencies.py
@@ -209,7 +209,7 @@
      'package_name': "rtree",
      'features': _("Fast access to code snippets regions"),
      'required_version': RTREE_REQVER,
-     'display': is_anaconda()},
+     'display': is_anaconda() or is_pynsist()},
     {'modname': "setuptools",
      'package_name': "setuptools",
      'features': _("Determine package version"),


Test patch:
Repository: spyder-ide/spyder

Issue:
Code Analysis output button and path handling on Windows
I found an error regarding the enable/disable behavior of the output button and the handling of the paths on Windows (seems like sometimes backslash and slash are being use for the path) which causes duplicate entries in the path combobox:

![pylint](https://user-images.githubusercontent.com/16781833/90265608-731bbb00-de18-11ea-816b-e4bf53a56152.gif)

Originally posted in https://github.com/spyder-ide/spyder/pull/12160#pullrequestreview-467673803


Discussion:

Resolving patch:
diff --git a/spyder/plugins/pylint/widgets/pylintgui.py b/spyder/plugins/pylint/widgets/pylintgui.py
--- a/spyder/plugins/pylint/widgets/pylintgui.py
+++ b/spyder/plugins/pylint/widgets/pylintgui.py
@@ -267,7 +267,7 @@ def get_filename(self):
     def set_filename(self, filename):
         """Set filename without performing code analysis."""
         filename = to_text_string(filename)  # filename is a QString instance
-
+        filename = osp.normpath(filename)  # Normalize path for Windows
         # Don't try to reload saved analysis for filename, if filename
         # is the one currently displayed.
         # Fixes spyder-ide/spyder#13347
@@ -323,6 +323,7 @@ def save_history(self):
             list_save_files = []
             for f in self.curr_filenames:
                 if _('untitled') not in f:
+                    filename = osp.normpath(f)
                     list_save_files.append(f)
             self.curr_filenames = list_save_files[:self.top_max_entries]
             self.parent.set_option('history_filenames', self.curr_filenames)


Test patch:
Repository: spyder-ide/spyder

Issue:
Apply asyncio patch for Tornado < 6.1
See https://github.com/ipython/ipykernel/pull/564 for the details.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/plugin.py b/spyder/plugins/ipythonconsole/plugin.py
--- a/spyder/plugins/ipythonconsole/plugin.py
+++ b/spyder/plugins/ipythonconsole/plugin.py
@@ -1589,19 +1589,22 @@ def show_quickref(self):
     #------ Private API -------------------------------------------------------
     def _init_asyncio_patch(self):
         """
-        Same workaround fix as https://github.com/ipython/ipykernel/pull/456
-        Set default asyncio policy to be compatible with tornado
-        Tornado 6 (at least) is not compatible with the default
-        asyncio implementation on Windows
-        Pick the older SelectorEventLoopPolicy on Windows
-        if the known-incompatible default policy is in use.
-        Do this as early as possible to make it a low priority and overrideable
-        ref: https://github.com/tornadoweb/tornado/issues/2608
-        FIXME: if/when tornado supports the defaults in asyncio,
-               remove and bump tornado requirement for py38
-        Based on: jupyter/qtconsole#406
+        - This was fixed in Tornado 6.1!
+        - Same workaround fix as ipython/ipykernel#564
+        - ref: tornadoweb/tornado#2608
+        - On Python 3.8+, Tornado 6.0 is not compatible with the default
+          asyncio implementation on Windows. Pick the older
+          SelectorEventLoopPolicy if the known-incompatible default policy is
+          in use.
+        - Do this as early as possible to make it a low priority and
+          overrideable.
         """
         if os.name == 'nt' and PY38_OR_MORE:
+            # Tests on Linux hang if we don't leave this import here.
+            import tornado
+            if tornado.version_info >= (6, 1):
+                return
+
             import asyncio
             try:
                 from asyncio import (


Test patch:
Repository: spyder-ide/spyder

Issue:
Make Pdb continuation prompt consistent
I don't know if there's some profound reason for this but it sure interferes with smooth text manipulation:

![image](https://user-images.githubusercontent.com/16495490/102801276-70386480-43ce-11eb-82cc-00d8b75a5b2b.png)

I can't `Shift + Arrow Up` or `NumLock: 7, 1`, or even simply `Arrow Up` (or any direction) consistently, always have to adjust for that first line differing from rest. Would help if they were all vertically aligned just like in Editor.


Discussion:
Hi @OverLordGoldDragon,

In which OS are you working on? I'm unable to reproduce this error, when I paste multiple lines in the iPython console I have the following view,

![image](https://user-images.githubusercontent.com/20992645/102815662-b673d080-439a-11eb-927a-41db00c065f4.png)

@steff456, the problem is with the `IPdb` prompt, not with the regular `In` one.

@OverLordGoldDragon, I also found this problem and tried to fix it for 4.2.1, but unfortunately I didn't have time to do it.

@impact27, could you give us a hand with it?

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/widgets/debugging.py b/spyder/plugins/ipythonconsole/widgets/debugging.py
--- a/spyder/plugins/ipythonconsole/widgets/debugging.py
+++ b/spyder/plugins/ipythonconsole/widgets/debugging.py
@@ -471,6 +471,10 @@ def _update_pdb_prompt(self, prompt, password=None):
             password = self._pdb_prompt[1]
         self._pdb_prompt = (prompt, password)
 
+        # Update continuation prompt to reflect (possibly) new prompt length.
+        self._set_continuation_prompt(
+            self._make_continuation_prompt(prompt), html=True)
+
     def _is_pdb_complete(self, source):
         """
         Check if the pdb input is ready to be executed.
@@ -505,7 +509,7 @@ def execute(self, source=None, hidden=False, interactive=False):
                     self.input_buffer = source
 
             if interactive:
-                # Add a continuation propt if not complete
+                # Add a continuation prompt if not complete
                 complete, indent = self._is_pdb_complete(source)
                 if not complete:
                     self.do_execute(source, complete, indent)


Test patch:
diff --git a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
--- a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
+++ b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
@@ -1532,7 +1532,7 @@ def test_pdb_multiline(ipyconsole, qtbot):
     qtbot.wait(500)
 
     assert shell.get_value('bb') == 10
-    assert "if True:\n   ...:     bb = 10\n" in control.toPlainText()
+    assert "if True:\n     ...:     bb = 10\n" in control.toPlainText()
 
 
 @flaky(max_runs=3)