@staticmethod
    def zip_loader(filename, **kwargs):
        '''Read images from an zip file.

        .. versionadded:: 1.0.8

        Returns an Image with a list of type ImageData stored in Image._data
        '''
        # read zip in menory for faster access
        _file = BytesIO(open(filename, 'rb').read())
        # read all images inside the zip
        z = zipfile.ZipFile(_file)
        image_data = []
        # sort filename list
        znamelist = z.namelist()
        znamelist.sort()
        image = None
        for zfilename in znamelist:
            try:
                #read file and store it in mem with fileIO struct around it
                tmpfile = BytesIO(z.read(zfilename))
                ext = zfilename.split('.')[-1].lower()
                im = None
                for loader in ImageLoader.loaders:
                    if (ext not in loader.extensions()
                        or not loader.can_load_memory()):
                        continue
                    Logger.debug('Image%s: Load <%s> from <%s>' %
                                 (loader.__name__[11:], zfilename, filename))
                    try:
                        im = loader(zfilename, ext=ext, rawdata=tmpfile,
                                    inline=True, **kwargs)
                    except:
                        # Loader failed, continue trying.
                        continue
                    break
                if im is not None:
                    # append ImageData to local variable before it's
                    # overwritten
                    image_data.append(im._data[0])
                    image = im
                #else: if not image file skip to next
            except:
                Logger.warning('Image: Unable to load image'
                               '<%s> in zip <%s> trying to continue...'
                               % (zfilename, filename))
        z.close()
        if len(image_data) == 0:
            raise Exception('no images in zip <%s>' % filename)
        # replace Image.Data with the array of all the images in the zip
        image._data = image_data
        image.filename = filename
        return image
dataset/ETHPy150Open kivy/kivy/kivy/core/image/__init__.py/ImageLoader.zip_loader/original