# Buggy code
def view(
    *images,
    title="napari",
    metadata=None,
    multichannel=None,
    contrast_limits_range=None,
    **named_images,
):
    """View one or more input images.

    Parameters
    ----------
    *images : ndarray
        Arrays to render as image layers.
    title : string, optional
        The title of the viewer window.
    meta : dictionary, optional
        A dictionary of metadata attributes. If multiple images are provided,
        the metadata applies to all of them.
    multichannel : bool, optional
        Whether to consider the last dimension of the image(s) as channels
        rather than spatial attributes. If not provided, napari will attempt
        to make an educated guess. If provided, and multiple images are given,
        the same value applies to all images.
    contrast_limits_range : list | array | None
        Length two list or array with the default color limit range for the
        image. If not passed will be calculated as the min and max of the
        image. Passing a value prevents this calculation which can be useful
        when working with very large datasets that are dynamically loaded.
        If provided, and multiple images are given, the same value applies to
        all images.
    **named_images : dict of str -> ndarray, optional
        Arrays to render as image layers, keyed by layer name.

    Returns
    -------
    viewer : napari.Viewer
        A Viewer widget displaying the images.

    Notes
    -----
    This convenience function is used to view one or few images with identical
    parameters (colormap etc). To customize each image layer, either use the
    :class:`napari.Viewer` class (preferred), or update the layers directly on
    the returned :class:`napari.Viewer` object.
    """
    viewer = Viewer(title=title)
    for image in images:
        viewer.add_image(
            image,
            metadata=metadata,
            multichannel=multichannel,
            contrast_limits_range=contrast_limits_range,
        )
    for name, image in named_images.items():
        viewer.add_image(
            image,
            metadata=metadata,
            multichannel=multichannel,
            contrast_limits_range=contrast_limits_range,
            name=name,
        )
    return viewer


# Traceback (ValueError)
WARNING: Traceback (most recent call last):
File "/Users/royer/workspace/python/pitl/pitl/it/demo/demo_it_n2s_gbm_2D_rgb.py", line 76, in <module>
demo(astronaut())
File "/Users/royer/workspace/python/pitl/pitl/it/demo/demo_it_n2s_gbm_2D_rgb.py", line 31, in demo
rescale_intensity(noisy, in_range='image', out_range=(0, 1)), name='noisy'
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/contextlib.py", line 119, in __exit__
next(self.gen)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/napari/_qt/event_loop.py", line 31, in gui_qt
app.exec_()
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/app/backends/_qt.py", line 501, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/app/backends/_qt.py", line 818, in paintGL
self._vispy_canvas.events.draw(region=None)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/util/event.py", line 455, in __call__
self._invoke_callback(cb, event)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/util/event.py", line 475, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/scene/canvas.py", line 217, in on_draw
self._draw_scene()
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/scene/canvas.py", line 266, in _draw_scene
self.draw_visual(self.scene)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/scene/canvas.py", line 304, in draw_visual
node.draw()
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/scene/visuals.py", line 99, in draw
self._visual_superclass.draw(self)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/visuals/visual.py", line 443, in draw
self._vshare.index_buffer)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/visuals/shaders/program.py", line 101, in draw
Program.draw(self, *args, **kwargs)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/program.py", line 533, in draw
canvas.context.flush_commands()
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/context.py", line 176, in flush_commands
self.glir.flush(self.shared.parser)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/glir.py", line 572, in flush
self._shared.flush(parser)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/glir.py", line 494, in flush
parser.parse(self._filter(self.clear(), parser))
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/glir.py", line 819, in parse
self._parse(command)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/glir.py", line 787, in _parse
ob.set_data(*args)
File "/Users/royer/anaconda3/envs/pitl/lib/python3.7/site-packages/vispy/gloo/glir.py", line 1537, in set_data
raise ValueError("Type %r not allowed for texture" % data.dtype)
ValueError: Type dtype('int64') not allowed for texture
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PySide2) at 0x128724438>> for DrawEvent
WARNING: Error drawing visual <Image at 0x133fde5f8>
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PySide2) at 0x128724438>> repeat 2

# Fixed code
def view(
    *images,
    title="napari",
    metadata=None,
    multichannel=None,
    contrast_limits=None,
    **named_images,
):
    """View one or more input images.
    Parameters
    ----------
    *images : ndarray
        Arrays to render as image layers.
    title : string, optional
        The title of the viewer window.
    meta : dictionary, optional
        A dictionary of metadata attributes. If multiple images are provided,
        the metadata applies to all of them.
    multichannel : bool, optional
        Whether to consider the last dimension of the image(s) as channels
        rather than spatial attributes. If not provided, napari will attempt
        to make an educated guess. If provided, and multiple images are given,
        the same value applies to all images.
    contrast_limits : list (2,)
        Color limits to be used for determining the colormap bounds for
        luminance images. If not passed is calculated as the min and max of
        the image. Passing a value prevents this calculation which can be useful
        when working with very large datasets that are dynamically loaded.
        If provided, and multiple images are given, the same value applies to
        all images.
    **named_images : dict of str -> ndarray, optional
        Arrays to render as image layers, keyed by layer name.
    Returns
    -------
    viewer : napari.Viewer
        A Viewer widget displaying the images.
    Notes
    -----
    This convenience function is used to view one or few images with identical
    parameters (colormap etc). To customize each image layer, either use the
    :class:`napari.Viewer` class (preferred), or update the layers directly on
    the returned :class:`napari.Viewer` object.
    """
    viewer = Viewer(title=title)
    for image in images:
        viewer.add_image(
            image,
            metadata=metadata,
            multichannel=multichannel,
            contrast_limits=contrast_limits,
        )
    for name, image in named_images.items():
        viewer.add_image(
            image,
            metadata=metadata,
            multichannel=multichannel,
            contrast_limits=contrast_limits,
            name=name,
        )
    return viewer