prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  ListModel.append does not check type
  ## 🐛 Bug
  in working on layer groups, I found a strange lack of type checking when appending to a `ListModel` (which inherits from `TypedList`).  [`ListModel.append`](https://github.com/napari/napari/blob/59ed366e9d492a2389c451468fd8b9f96508b4e2/napari/utils/list/_model.py#L59)  jumps right over `TypedList.append`
  https://github.com/napari/napari/blob/59ed366e9d492a2389c451468fd8b9f96508b4e2/napari/utils/list/_model.py#L58-L60
  
  ... and if you try to something that is not a `Layer` to a `LayerList`, it works fine up until throwing an error (unrelated to typing) in `components.layerlist._add`.  Is that supposed to be `TypedList.append(self, obj)`?  or was that intentional?
  
  </issue>
  <code>
  [start of napari/utils/list/_model.py]
  1 from ...utils.event import EmitterGroup
  2 
  3 from ._multi import MultiIndexList
  4 from ._typed import TypedList
  5 
  6 
  7 class ListModel(MultiIndexList, TypedList):
  8     """List with events, tuple-indexing, typing, and filtering.
  9 
  10     Parameters
  11     ----------
  12     basetype : type
  13         Type of the elements in the list.
  14     iterable : iterable, optional
  15         Elements to initialize the list with.
  16     lookup : dict of type : function(object, ``basetype``) -> bool
  17         Functions that determine if an object is a reference to an
  18         element of the list.
  19 
  20     Attributes
  21     ----------
  22     events : vispy.util.event.EmitterGroup
  23         Group of events for adding, removing, and reordering elements
  24         within the list.
  25     """
  26 
  27     def __init__(self, basetype, iterable=(), lookup=None):
  28         super().__init__(basetype, iterable, lookup)
  29         self.events = EmitterGroup(
  30             source=self,
  31             auto_connect=True,
  32             added=None,
  33             removed=None,
  34             reordered=None,
  35             changed=None,
  36         )
  37         self.events.added.connect(self.events.changed)
  38         self.events.removed.connect(self.events.changed)
  39         self.events.reordered.connect(self.events.changed)
  40 
  41     def __setitem__(self, query, values):
  42         indices = tuple(self.__prsitem__(query))
  43         new_indices = tuple(values)
  44 
  45         if sorted(indices) != sorted(self.index(v) for v in new_indices):
  46             raise TypeError(
  47                 'must be a reordering of indices; '
  48                 'setting of list items not allowed'
  49             )
  50 
  51         super().__setitem__(indices, new_indices)
  52         self.events.reordered()
  53 
  54     def insert(self, index, obj):
  55         super().insert(index, obj)
  56         self.events.added(item=obj, index=self.__locitem__(index))
  57 
  58     def append(self, obj):
  59         super(TypedList, self).append(obj)
  60         self.events.added(item=obj, index=len(self) - 1)
  61 
  62     def pop(self, key):
  63         obj = super().pop(key)
  64         self.events.removed(item=obj, index=key)
  65         return obj
  66
  [end of napari/utils/list/_model.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/list/_model.py b/napari/utils/list/_model.py
  --- a/napari/utils/list/_model.py
  +++ b/napari/utils/list/_model.py
  @@ -56,7 +56,7 @@
           self.events.added(item=obj, index=self.__locitem__(index))
   
       def append(self, obj):
  -        super(TypedList, self).append(obj)
  +        TypedList.append(self, obj)
           self.events.added(item=obj, index=len(self) - 1)
   
       def pop(self, key):
  
verification_info: {"golden_diff": "diff --git a/napari/utils/list/_model.py b/napari/utils/list/_model.py\n--- a/napari/utils/list/_model.py\n+++ b/napari/utils/list/_model.py\n@@ -56,7 +56,7 @@\n         self.events.added(item=obj, index=self.__locitem__(index))\n \n     def append(self, obj):\n-        super(TypedList, self).append(obj)\n+        TypedList.append(self, obj)\n         self.events.added(item=obj, index=len(self) - 1)\n \n     def pop(self, key):\n", "issue": "ListModel.append does not check type\n## \ud83d\udc1b Bug\r\nin working on layer groups, I found a strange lack of type checking when appending to a `ListModel` (which inherits from `TypedList`).  [`ListModel.append`](https://github.com/napari/napari/blob/59ed366e9d492a2389c451468fd8b9f96508b4e2/napari/utils/list/_model.py#L59)  jumps right over `TypedList.append`\r\nhttps://github.com/napari/napari/blob/59ed366e9d492a2389c451468fd8b9f96508b4e2/napari/utils/list/_model.py#L58-L60\r\n\r\n... and if you try to something that is not a `Layer` to a `LayerList`, it works fine up until throwing an error (unrelated to typing) in `components.layerlist._add`.  Is that supposed to be `TypedList.append(self, obj)`?  or was that intentional?\n", "before_files": [{"content": "from ...utils.event import EmitterGroup\n\nfrom ._multi import MultiIndexList\nfrom ._typed import TypedList\n\n\nclass ListModel(MultiIndexList, TypedList):\n    \"\"\"List with events, tuple-indexing, typing, and filtering.\n\n    Parameters\n    ----------\n    basetype : type\n        Type of the elements in the list.\n    iterable : iterable, optional\n        Elements to initialize the list with.\n    lookup : dict of type : function(object, ``basetype``) -> bool\n        Functions that determine if an object is a reference to an\n        element of the list.\n\n    Attributes\n    ----------\n    events : vispy.util.event.EmitterGroup\n        Group of events for adding, removing, and reordering elements\n        within the list.\n    \"\"\"\n\n    def __init__(self, basetype, iterable=(), lookup=None):\n        super().__init__(basetype, iterable, lookup)\n        self.events = EmitterGroup(\n            source=self,\n            auto_connect=True,\n            added=None,\n            removed=None,\n            reordered=None,\n            changed=None,\n        )\n        self.events.added.connect(self.events.changed)\n        self.events.removed.connect(self.events.changed)\n        self.events.reordered.connect(self.events.changed)\n\n    def __setitem__(self, query, values):\n        indices = tuple(self.__prsitem__(query))\n        new_indices = tuple(values)\n\n        if sorted(indices) != sorted(self.index(v) for v in new_indices):\n            raise TypeError(\n                'must be a reordering of indices; '\n                'setting of list items not allowed'\n            )\n\n        super().__setitem__(indices, new_indices)\n        self.events.reordered()\n\n    def insert(self, index, obj):\n        super().insert(index, obj)\n        self.events.added(item=obj, index=self.__locitem__(index))\n\n    def append(self, obj):\n        super(TypedList, self).append(obj)\n        self.events.added(item=obj, index=len(self) - 1)\n\n    def pop(self, key):\n        obj = super().pop(key)\n        self.events.removed(item=obj, index=key)\n        return obj\n", "path": "napari/utils/list/_model.py"}]}