def file_chunks(self, fp):
        """Yields chunks of a file.

        Parameters
        ----------
        fp : io.RawIOBase
            The file to break into chunks
            (must be an open file or have the ``readinto`` method)
        """
        fsize = utils.file_size(fp)
        offset = 0
        if hasattr(fp, 'readinto'):
            while offset < fsize:
                nb = fp.readinto(self._internal)
                yield self.buf[:nb]
                offset += nb
        else:
            while offset < fsize:
                nb = min(self.chunk_size, fsize - offset)
                yield fp.read(nb)
                offset += nb
def file_chunks ( self , fp ) : fsize = utils . file_size ( fp ) offset = 0 if hasattr ( fp , 'readinto' ) : while offset < fsize : nb = fp . readinto ( self . _internal ) yield self . buf [ : nb ] offset += nb else : while offset < fsize : nb = min ( self . chunk_size , fsize - offset ) yield fp . read ( nb ) offset += nb
Yields chunks of a file.

        Parameters
        ----------
        fp : io.RawIOBase
            The file to break into chunks
            (must be an open file or have the ``readinto`` method)