lib/imageio/core/request.py
def finish(self):
        """ finish()
        For internal use (called when the context of the reader/writer
        exits). Finishes this request. Close open files and process
        results.
        """
        
        # Init
        bytes = None
        
        # Collect bytes from temp file
        if self.mode[0] == 'w' and self._filename_local:
            with open(self._filename_local, 'rb') as file:
                bytes = file.read()
        
        # Collect bytes from BytesIO file object.
        written = (self.mode[0] == 'w') and self._file
        if written and self._uri_type in [URI_BYTES, URI_ZIPPED]:
            bytes = self._file.getvalue()
        
        # Close open files that we know of (and are responsible for)
        if self._file and self._uri_type != URI_FILE:
            self._file.close()
            self._file = None
        if self._zipfile:
            self._zipfile.close()
            self._zipfile = None
        # Remove temp file
        if self._filename_local:
            try:
                os.remove(self._filename_local)
            except Exception:  # pragma: no cover
                pass
            self._filename_local = None
        
        # Handle bytes that we collected
        if bytes is not None:
            if self._uri_type == URI_BYTES:
                self._result = bytes  # Picked up by imread function
            elif self._uri_type == URI_ZIPPED:
                zf = zipfile.ZipFile(self._filename_zip[0], 'a')
                zf.writestr(self._filename_zip[1], bytes)
                zf.close()
        
        # Detach so gc can clean even if a reference of self lingers
        self._bytes = None
 finish()
        For internal use (called when the context of the reader/writer
        exits). Finishes this request. Close open files and process
        results.
        
finish()
For internal use (called when the context of the reader/writer
exits). Finishes this request. Close open files and process
results.
finish () For internal use ( called when the context of the reader / writer exits ) . Finishes this request . Close open files and process results .
def finish(self):
        bytes = None
        if self.mode[0] == 'w' and self._filename_local:
            with open(self._filename_local, 'rb') as file:
                bytes = file.read()
        written = (self.mode[0] == 'w') and self._file
        if written and self._uri_type in [URI_BYTES, URI_ZIPPED]:
            bytes = self._file.getvalue()
        if self._file and self._uri_type != URI_FILE:
            self._file.close()
            self._file = None
        if self._zipfile:
            self._zipfile.close()
            self._zipfile = None
        if self._filename_local:
            try:
                os.remove(self._filename_local)
            except Exception:  
                pass
            self._filename_local = None
        if bytes is not None:
            if self._uri_type == URI_BYTES:
                self._result = bytes  
            elif self._uri_type == URI_ZIPPED:
                zf = zipfile.ZipFile(self._filename_zip[0], 'a')
                zf.writestr(self._filename_zip[1], bytes)
                zf.close()
        self._bytes = None
def finish ( self ) : bytes = None if self . mode [ 0 ] == 'w' and self . _filename_local : with open ( self . _filename_local , 'rb' ) as file : bytes = file . read ( ) written = ( self . mode [ 0 ] == 'w' ) and self . _file if written and self . _uri_type in [ URI_BYTES , URI_ZIPPED ] : bytes = self . _file . getvalue ( ) if self . _file and self . _uri_type != URI_FILE : self . _file . close ( ) self . _file = None if self . _zipfile : self . _zipfile . close ( ) self . _zipfile = None if self . _filename_local : try : os . remove ( self . _filename_local ) except Exception : pass self . _filename_local = None if bytes is not None : if self . _uri_type == URI_BYTES : self . _result = bytes elif self . _uri_type == URI_ZIPPED : zf = zipfile . ZipFile ( self . _filename_zip [ 0 ] , 'a' ) zf . writestr ( self . _filename_zip [ 1 ] , bytes ) zf . close ( ) self . _bytes = None
finish()
For internal use (called when the context of the reader/writer
exits).
finish () For internal use ( called when the context of the reader / writer exits ) .
""" finish()
        For internal use (called when the context of the reader/writer
        exits). Finishes this request. Close open files and process
        results.
        """ # Init # Collect bytes from temp file # Collect bytes from BytesIO file object. # Close open files that we know of (and are responsible for) # Remove temp file # pragma: no cover # Handle bytes that we collected # Picked up by imread function # Detach so gc can clean even if a reference of self lingers
self