prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  BUG `changing` event in `EventedDict` not emitted
  ## 🐛 Bug
  
  The `changing` event in [`EventedDict`](https://github.com/napari/napari/blob/8c307022cc557692409f5e8bc031f1dcde4c374a/napari/utils/events/containers/_evented_dict.py#L9) is created but not documented or emitted:
  
  https://github.com/napari/napari/blob/8c307022cc557692409f5e8bc031f1dcde4c374a/napari/utils/events/containers/_evented_dict.py#L75-L77
  
  It seems not to be missed, should it be added?
  
  <!-- A clear and concise description of what the bug is. -->
  
  
  
  </issue>
  <code>
  [start of napari/utils/events/containers/_evented_dict.py]
  1 """MutableMapping that emits events when altered."""
  2 from typing import Mapping, Optional, Sequence, Type, Union
  3 
  4 from napari.utils.events.containers._dict import _K, _T, TypedMutableMapping
  5 from napari.utils.events.event import EmitterGroup, Event
  6 from napari.utils.events.types import SupportsEvents
  7 
  8 
  9 class EventedDict(TypedMutableMapping[_K, _T]):
  10     """Mutable dictionary that emits events when altered.
  11 
  12     This class is designed to behave exactly like builtin ``dict``, but
  13     will emit events before and after all mutations (addition, removal, and
  14     changing).
  15 
  16     Parameters
  17     ----------
  18     data : Mapping, optional
  19         Dictionary to initialize the class with.
  20     basetype : type of sequence of types, optional
  21         Type of the element in the dictionary.
  22 
  23     Events
  24     ------
  25     changed (key: K, old_value: T, value: T)
  26         emitted when item at ``key`` is changed from ``old_value`` to ``value``
  27     adding (key: K)
  28         emitted before an item is added to the dictionary with ``key``
  29     added (key: K, value: T)
  30         emitted after ``value`` was added to the dictionary with ``key``
  31     removing (key: K)
  32         emitted before ``key`` is removed from the dictionary
  33     removed (key: K, value: T)
  34         emitted after ``key`` was removed from the dictionary
  35     updated (key, K, value: T)
  36         emitted after ``value`` of ``key`` was changed. Only implemented by
  37         subclasses to give them an option to trigger some update after ``value``
  38         was changed and this class did not register it. This can be useful if
  39         the ``basetype`` is not an evented object.
  40     """
  41 
  42     events: EmitterGroup
  43 
  44     def __init__(
  45         self,
  46         data: Optional[Mapping[_K, _T]] = None,
  47         basetype: Union[Type[_T], Sequence[Type[_T]]] = (),
  48     ) -> None:
  49         _events = {
  50             "changing": None,
  51             "changed": None,
  52             "adding": None,
  53             "added": None,
  54             "removing": None,
  55             "removed": None,
  56             "updated": None,
  57         }
  58         # For inheritance: If the mro already provides an EmitterGroup, add...
  59         if hasattr(self, "events") and isinstance(self.events, EmitterGroup):
  60             self.events.add(**_events)
  61         else:
  62             # otherwise create a new one
  63             self.events = EmitterGroup(
  64                 source=self, auto_connect=False, **_events
  65             )
  66         super().__init__(data, basetype)
  67 
  68     def __setitem__(self, key: _K, value: _T):
  69         old = self._dict.get(key)
  70         if value is old or value == old:
  71             return
  72         if old is None:
  73             self.events.adding(key=key)
  74             super().__setitem__(key, value)
  75             self.events.added(key=key, value=value)
  76             self._connect_child_emitters(value)
  77         else:
  78             super().__setitem__(key, value)
  79             self.events.changed(key=key, old_value=old, value=value)
  80 
  81     def __delitem__(self, key: _K):
  82         self.events.removing(key=key)
  83         self._disconnect_child_emitters(self[key])
  84         item = self._dict.pop(key)
  85         self.events.removed(key=key, value=item)
  86 
  87     def _reemit_child_event(self, event: Event):
  88         """An item in the dict emitted an event.  Re-emit with key"""
  89         if not hasattr(event, "key"):
  90             event.key = self.key(event.source)
  91 
  92         # re-emit with this object's EventEmitter
  93         self.events(event)
  94 
  95     def _disconnect_child_emitters(self, child: _T):
  96         """Disconnect all events from the child from the re-emitter."""
  97         if isinstance(child, SupportsEvents):
  98             child.events.disconnect(self._reemit_child_event)
  99 
  100     def _connect_child_emitters(self, child: _T):
  101         """Connect all events from the child to be re-emitted."""
  102         if isinstance(child, SupportsEvents):
  103             # make sure the event source has been set on the child
  104             if child.events.source is None:
  105                 child.events.source = child
  106             child.events.connect(self._reemit_child_event)
  107 
  108     def key(self, value: _T):
  109         """Return first instance of value."""
  110         for k, v in self._dict.items():
  111             if v is value or v == value:
  112                 return k
  113         return None
  114
  [end of napari/utils/events/containers/_evented_dict.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/napari/utils/events/containers/_evented_dict.py b/napari/utils/events/containers/_evented_dict.py
  --- a/napari/utils/events/containers/_evented_dict.py
  +++ b/napari/utils/events/containers/_evented_dict.py
  @@ -22,6 +22,8 @@
   
       Events
       ------
  +    changing (key: K)
  +        emitted before an item at ``key`` is changed
       changed (key: K, old_value: T, value: T)
           emitted when item at ``key`` is changed from ``old_value`` to ``value``
       adding (key: K)
  @@ -75,6 +77,7 @@
               self.events.added(key=key, value=value)
               self._connect_child_emitters(value)
           else:
  +            self.events.changing(key=key)
               super().__setitem__(key, value)
               self.events.changed(key=key, old_value=old, value=value)
  
verification_info: {"golden_diff": "diff --git a/napari/utils/events/containers/_evented_dict.py b/napari/utils/events/containers/_evented_dict.py\n--- a/napari/utils/events/containers/_evented_dict.py\n+++ b/napari/utils/events/containers/_evented_dict.py\n@@ -22,6 +22,8 @@\n \n     Events\n     ------\n+    changing (key: K)\n+        emitted before an item at ``key`` is changed\n     changed (key: K, old_value: T, value: T)\n         emitted when item at ``key`` is changed from ``old_value`` to ``value``\n     adding (key: K)\n@@ -75,6 +77,7 @@\n             self.events.added(key=key, value=value)\n             self._connect_child_emitters(value)\n         else:\n+            self.events.changing(key=key)\n             super().__setitem__(key, value)\n             self.events.changed(key=key, old_value=old, value=value)\n", "issue": "BUG `changing` event in `EventedDict` not emitted\n## \ud83d\udc1b Bug\r\n\r\nThe `changing` event in [`EventedDict`](https://github.com/napari/napari/blob/8c307022cc557692409f5e8bc031f1dcde4c374a/napari/utils/events/containers/_evented_dict.py#L9) is created but not documented or emitted:\r\n\r\nhttps://github.com/napari/napari/blob/8c307022cc557692409f5e8bc031f1dcde4c374a/napari/utils/events/containers/_evented_dict.py#L75-L77\r\n\r\nIt seems not to be missed, should it be added?\r\n\r\n<!-- A clear and concise description of what the bug is. -->\r\n\r\n\n", "before_files": [{"content": "\"\"\"MutableMapping that emits events when altered.\"\"\"\nfrom typing import Mapping, Optional, Sequence, Type, Union\n\nfrom napari.utils.events.containers._dict import _K, _T, TypedMutableMapping\nfrom napari.utils.events.event import EmitterGroup, Event\nfrom napari.utils.events.types import SupportsEvents\n\n\nclass EventedDict(TypedMutableMapping[_K, _T]):\n    \"\"\"Mutable dictionary that emits events when altered.\n\n    This class is designed to behave exactly like builtin ``dict``, but\n    will emit events before and after all mutations (addition, removal, and\n    changing).\n\n    Parameters\n    ----------\n    data : Mapping, optional\n        Dictionary to initialize the class with.\n    basetype : type of sequence of types, optional\n        Type of the element in the dictionary.\n\n    Events\n    ------\n    changed (key: K, old_value: T, value: T)\n        emitted when item at ``key`` is changed from ``old_value`` to ``value``\n    adding (key: K)\n        emitted before an item is added to the dictionary with ``key``\n    added (key: K, value: T)\n        emitted after ``value`` was added to the dictionary with ``key``\n    removing (key: K)\n        emitted before ``key`` is removed from the dictionary\n    removed (key: K, value: T)\n        emitted after ``key`` was removed from the dictionary\n    updated (key, K, value: T)\n        emitted after ``value`` of ``key`` was changed. Only implemented by\n        subclasses to give them an option to trigger some update after ``value``\n        was changed and this class did not register it. This can be useful if\n        the ``basetype`` is not an evented object.\n    \"\"\"\n\n    events: EmitterGroup\n\n    def __init__(\n        self,\n        data: Optional[Mapping[_K, _T]] = None,\n        basetype: Union[Type[_T], Sequence[Type[_T]]] = (),\n    ) -> None:\n        _events = {\n            \"changing\": None,\n            \"changed\": None,\n            \"adding\": None,\n            \"added\": None,\n            \"removing\": None,\n            \"removed\": None,\n            \"updated\": None,\n        }\n        # For inheritance: If the mro already provides an EmitterGroup, add...\n        if hasattr(self, \"events\") and isinstance(self.events, EmitterGroup):\n            self.events.add(**_events)\n        else:\n            # otherwise create a new one\n            self.events = EmitterGroup(\n                source=self, auto_connect=False, **_events\n            )\n        super().__init__(data, basetype)\n\n    def __setitem__(self, key: _K, value: _T):\n        old = self._dict.get(key)\n        if value is old or value == old:\n            return\n        if old is None:\n            self.events.adding(key=key)\n            super().__setitem__(key, value)\n            self.events.added(key=key, value=value)\n            self._connect_child_emitters(value)\n        else:\n            super().__setitem__(key, value)\n            self.events.changed(key=key, old_value=old, value=value)\n\n    def __delitem__(self, key: _K):\n        self.events.removing(key=key)\n        self._disconnect_child_emitters(self[key])\n        item = self._dict.pop(key)\n        self.events.removed(key=key, value=item)\n\n    def _reemit_child_event(self, event: Event):\n        \"\"\"An item in the dict emitted an event.  Re-emit with key\"\"\"\n        if not hasattr(event, \"key\"):\n            event.key = self.key(event.source)\n\n        # re-emit with this object's EventEmitter\n        self.events(event)\n\n    def _disconnect_child_emitters(self, child: _T):\n        \"\"\"Disconnect all events from the child from the re-emitter.\"\"\"\n        if isinstance(child, SupportsEvents):\n            child.events.disconnect(self._reemit_child_event)\n\n    def _connect_child_emitters(self, child: _T):\n        \"\"\"Connect all events from the child to be re-emitted.\"\"\"\n        if isinstance(child, SupportsEvents):\n            # make sure the event source has been set on the child\n            if child.events.source is None:\n                child.events.source = child\n            child.events.connect(self._reemit_child_event)\n\n    def key(self, value: _T):\n        \"\"\"Return first instance of value.\"\"\"\n        for k, v in self._dict.items():\n            if v is value or v == value:\n                return k\n        return None\n", "path": "napari/utils/events/containers/_evented_dict.py"}]}