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

Issue:
napari now appears in installed plugins
## 🐛 Bug
with #3694, napari now appears in the plugins:

<img width="685" alt="Untitled" src="https://user-images.githubusercontent.com/1609449/146533435-d8dec63b-eb86-4929-bc78-f1a78bb55d15.png">

cc @ppwadhwa 


Discussion:

Resolving patch:
diff --git a/napari/_qt/dialogs/qt_plugin_dialog.py b/napari/_qt/dialogs/qt_plugin_dialog.py
--- a/napari/_qt/dialogs/qt_plugin_dialog.py
+++ b/napari/_qt/dialogs/qt_plugin_dialog.py
@@ -661,7 +661,7 @@ def _add_to_installed(distname, enabled, npe_version=1):
 
         for manifest in _npe2.iter_manifests():
             distname = normalized_name(manifest.name or '')
-            if distname in already_installed:
+            if distname in already_installed or distname == 'napari':
                 continue
             _add_to_installed(distname, True, npe_version=2)
 


Test patch:
Repository: napari/napari

Issue:
Shape edge width factor of 2
## 🐛 Bug

When programmatically adding a shape with a given edge width (e.g. 3) the added shape has the correct edge width (3 pixels). However upon selecting that shape, the edge slider in the controls takes the double of that value (6). Similarly if one manually adds a shape, the actual edge width is only half of the value indicated by the edge slider.
![edge_width2](https://user-images.githubusercontent.com/4622767/146749428-703ec382-0cc2-41a1-886b-ed75aca49141.gif)

## To Reproduce

```python
import napari
import numpy as np

new_shape = np.array([[50, 50], [50, 150], [150, 150], [150,50]])

viewer = napari.Viewer()
viewer.add_image(np.random.randint(0,255,(200,200), dtype=np.uint8))
viewer.add_shapes(data=new_shape, name='rois',edge_color='red', face_color=[0,0,0,0], edge_width=3)
```

## Expected behavior

Setting the edge width programmatically or manually should result in the same edge width. I think the factor of two seen from the edge slider should be suppressed: an edge width with value 1 should correspond to an edge width of 1 pixel.
 
## Environment
```
napari: 0.2.7.dev1441+g65d36183
Platform: macOS-10.15.7-x86_64-i386-64bit
System: MacOS 10.15.7
Python: 3.9.7 (default, Sep 16 2021, 08:50:36) [Clang 10.0.0 ]
Qt: 5.15.2
PyQt5: 5.15.6
NumPy: 1.21.5
SciPy: 1.7.3
Dask: 2021.12.0
VisPy: 0.9.4

OpenGL:
- GL version: 2.1 INTEL-14.7.20
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 1.0
- screen 2: resolution 1440x900, scale 2.0

Plugins:
- console: 0.0.4
- scikit-image: 0.2.7.dev1441+g65d36183
- svg: 0.1.5
```


Discussion:

Resolving patch:
diff --git a/napari/_qt/layer_controls/qt_shapes_controls.py b/napari/_qt/layer_controls/qt_shapes_controls.py
--- a/napari/_qt/layer_controls/qt_shapes_controls.py
+++ b/napari/_qt/layer_controls/qt_shapes_controls.py
@@ -385,7 +385,7 @@ def changeWidth(self, value):
         value : float
             Line width of shapes.
         """
-        self.layer.current_edge_width = float(value) / 2
+        self.layer.current_edge_width = float(value)
 
     def change_text_visibility(self, state):
         """Toggle the visibility of the text.
@@ -409,7 +409,7 @@ def _on_edge_width_change(self):
         """Receive layer model edge line width change event and update slider."""
         with self.layer.events.edge_width.blocker():
             value = self.layer.current_edge_width
-            value = np.clip(int(2 * value), 0, 40)
+            value = np.clip(int(value), 0, 40)
             self.widthSlider.setValue(value)
 
     def _on_current_edge_color_change(self):


Test patch:
Repository: napari/napari

Issue:
Surface layer control panel looks wrong
## 🐛 Bug

![image](https://user-images.githubusercontent.com/6531703/147324724-14e344ec-4495-4d26-8727-0f9c5bc315f5.png)

Something doesn't look right with the control panel in the top left for the surface layer. it looks like the continous button is now overlapping with the opacity slider. run `python examples/add_surface_2D.py` to see.

we should fix before next release
Surface layer control panel looks wrong
## 🐛 Bug

![image](https://user-images.githubusercontent.com/6531703/147324724-14e344ec-4495-4d26-8727-0f9c5bc315f5.png)

Something doesn't look right with the control panel in the top left for the surface layer. it looks like the continous button is now overlapping with the opacity slider. run `python examples/add_surface_2D.py` to see.

we should fix before next release


Discussion:

Resolving patch:
diff --git a/napari/_qt/layer_controls/qt_surface_controls.py b/napari/_qt/layer_controls/qt_surface_controls.py
--- a/napari/_qt/layer_controls/qt_surface_controls.py
+++ b/napari/_qt/layer_controls/qt_surface_controls.py
@@ -46,16 +46,18 @@ def __init__(self, layer):
         self.grid_layout.addWidget(self.opacitySlider, 0, 1)
         self.grid_layout.addWidget(QLabel(trans._('contrast limits:')), 1, 0)
         self.grid_layout.addWidget(self.contrastLimitsSlider, 1, 1)
-        self.grid_layout.addWidget(QLabel(trans._('gamma:')), 2, 0)
-        self.grid_layout.addWidget(self.gammaSlider, 2, 1)
-        self.grid_layout.addWidget(QLabel(trans._('colormap:')), 3, 0)
-        self.grid_layout.addLayout(colormap_layout, 3, 1)
-        self.grid_layout.addWidget(QLabel(trans._('blending:')), 4, 0)
-        self.grid_layout.addWidget(self.blendComboBox, 4, 1)
-        self.grid_layout.addWidget(QLabel(trans._('shading:')), 5, 0)
-        self.grid_layout.addWidget(self.shadingComboBox, 5, 1)
+        self.grid_layout.addWidget(QLabel(trans._('auto-contrast:')), 2, 0)
+        self.grid_layout.addWidget(self.autoScaleBar, 2, 1)
+        self.grid_layout.addWidget(QLabel(trans._('gamma:')), 3, 0)
+        self.grid_layout.addWidget(self.gammaSlider, 3, 1)
+        self.grid_layout.addWidget(QLabel(trans._('colormap:')), 4, 0)
+        self.grid_layout.addLayout(colormap_layout, 4, 1)
+        self.grid_layout.addWidget(QLabel(trans._('blending:')), 5, 0)
+        self.grid_layout.addWidget(self.blendComboBox, 5, 1)
+        self.grid_layout.addWidget(QLabel(trans._('shading:')), 6, 0)
+        self.grid_layout.addWidget(self.shadingComboBox, 6, 1)
 
-        self.grid_layout.setRowStretch(6, 1)
+        self.grid_layout.setRowStretch(7, 1)
         self.grid_layout.setColumnStretch(1, 1)
         self.grid_layout.setSpacing(4)
 


Test patch:
Repository: napari/napari

Issue:
missing doc items (may be copy-docs problem)
## 🐛 Bug

I was looking at napari.org after seeing #3916 get merged (a big update to plugin docs), and it looks like the toc is missing items. This seems to have something to do with the copy-docs script.

In particular, 
* it looks like files that are not in the toc are missing
* some items in the toc go missing
* the order of the items in the toc seems to change from the authored order

@tlambert03 please feel free to add detail



Discussion:
Looks like some links are broken too https://github.com/napari/napari/pull/3916#issuecomment-1011897037 - cc @guiwitz (and thanks for quick report!)
Sorry, I should have checked whether an issue had already been opened. On a more general point: the official plugin docs are now no more in sync with the latest napari release which is still incompatible with npe2. Is a there a plan to release soon a new version of napari? If not, it should probably be (temporarily) mentioned that one needs to install napari from main (but I haven't read the docs in detail so I might have missed it).
> Is a there a plan to release soon a new version of napari?

Yes, I think we can actually start the release process within next 24hrs and then release early next week. So things will probably be out of sync over weekend, but hopefully not too much longer. We could also add that note too in the mean time

Resolving patch:
diff --git a/docs/copy-docs.py b/docs/copy-docs.py
--- a/docs/copy-docs.py
+++ b/docs/copy-docs.py
@@ -54,6 +54,13 @@
     'glossary.md',  # this document will still be at the destination ToC
     'guides/stable/_layer_events.md',
     'guides/stable/_viewer_events.md',
+    'plugins/stable/_npe2_contributions.md',
+    'plugins/stable/_npe2_manifest.md',
+    'plugins/stable/_npe2_readers_guide.md',
+    'plugins/stable/_npe2_widgets_guide.md',
+    'plugins/stable/_npe2_writers_guide.md',
+    'plugins/stable/_npe2_sample_data_guide.md',
+    'plugins/stable/_layer_data_guide.md',
 ]
 
 


Test patch:
Repository: napari/napari

Issue:
Future warning when adding points
## 🐛 Bug
A Future warning is emitted from pandas when adding points via the GUI.

```python
<conda env>/site-packages/napari/layers/utils/layer_utils.py:821: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.!
```

![Screenshot 2022-01-17 at 12 45 40](https://user-images.githubusercontent.com/1120672/149769518-784b526d-4a06-416a-88d3-087da4ffa956.png)

## To Reproduce

Steps to reproduce the behavior:

1. Run the `add_points.py` example
2. Add a point via the GUI

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior
FutureWarning is not emitted

## Environment
napari: 0.4.13rc3
Platform: macOS-10.15.7-x86_64-i386-64bit
System: MacOS 10.15.7
Python: 3.8.12 (default, Oct 12 2021, 06:23:56) [Clang 10.0.0 ]
Qt: 5.15.2
PyQt5: 5.15.6
NumPy: 1.22.1
SciPy: 1.8.0rc2
Dask: 2022.01.0
VisPy: 0.9.4

OpenGL:
- GL version: 2.1 INTEL-14.7.20
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 2560x1440, scale 1.0
- screen 2: resolution 1440x900, scale 2.0

Plugins:
- console: 0.0.4
- scikit-image: 0.4.13rc3
- svg: 0.1.6




Discussion:

Resolving patch:
diff --git a/napari/layers/utils/layer_utils.py b/napari/layers/utils/layer_utils.py
--- a/napari/layers/utils/layer_utils.py
+++ b/napari/layers/utils/layer_utils.py
@@ -818,7 +818,7 @@ def append(self, to_append: pd.DataFrame) -> None:
         to_append : pd.DataFrame
             The features to append.
         """
-        self._values = self._values.append(to_append, ignore_index=True)
+        self._values = pd.concat([self._values, to_append], ignore_index=True)
 
     def remove(self, indices: Any) -> None:
         """Remove rows from this by index.


Test patch:
Repository: napari/napari

Issue:
The close button on dock widgets is gone, only hide is there
## 🐛 Bug
Not sure if it was intentional (maybe a miscommunication) or an oversight, but the x at the top left of dock widgets is gone.  I think we should go back to having an x icon (close the dock widget and destroy the instance).  a hide (eye) icon (hide the dock widget but don't destroy it).  and the icon that pops it out of the dock


Discussion:
Curious: if the x—destroy—function was there, would it be possible to test changes to plugin widgets (installed in editable mode) by relaunching the plugin/widget?
I've been relaunching napari...
this is more complicated.  The issue here is that once python imports a module, it will not reimport it (even if you've made changes to it) without specific "reload" instructions (https://docs.python.org/3/library/importlib.html#importlib.reload)

so, the answer to your question is "kinda sorta, depending on exactly how you set it up".  I would encourage you to familiarize yourself with IPython's autoreload magic.  Which will generally detect whether a module has changed its code, and reload accordingly:
https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html?highlight=autoreload

In some cases, this can even prevent you from needing to close the widget and reopen... but that is _very_ case specific, depending on exactly what methods you're calling, and what changes you're looking to see.  So it's hard to give a general "yeah/no that will/won't work"
@ppwadhwa, could you have a look at this?

Resolving patch:
diff --git a/napari/_qt/widgets/qt_viewer_dock_widget.py b/napari/_qt/widgets/qt_viewer_dock_widget.py
--- a/napari/_qt/widgets/qt_viewer_dock_widget.py
+++ b/napari/_qt/widgets/qt_viewer_dock_widget.py
@@ -301,10 +301,9 @@ def __init__(self, parent, title: str = '', vertical=False):
         try:
             # if the plugins menu is already created, check to see if this is a plugin
             # dock widget.  If it is, then add the close button option to the title bar.
-            actions = [
-                action.text()
-                for action in self.parent()._qt_viewer.viewer.window.plugins_menu.actions()
-            ]
+            win = self.parent().parent()._qt_viewer.viewer.window
+            actions = [action.text() for action in win.plugins_menu.actions()]
+
             if self.parent().name in actions:
                 add_close = True
                 self.close_button = QPushButton(self)


Test patch:
Repository: napari/napari

Issue:
points layer ignores symbol 
## 🐛 Bug

Constructing a points layer with a non-disc marker symbol currently results in the default (disc) marker being used instead.

## To Reproduce

```python

import numpy as np
import napari

data = np.array([[0,0],[4,4],[8,8]])

napari.view_points(data, symbol='ring')

```

<img width="260" alt="img" src="https://user-images.githubusercontent.com/11042162/152258845-53a6320f-9301-4418-ac0b-012bf4f495d6.png">

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->


## Environment

Happens in napari `0.4.13` on both MacOS and Linux. 

Git blame points to commit b5405402a where the following supposedly important line got removed:

https://github.com/napari/napari/blob/9af23fb0ddd8b9804edc84d534095a00b697c41c/napari/_vispy/layers/points.py#L62

So I think it might be an easy fix e.g. for @brisvag,  @alisterburt, et al 





Discussion:

Resolving patch:
diff --git a/napari/_vispy/layers/points.py b/napari/_vispy/layers/points.py
--- a/napari/_vispy/layers/points.py
+++ b/napari/_vispy/layers/points.py
@@ -188,9 +188,8 @@ def _on_canvas_size_limits_change(self):
     def reset(self):
         super().reset()
         self._update_text(update_node=False)
-        self._on_blending_change()
+        self._on_symbol_change()
         self._on_highlight_change()
-        self._on_matrix_change()
         self._on_antialias_change()
         self._on_shading_change()
         self._on_canvas_size_limits_change()


Test patch:
Repository: napari/napari

Issue:
Duplicate layers created from a napari plugin throws TypeError
**Describe the bug**

When I try to duplicate in napari a layer created from a napari dock widget it currently fails due to some properties being non pickleable.


**To Reproduce**

Create a little callback in napari:

```python
import napari
import numpy as np
from magicgui import magicgui
from napari.layers import Image, Labels
from copy import deepcopy

@magicgui
def callback() -> Image:
    return Image(np.zeros((128,128), np.uint16))


v = napari.Viewer()

dock_widget = v.window.add_dock_widget(callback, area='right')
```

then hit run and try to Duplicate the layer from the GUI results in 

`>>> TypeError: cannot pickle 'module' object`


The reasons seems to be some magicgui related properties that cannot be deepcopied/pickled

```
from copy import deepcopy 

deepcopy(deepcopy(v.layers[0]._source.widget.__magicgui_app__))

>>> TypeError: cannot pickle 'module' object

```

**Environment (please complete the following information):**
```
napari: 0.4.13
Platform: macOS-12.0.1-arm64-arm-64bit
System: MacOS 12.0.1
magicgui: 0.3.3
```


Discussion:
Thanks!

Resolving patch:
diff --git a/napari/layers/_source.py b/napari/layers/_source.py
--- a/napari/layers/_source.py
+++ b/napari/layers/_source.py
@@ -33,6 +33,15 @@ class Config:
         arbitrary_types_allowed = True
         frozen = True
 
+    def __deepcopy__(self, memo):
+        """Custom deepcopy implementation.
+
+        this prevents deep copy. `Source` doesn't really need to be copied
+        (i.e. if we deepcopy a layer, it essentially has the same `Source`).
+        Moreover, deepcopying a widget is challenging, and maybe odd anyway.
+        """
+        return self
+
 
 # layer source context management
 


Test patch:
Repository: napari/napari

Issue:
Previously selected point deleted when deleting layer
## 🐛 Bug

Recently selected points are erroneously removed when deleting new layers with the delete key. (reproduced with points and labels layer)

## To Reproduce

Steps to reproduce the behaviour:

1. Create a point on a points layer
2. Create a new points layer
3. Select the newly created points layer from the layer list (visually deselecting the point)
4. Delete newly created layer using the delete key, the last selected point will also be deleted

Please note that this issue does not occur when the layer is deleted using the bin icon, leading me to believe it is a keybinding issue (and the point must still be 'selected' in come capacity)
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->


https://user-images.githubusercontent.com/95660545/156966137-b2a645a6-25ae-42b4-baf7-137e7506e20a.mp4


## Expected behaviour
It is expected that only the newly created points layer (with no points assigned to it) should be deleted, not the point as well.

<!-- A clear and concise description of what you expected to happen. -->

## Environment

napari: 0.4.15.dev68+gdd3a2afd
Platform: Windows-10-10.0.19044-SP0
Python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.6
NumPy: 1.21.5
SciPy: 1.7.3
Dask: 2022.01.0
VisPy: 0.9.6

OpenGL:
- GL version: 4.6.0 - Build 26.20.100.7372
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 1.0

Plugins:
- console: 0.0.4
- scikit-image: 0.4.15.dev68+gdd3a2afd
- svg: 0.1.6

napari contributors (2019). napari: a multi-dimensional image viewer for python. doi:10.5281/zenodo.3555620



Discussion:
Wowza! That's indeed very surprising behaviour! :joy: thanks for reporting it @jamesyan-git!

Resolving patch:
diff --git a/napari/_qt/containers/qt_layer_list.py b/napari/_qt/containers/qt_layer_list.py
--- a/napari/_qt/containers/qt_layer_list.py
+++ b/napari/_qt/containers/qt_layer_list.py
@@ -53,7 +53,7 @@ def __init__(self, root: LayerList, parent: QWidget = None):
 
     def keyPressEvent(self, e: QKeyEvent) -> None:
         """Override Qt event to pass events to the viewer."""
-        if e.key() != Qt.Key_Space:
+        if e.key() != Qt.Key.Key_Space:
             super().keyPressEvent(e)
-
-        e.ignore()  # pass key events up to viewer
+        if e.key() not in (Qt.Key.Key_Backspace, Qt.Key.Key_Delete):
+            e.ignore()  # pass key events up to viewer


Test patch:
Repository: napari/napari

Issue:
'napari._vispy.layers.image' is not a package
## Activating experimental rendering features causes persistent ModuleNotFoundError

Recently, I discovered the two "experimental" features designed to enhance viewer performance with asynchronous rendering. After checking both options in Preferences (under Experimental), the GUI prompted a restart. When attempting to relaunch Napari, the following error is thrown: `ModuleNotFoundError: No module named 'napari._vispy.layers.image.experimental'; 'napari._vispy.layers.image' is not a package`. I tried recreating my virtual environment, installing a different version of Napari, using the `--no-cache-dir` flag with pip to ensure that the installation process did not use cached files...but every new installation of Napari now throws this error.

## To Reproduce

Steps to reproduce the behavior:

1. Check both experimental rendering options under File/Preferences/Experimental
2. Restart Napari



Discussion:
> I tried recreating my virtual environment, installing a different version of Napari, using the --no-cache-dir flag with pip to ensure that the installation process did not use cached files...but every new installation of Napari now throws this error.

sorry for the trouble!  napari stores settings outside of the site-packages folder (e.g. `~/Library/ApplicationSupport/Napari/` for mac)  you can run `napari --reset` to reset settings to their defaults.  Let us know if that helps (with the annoyance).  Looks like there might be an actual bug though with the import?
Wow that was a quick fix! Thanks for the tip.

Yes not sure about the import. I think the program is looking for the "octree_image.py" file in the wrong "image" directory, as the the "_vispy" directory does not contain an "image/experimental/" sub-directory...May be worth some investigation 🙂
yep, can reproduce thanks.  Will add a fix

Resolving patch:
diff --git a/napari/_vispy/utils/visual.py b/napari/_vispy/utils/visual.py
--- a/napari/_vispy/utils/visual.py
+++ b/napari/_vispy/utils/visual.py
@@ -36,8 +36,8 @@
 
 
 if async_octree:
-    from ..layers.image.experimental.octree_image import _OctreeImageBase
-    from .experimental.vispy_tiled_image_layer import VispyTiledImageLayer
+    from ...layers.image.experimental.octree_image import _OctreeImageBase
+    from ..experimental.vispy_tiled_image_layer import VispyTiledImageLayer
 
     # Insert _OctreeImageBase in front so it gets picked over plain Image.
     new_mapping = {_OctreeImageBase: VispyTiledImageLayer}


Test patch:
Repository: napari/napari

Issue:
Conda workflow on windows is failing
## 🐛 Bug

Error:
```
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 
'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpccpy1cvs'
```
https://github.com/napari/napari/runs/6002914512?check_suite_focus=true

## To Reproduce

1. PRs opened are failing
2. See https://github.com/napari/napari/runs/6002914512?check_suite_focus=true

## Expected behavior

CI should run




Discussion:

Resolving patch:
diff --git a/bundle_conda.py b/bundle_conda.py
--- a/bundle_conda.py
+++ b/bundle_conda.py
@@ -328,7 +328,10 @@ def main(extra_specs=None):
         _constructor(extra_specs=extra_specs)
     finally:
         for path in clean_these_files:
-            os.unlink(path)
+            try:
+                os.unlink(path)
+            except OSError:
+                print("! Could not remove", path)
     assert Path(OUTPUT_FILENAME).exists()
     return OUTPUT_FILENAME
 


Test patch: