fsspec/implementations/cached.py
def close_and_update(self, f, close):
        """Called when a file is closing, so store the set of blocks"""
        if f.closed:
            return
        path = self._strip_protocol(f.path)

        c = self.cached_files[-1][path]
        if c["blocks"] is not True and len(c["blocks"]) * f.blocksize >= f.size:
            c["blocks"] = True
        try:
            logger.debug("going to save")
            self.save_cache()
            logger.debug("saved")
        except (IOError, OSError):
            logger.debug("Cache saving failed while closing file")
        except NameError:
            logger.debug("Cache save failed due to interpreter shutdown")
        close()
        f.closed = True
Called when a file is closing, so store the set of blocks
Called when a file is closing, so store the set of blocks
Called when a file is closing so store the set of blocks
def close_and_update(self, f, close):
        if f.closed:
            return
        path = self._strip_protocol(f.path)
        c = self.cached_files[-1][path]
        if c["blocks"] is not True and len(c["blocks"]) * f.blocksize >= f.size:
            c["blocks"] = True
        try:
            logger.debug("going to save")
            self.save_cache()
            logger.debug("saved")
        except (IOError, OSError):
            logger.debug("Cache saving failed while closing file")
        except NameError:
            logger.debug("Cache save failed due to interpreter shutdown")
        close()
        f.closed = True
def close_and_update ( self , f , close ) : if f . closed : return path = self . _strip_protocol ( f . path ) c = self . cached_files [ - 1 ] [ path ] if c [ "blocks" ] is not True and len ( c [ "blocks" ] ) * f . blocksize >= f . size : c [ "blocks" ] = True try : logger . debug ( "going to save" ) self . save_cache ( ) logger . debug ( "saved" ) except ( IOError , OSError ) : logger . debug ( "Cache saving failed while closing file" ) except NameError : logger . debug ( "Cache save failed due to interpreter shutdown" ) close ( ) f . closed = True
Called when a file is closing, so store the set of blocks
Called when a file is closing so store the set of blocks
"""Called when a file is closing, so store the set of blocks"""
self
f
close