(fsrc, fdst, length=COPY_BUFSIZE)
readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
readinto () / memoryview () based variant of copyfileobj () . * fsrc * must support readinto () method and both files must be open in binary mode .
def _copyfileobj_readinto(fsrc, fdst, length=COPY_BUFSIZE):
    """readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    """
    # Localize variable access to minimize overhead.
    fsrc_readinto = fsrc.readinto
    fdst_write = fdst.write
    with memoryview(bytearray(length)) as mv:
        while True:
            n = fsrc_readinto(mv)
            if not n:
                break
            elif n < length:
                with mv[:n] as smv:
                    fdst.write(smv)
            else:
                fdst_write(mv)
def _copyfileobj_readinto ( fsrc , fdst , length = COPY_BUFSIZE ) : # Localize variable access to minimize overhead. fsrc_readinto = fsrc . readinto fdst_write = fdst . write with memoryview ( bytearray ( length ) ) as mv : while True : n = fsrc_readinto ( mv ) if not n : break elif n < length : with mv [ : n ] as smv : fdst . write ( smv ) else : fdst_write ( mv )