(info, format, encoding, errors)
return buf
Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
Return a header block . info is a dictionary with file information format must be one of the * _FORMAT constants .
def _create_header(info, format, encoding, errors):
        """Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        """
        parts = [
            stn(info.get("name", ""), 100, encoding, errors),
            itn(info.get("mode", 0) & 0o7777, 8, format),
            itn(info.get("uid", 0), 8, format),
            itn(info.get("gid", 0), 8, format),
            itn(info.get("size", 0), 12, format),
            itn(info.get("mtime", 0), 12, format),
            b"        ", # checksum field
            info.get("type", REGTYPE),
            stn(info.get("linkname", ""), 100, encoding, errors),
            info.get("magic", POSIX_MAGIC),
            stn(info.get("uname", ""), 32, encoding, errors),
            stn(info.get("gname", ""), 32, encoding, errors),
            itn(info.get("devmajor", 0), 8, format),
            itn(info.get("devminor", 0), 8, format),
            stn(info.get("prefix", ""), 155, encoding, errors)
        ]

        buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts))
        chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
        buf = buf[:-364] + ("%06o\0" % chksum).encode("ascii") + buf[-357:]
        return buf
def _create_header ( info , format , encoding , errors ) : parts = [ stn ( info . get ( "name" , "" ) , 100 , encoding , errors ) , itn ( info . get ( "mode" , 0 ) & 0o7777 , 8 , format ) , itn ( info . get ( "uid" , 0 ) , 8 , format ) , itn ( info . get ( "gid" , 0 ) , 8 , format ) , itn ( info . get ( "size" , 0 ) , 12 , format ) , itn ( info . get ( "mtime" , 0 ) , 12 , format ) , b"        " , # checksum field info . get ( "type" , REGTYPE ) , stn ( info . get ( "linkname" , "" ) , 100 , encoding , errors ) , info . get ( "magic" , POSIX_MAGIC ) , stn ( info . get ( "uname" , "" ) , 32 , encoding , errors ) , stn ( info . get ( "gname" , "" ) , 32 , encoding , errors ) , itn ( info . get ( "devmajor" , 0 ) , 8 , format ) , itn ( info . get ( "devminor" , 0 ) , 8 , format ) , stn ( info . get ( "prefix" , "" ) , 155 , encoding , errors ) ] buf = struct . pack ( "%ds" % BLOCKSIZE , b"" . join ( parts ) ) chksum = calc_chksums ( buf [ - BLOCKSIZE : ] ) [ 0 ] buf = buf [ : - 364 ] + ( "%06o\0" % chksum ) . encode ( "ascii" ) + buf [ - 357 : ] return buf