(fpin)
return None
Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record.
Return data from the "End of Central Directory" record, or None.
Return data from the End of Central Directory record or None .
def _EndRecData(fpin):
    """Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record."""

    # Determine file size
    fpin.seek(0, 2)
    filesize = fpin.tell()

    # Check to see if this is ZIP file with no archive comment (the
    # "end of central directory" structure should be the last item in the
    # file if this is the case).
    try:
        fpin.seek(-sizeEndCentDir, 2)
    except OSError:
        return None
    data = fpin.read()
    if (len(data) == sizeEndCentDir and
        data[0:4] == stringEndArchive and
        data[-2:] == b"\000\000"):
        # the signature is correct and there's no comment, unpack structure
        endrec = struct.unpack(structEndArchive, data)
        endrec=list(endrec)

        # Append a blank comment and record start offset
        endrec.append(b"")
        endrec.append(filesize - sizeEndCentDir)

        # Try to read the "Zip64 end of central directory" structure
        return _EndRecData64(fpin, -sizeEndCentDir, endrec)

    # Either this is not a ZIP file, or it is a ZIP file with an archive
    # comment.  Search the end of the file for the "end of central directory"
    # record signature. The comment is the last item in the ZIP file and may be
    # up to 64K long.  It is assumed that the "end of central directory" magic
    # number does not appear in the comment.
    maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0)
    fpin.seek(maxCommentStart, 0)
    data = fpin.read()
    start = data.rfind(stringEndArchive)
    if start >= 0:
        # found the magic number; attempt to unpack and interpret
        recData = data[start:start+sizeEndCentDir]
        if len(recData) != sizeEndCentDir:
            # Zip file is corrupted.
            return None
        endrec = list(struct.unpack(structEndArchive, recData))
        commentSize = endrec[_ECD_COMMENT_SIZE] #as claimed by the zip file
        comment = data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize]
        endrec.append(comment)
        endrec.append(maxCommentStart + start)

        # Try to read the "Zip64 end of central directory" structure
        return _EndRecData64(fpin, maxCommentStart + start - filesize,
                             endrec)

    # Unable to find a valid end of central directory structure
    return None
def _EndRecData ( fpin ) : # Determine file size fpin . seek ( 0 , 2 ) filesize = fpin . tell ( ) # Check to see if this is ZIP file with no archive comment (the # "end of central directory" structure should be the last item in the # file if this is the case). try : fpin . seek ( - sizeEndCentDir , 2 ) except OSError : return None data = fpin . read ( ) if ( len ( data ) == sizeEndCentDir and data [ 0 : 4 ] == stringEndArchive and data [ - 2 : ] == b"\000\000" ) : # the signature is correct and there's no comment, unpack structure endrec = struct . unpack ( structEndArchive , data ) endrec = list ( endrec ) # Append a blank comment and record start offset endrec . append ( b"" ) endrec . append ( filesize - sizeEndCentDir ) # Try to read the "Zip64 end of central directory" structure return _EndRecData64 ( fpin , - sizeEndCentDir , endrec ) # Either this is not a ZIP file, or it is a ZIP file with an archive # comment.  Search the end of the file for the "end of central directory" # record signature. The comment is the last item in the ZIP file and may be # up to 64K long.  It is assumed that the "end of central directory" magic # number does not appear in the comment. maxCommentStart = max ( filesize - ( 1 << 16 ) - sizeEndCentDir , 0 ) fpin . seek ( maxCommentStart , 0 ) data = fpin . read ( ) start = data . rfind ( stringEndArchive ) if start >= 0 : # found the magic number; attempt to unpack and interpret recData = data [ start : start + sizeEndCentDir ] if len ( recData ) != sizeEndCentDir : # Zip file is corrupted. return None endrec = list ( struct . unpack ( structEndArchive , recData ) ) commentSize = endrec [ _ECD_COMMENT_SIZE ] #as claimed by the zip file comment = data [ start + sizeEndCentDir : start + sizeEndCentDir + commentSize ] endrec . append ( comment ) endrec . append ( maxCommentStart + start ) # Try to read the "Zip64 end of central directory" structure return _EndRecData64 ( fpin , maxCommentStart + start - filesize , endrec ) # Unable to find a valid end of central directory structure return None