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

Issue:
File associations applications are added more than one time in context  menu
## Problem Description

Every time that I click over "Open with" in the context menu of the files pane in a file that has an associated application, it adds the element to the list so the Applications appear several times.

<img width="1440" alt="Screenshot 2021-04-28 at 8 39 05 PM" src="https://user-images.githubusercontent.com/18587879/116492585-3be42180-a862-11eb-9a1a-69a85b63fc1c.png">


Discussion:

Resolving patch:
diff --git a/spyder/plugins/explorer/widgets/explorer.py b/spyder/plugins/explorer/widgets/explorer.py
--- a/spyder/plugins/explorer/widgets/explorer.py
+++ b/spyder/plugins/explorer/widgets/explorer.py
@@ -661,7 +661,7 @@ def update_actions(self):
             if len(assoc) >= 1:
                 actions = self._create_file_associations_actions()
                 self.open_with_submenu.menuAction().setVisible(True)
-                self.open_with_submenu.clear()
+                self.open_with_submenu.clear_actions()
                 for action in actions:
                     self.add_item_to_menu(
                         action,


Test patch:
Repository: spyder-ide/spyder

Issue:
Plots DPI Scaling setting keeps reversing
### What steps will reproduce the problem?

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

Using 4K resolution with graphics set to automatic.  Matplotlib windows are generated at a very small size.  

If I change resolution in 
Preferences->IPYthon console->Graphics->resolution

to much larger value e.g. 200 DPI, the matplotlib plots are readable and look good.  

However, when I close spyder and reopen it, despite the setting still being 200dpi, all matplotlib windows are again displayed at a very small scale.  Current fix is to change 200 to 70, click apply, change 70 to 200, click apply.  <-- every time I open spyder




Discussion:
Hi @some-guy1, thanks for reporting. Can you let me know which version of Spyder are you using and what OS do you use?
Oh ya sorry.

* Spyder version: 5.1.1 None
* Python version: 3.9.6 64-bit
* Qt version: 5.12.10
* PyQt5 version: 5.12.3
* Operating System: Windows 10
@juanis2112 @some-guy1 I was able to reproduce this :+1:

Just in case @some-guy1 for the workaround you can also change the value from 200 to 199 and again to 200 and then click `Apply` and/or `Ok`


Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/widgets/main_widget.py b/spyder/plugins/ipythonconsole/widgets/main_widget.py
--- a/spyder/plugins/ipythonconsole/widgets/main_widget.py
+++ b/spyder/plugins/ipythonconsole/widgets/main_widget.py
@@ -808,9 +808,15 @@ def change_clients_pdb_use_exclamation_mark(self, value):
     @on_conf_change(option=[
         'symbolic_math', 'hide_cmd_windows',
         'startup/run_lines', 'startup/use_run_file', 'startup/run_file',
-        'pylab', 'pylab/backend'])
-    def change_possible_restart_conf(self, option, value):
-        """Apply options that possibly require a kernel restart."""
+        'pylab', 'pylab/backend', 'pylab/autoload',
+        'pylab/inline/figure_format', 'pylab/inline/resolution',
+        'pylab/inline/width', 'pylab/inline/height',
+        'pylab/inline/bbox_inches'])
+    def change_possible_restart_and_mpl_conf(self, option, value):
+        """
+        Apply options that possibly require a kernel restart or related to
+        Matplotlib inline backend options.
+        """
         # Check that we are not triggering validations in the initial
         # notification sent when Spyder is starting or when another option
         # already required a restart and the restart dialog was shown


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
@@ -2225,7 +2225,7 @@ def test_restart_intertactive_backend(ipyconsole):
     backend in preferences.
     """
     main_widget = ipyconsole.get_widget()
-    main_widget.change_possible_restart_conf('pylab/backend', 3)
+    main_widget.change_possible_restart_and_mpl_conf('pylab/backend', 3)
     assert bool(os.environ.get('BACKEND_REQUIRE_RESTART'))
Repository: spyder-ide/spyder

Issue:
Check usage of `pytest-timeout` to prevent some tests from hanging the CI 
See https://pypi.org/project/pytest-timeout/


Discussion:
I agree this is important to avoid the many hangs we're having in CIs lately.
Note: Maybe the script used for the debian package to retry the tests suit if something fails could be useful too: https://salsa.debian.org/science-team/spyder/-/blob/master/debian/tests/run_pytest.py

Resolving patch:
diff --git a/runtests.py b/runtests.py
--- a/runtests.py
+++ b/runtests.py
@@ -33,7 +33,7 @@ def run_pytest(run_slow=False, extra_args=None):
     """Run pytest tests for Spyder."""
     # Be sure to ignore subrepos
     pytest_args = ['-vv', '-rw', '--durations=10', '--ignore=./external-deps',
-                   '-W ignore::UserWarning']
+                   '-W ignore::UserWarning', '--timeout=120']
 
     if CI:
         # Exit on first failure and show coverage
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -269,6 +269,7 @@ def run(self):
         'pytest-mock',
         'pytest-order',
         'pytest-qt',
+        'pytest-timeout',
         'pyyaml',
         'scipy',
         'sympy',


Test patch:
diff --git a/requirements/tests.txt b/requirements/tests.txt
--- a/requirements/tests.txt
+++ b/requirements/tests.txt
@@ -14,6 +14,7 @@ pytest-lazy-fixture
 pytest-mock
 pytest-order
 pytest-qt
+pytest-timeout
 pyyaml
 scipy
 sympy
Repository: spyder-ide/spyder

Issue:
Small bugs in kernel update error screen
Issue is raised in #17353 with updating spyder-kernel in custom environments.

Putting aside the fact that Anaconda doesn't have that version of spyder-kernels yet... there are still two small bugs here on the error screen. 

Firstly, if the required version is 2.2.1, then the error should say 2.2.1 needs installing (not 2.2). Installing 2.2 as suggested still results in the same error which coud be confusing for the user.

Secondly the dash in ``conda install spyder‑kernels=2.2`` doesn't copy in to a Windows terminal correctly (displays a question mark inside a box). A font issue?


Discussion:
Hey @Caseyb87, thanks for reporting. You said:

> Firstly, if the required version is 2.2.1, then the error should say 2.2.1 needs installing (not 2.2). Installing 2.2 as suggested still results in the same error which coud be confusing for the user.

It clearly says so (look at the third line):

![image](https://user-images.githubusercontent.com/88217916/156491010-de81edd9-361c-4f20-a9d7-fd5496c1913f.png)

I know the command is

    conda install spyder‑kernels=2.2

not

    conda install spyder‑kernels=2.2.1

as you suggest, but that's necessary to install any `2.2` version (i.e. 2.2.0, 2.2.1, 2.2.2, etc). compatible with the current Spyder one. In this case, `2.2.0` should be compatible with Spyder 5.2.2, but we had to increase that requirement to fix some serious bugs with Matplotlib.

At the end, I'd say this problem has more to do with Anaconda than Spyder, because it takes them a really long time to update Spyder and spyder-kernels. So `2.2.0` is already available, but then `2.2.1` was released more than a month ago and it hasn't been uploaded yet. We know that's a huge inconvenience for our users, but we can't do anything about it because it's up to them really.

> Secondly the dash in conda install spyder‑kernels=2.2 doesn't copy in to a Windows terminal correctly (displays a question mark inside a box). A font issue?

No, that's an escaped html dash (not the one you get with your keyboard), so we can display it correctly in that message. I didn't know people was copy/pasting directly to their console. We'll see what we can do about it.
@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/widgets/main_widget.py b/spyder/plugins/ipythonconsole/widgets/main_widget.py
--- a/spyder/plugins/ipythonconsole/widgets/main_widget.py
+++ b/spyder/plugins/ipythonconsole/widgets/main_widget.py
@@ -65,9 +65,9 @@
     '>= {0} and < {1}').format(
         SPYDER_KERNELS_MIN_VERSION, SPYDER_KERNELS_MAX_VERSION)
 SPYDER_KERNELS_CONDA = (
-    f'conda install spyder-kernels={SPYDER_KERNELS_MIN_VERSION[:-2]}')
+    f'conda install spyder&#45;kernels={SPYDER_KERNELS_MIN_VERSION[:-2]}')
 SPYDER_KERNELS_PIP = (
-    f'pip install spyder-kernels=={SPYDER_KERNELS_MIN_VERSION[:-1]}*')
+    f'pip install spyder&#45;kernels=={SPYDER_KERNELS_MIN_VERSION[:-1]}*')
 
 
 class IPythonConsoleWidgetActions:


Test patch:
Repository: spyder-ide/spyder

Issue:
`test_leaks` is failing on master
After merging PR #18781 our tests started to fail on master because `test_leaks` is not giving the expected results.

@impact27, could you take a look at that? Thanks!


Discussion:

Resolving patch:
diff --git a/spyder/plugins/framesexplorer/widgets/main_widget.py b/spyder/plugins/framesexplorer/widgets/main_widget.py
--- a/spyder/plugins/framesexplorer/widgets/main_widget.py
+++ b/spyder/plugins/framesexplorer/widgets/main_widget.py
@@ -277,6 +277,7 @@ def close_widget(self, widget):
             "set_pdb_stack", None)
 
         widget.close()
+        widget.setParent(None)
 
     # ---- Public API
     # ------------------------------------------------------------------------


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
@@ -536,6 +536,7 @@ def test_single_instance_and_edit_magic(main_window, qtbot, tmpdir):
 
 @pytest.mark.slow
 @pytest.mark.use_introspection
+@pytest.mark.skipif(True, reason="Fails on master. TODO: close leftover leak")
 def test_leaks(main_window, qtbot):
     """
     Test leaks in mainwindow when closing a file or a console.
Repository: spyder-ide/spyder

Issue:
Console looses focus while typing debugging commands on it
When debugging on the latest master, the console looses focus. To reproduce:
`%debug print()`
`s`
`s`
Every time the debugger is interacted with, the focus is stolen by the editor.


Discussion:
I found the `Maintain focus in the editor` option to solve the issue
But it is a bit strange that by default, if I type something in the debugger, the focus goes to the editor and doesn't stay in the console

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
@@ -198,7 +198,7 @@ def __init__(self, *args, **kwargs):
         self._pdb_prompt = (None, None)  # prompt, password
         self._pdb_last_cmd = ''  # last command sent to pdb
         self._pdb_frame_loc = (None, None)  # fname, lineno
-        self._pdb_focus_to_editor = True  # Focus to editor after command
+        self._pdb_focus_to_editor = False  # Focus to editor after command
                                           # execution
         # Command queue
         self._pdb_input_queue = []  # List of (code, hidden, echo_stack_entry)
diff --git a/spyder/plugins/ipythonconsole/widgets/main_widget.py b/spyder/plugins/ipythonconsole/widgets/main_widget.py
--- a/spyder/plugins/ipythonconsole/widgets/main_widget.py
+++ b/spyder/plugins/ipythonconsole/widgets/main_widget.py
@@ -2167,7 +2167,10 @@ def pdb_has_stopped(self, fname, lineno, shellwidget):
             fname, lineno, '', False)
 
         # Give focus to console if requested
-        if not shellwidget._pdb_focus_to_editor:
+        if shellwidget._pdb_focus_to_editor:
+            # Next focus to editor was enabled
+            shellwidget._pdb_focus_to_editor = False
+        else:
             self.activateWindow()
             shellwidget._control.setFocus()
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Layout is broken sometimes when many consoles are open
## Problem Description

When I started to work on PR #19068, I noticed that sometimes the layout is not preserved correctly when Spyder is closed. This means that it looks like this when it's started again

![image](https://user-images.githubusercontent.com/365293/185014063-656ba6a9-fec9-4a09-bb12-e7c0a635716c.png)

### What steps reproduce the problem?

1. Open many consoles in Spyder
2. Close Spyder
3. Open Spyder again and notice that the layout is broken 

### What is the expected output? What do you see instead?

The layout is preserved in the next session.



Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/widgets/main_widget.py b/spyder/plugins/ipythonconsole/widgets/main_widget.py
--- a/spyder/plugins/ipythonconsole/widgets/main_widget.py
+++ b/spyder/plugins/ipythonconsole/widgets/main_widget.py
@@ -1938,13 +1938,20 @@ def close_all_clients(self):
         bool
             If the closing action was succesful.
         """
-        while self.clients:
-            client = self.clients.pop()
-            is_last_client = len(self.get_related_clients(client)) == 0
+        # IMPORTANT: **Do not** change this way of closing clients, which uses
+        # a copy of `self.clients`, because it preserves the main window layout
+        # when Spyder is closed.
+        # Fixes spyder-ide/spyder#19084
+        open_clients = self.clients.copy()
+        for client in self.clients:
+            is_last_client = (
+                len(self.get_related_clients(client, open_clients)) == 0)
             client.close_client(is_last_client)
+            open_clients.remove(client)
 
         # Close all closing shellwidgets.
         ShellWidget.wait_all_shutdown()
+
         # Close cached kernel
         self.close_cached_kernel()
         self.filenames = []


Test patch:
Repository: spyder-ide/spyder

Issue:
Release Spyder 5.3.3
An issue to follow up Spyder 5.3.3 release.

New dependencies or version requirements updates:

* Spyder-kernels to 2.3.3:
    * [x] Make release
* QtConsole to 5.3.2:
    * [x] https://github.com/spyder-ide/spyder/pull/18439



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -239,7 +239,7 @@ def run(self):
     'rtree>=0.9.7',
     'setuptools>=49.6.0',
     'sphinx>=0.6.6',
-    'spyder-kernels>=2.3.2,<2.4.0',
+    'spyder-kernels>=2.3.3,<2.4.0',
     'textdistance>=4.2.0',
     'three-merge>=0.1.1',
     'watchdog>=0.10.3'
@@ -252,7 +252,7 @@ def run(self):
                         if req.split(">")[0] not in reqs_to_loosen]
     install_requires.append('python-lsp-server[all]>=1.5.0,<1.7.0')
     install_requires.append('qtconsole>=5.3.2,<5.5.0')
-    install_requires.append('spyder-kernels>=2.3.2,<2.5.0')
+    install_requires.append('spyder-kernels>=2.3.3,<2.5.0')
 
 extras_require = {
     'test:platform_system == "Windows"': ['pywin32'],
diff --git a/spyder/config/base.py b/spyder/config/base.py
--- a/spyder/config/base.py
+++ b/spyder/config/base.py
@@ -67,7 +67,7 @@ def running_in_ci():
 
 def running_in_ci_with_conda():
     """Return True if currently running under CI with conda packages."""
-    return running_in_ci() and bool(os.environ.get('USE_CONDA'))
+    return running_in_ci() and os.environ.get('USE_CONDA', None) == 'true'
 
 
 def is_stable_version(version):
diff --git a/spyder/dependencies.py b/spyder/dependencies.py
--- a/spyder/dependencies.py
+++ b/spyder/dependencies.py
@@ -65,7 +65,7 @@
 RTREE_REQVER = '>=0.9.7'
 SETUPTOOLS_REQVER = '>=49.6.0'
 SPHINX_REQVER = '>=0.6.6'
-SPYDER_KERNELS_REQVER = '>=2.3.2;<2.4.0'
+SPYDER_KERNELS_REQVER = '>=2.3.3;<2.4.0'
 TEXTDISTANCE_REQVER = '>=4.2.0'
 THREE_MERGE_REQVER = '>=0.1.1'
 # None for pynsist install for now


Test patch:
diff --git a/spyder/plugins/editor/widgets/tests/test_introspection.py b/spyder/plugins/editor/widgets/tests/test_introspection.py
--- a/spyder/plugins/editor/widgets/tests/test_introspection.py
+++ b/spyder/plugins/editor/widgets/tests/test_introspection.py
@@ -21,7 +21,7 @@
 from qtpy.QtGui import QTextCursor
 
 # Local imports
-from spyder.config.base import running_in_ci
+from spyder.config.base import running_in_ci, running_in_ci_with_conda
 from spyder.config.utils import is_anaconda
 from spyder.plugins.completion.api import (
     CompletionRequestTypes, CompletionItemKind)
@@ -1166,7 +1166,7 @@ def spam():
 @pytest.mark.slow
 @pytest.mark.order(1)
 @pytest.mark.skipif(not is_anaconda(), reason='Requires conda to be installed')
-@pytest.mark.skipif(not running_in_ci(), reason='Run tests only on CI.')
+@pytest.mark.skipif(not running_in_ci_with_conda(), reason='Run tests only on CI with conda.')
 @pytest.mark.skipif(running_in_ci() and sys.platform.startswith('linux'),
                     reason="Quite flaky with Linux on CI")
 @pytest.mark.skipif(running_in_ci() and sys.platform == 'darwin',
Repository: spyder-ide/spyder

Issue:
Unable to launch Spyder from `bootstrap.py` on Windows
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

## Problem Description

A traceback appears when launching Spyder from `bootstrap.py`. This happened to me will try to check locally https://github.com/spyder-ide/spyder/pull/19855

Seems like is related with the subprocess that calls git to check the branch info. ~I guess on Windows instead of `"/usr/bin/env"` we need to use `"cmd.exe"` or something similar?~

Edit:

Just in case, seems like on Windows something like the following works:

```python
result = subprocess.run(
        ["git.cmd", "merge-base", "--fork-point", "master"], shell=True
    )
```

### What steps reproduce the problem?

Try to run Spyder from the `bootstrap.py` script on Windows

### What is the expected output? What do you see instead?

Spyder launching, instead a traceback

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

Traceback (most recent call last):
  File "E:\Acer\Documentos\Spyder\Spyder otros\carlos\spyder\bootstrap.py", line 83, in <module>
    result = subprocess.run(
  File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado


```




Discussion:
yes same issue, seems to be introduced by @mrclary

Author:			Ryan Clary <9618975+mrclary@users.noreply.github.com>
Date:			2 days ago (15-10-22 00:24:04)
Commit hash:	ac6d16b010386849ee121cb5096be0fbad477d08
Child:			0198e709
Parent:			50ca5f7f


Resolving patch:
diff --git a/bootstrap.py b/bootstrap.py
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -81,7 +81,7 @@
         prev_branch = boot_branch_file.read_text()
 
     result = subprocess.run(
-        ["/usr/bin/env", "git", "merge-base", "--fork-point", "master"]
+        ["git", "merge-base", "--fork-point", "master"]
     )
     branch = "master" if result.stdout else "not master"
     boot_branch_file.write_text(branch)


Test patch:
Repository: spyder-ide/spyder

Issue:
Release Spyder 5.4.1
An issue to follow up Spyder 5.4.1 release.

New dependencies or version requirements updates:

* [x] `spyder-kernels` to 2.4.1 (pending release)
    * [x] Support for `ipython` 8.x
* [x] `python-lsp-server` to 1.7.0 (pending release)
* [x] Remove restriction on Numpy being less than 1.23 for the Windows installer


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -229,7 +229,7 @@ def run(self):
     'pyls-spyder>=0.4.0',
     'pyqt5<5.16',
     'pyqtwebengine<5.16',
-    'python-lsp-server[all]>=1.6.0,<1.7.0',
+    'python-lsp-server[all]>=1.7.0,<1.8.0',
     'pyxdg>=0.26;platform_system=="Linux"',
     'pyzmq>=22.1.0',
     'qdarkstyle>=3.0.2,<3.1.0',
@@ -240,7 +240,7 @@ def run(self):
     'rtree>=0.9.7',
     'setuptools>=49.6.0',
     'sphinx>=0.6.6',
-    'spyder-kernels>=2.4.0,<2.5.0',
+    'spyder-kernels>=2.4.1,<2.5.0',
     'textdistance>=4.2.0',
     'three-merge>=0.1.1',
     'watchdog>=0.10.3'
@@ -251,9 +251,9 @@ def run(self):
     reqs_to_loosen = {'python-lsp-server[all]', 'qtconsole', 'spyder-kernels'}
     install_requires = [req for req in install_requires
                         if req.split(">")[0] not in reqs_to_loosen]
-    install_requires.append('python-lsp-server[all]>=1.6.0,<1.8.0')
+    install_requires.append('python-lsp-server[all]>=1.7.0,<1.9.0')
     install_requires.append('qtconsole>=5.4.0,<5.6.0')
-    install_requires.append('spyder-kernels>=2.4.0,<2.6.0')
+    install_requires.append('spyder-kernels>=2.4.1,<2.6.0')
 
 extras_require = {
     'test:platform_system == "Windows"': ['pywin32'],
diff --git a/spyder/dependencies.py b/spyder/dependencies.py
--- a/spyder/dependencies.py
+++ b/spyder/dependencies.py
@@ -53,7 +53,7 @@
 PYGMENTS_REQVER = '>=2.0'
 PYLINT_REQVER = '>=2.5.0;<3.0'
 PYLINT_VENV_REQVER = '>=2.1.1'
-PYLSP_REQVER = '>=1.6.0;<1.7.0'
+PYLSP_REQVER = '>=1.7.0;<1.8.0'
 PYLSP_BLACK_REQVER = '>=1.2.0'
 PYLS_SPYDER_REQVER = '>=0.4.0'
 PYXDG_REQVER = '>=0.26'
@@ -66,7 +66,7 @@
 RTREE_REQVER = '>=0.9.7'
 SETUPTOOLS_REQVER = '>=49.6.0'
 SPHINX_REQVER = '>=0.6.6'
-SPYDER_KERNELS_REQVER = '>=2.4.0;<2.5.0'
+SPYDER_KERNELS_REQVER = '>=2.4.1;<2.5.0'
 TEXTDISTANCE_REQVER = '>=4.2.0'
 THREE_MERGE_REQVER = '>=0.1.1'
 # None for pynsist install for now


Test patch: