parameters: (symbols, pak_file)
docstring: Adds pseudo-symbols from a pak file.
docstring_summary: Adds pseudo-symbols from a pak file.
docstring_tokens: Adds pseudo - symbols from a pak file .
function: def AddPakData(symbols, pak_file):
    """Adds pseudo-symbols from a pak file."""
    pak_file = os.path.abspath(pak_file)
    with open(pak_file, 'rb') as pak:
      data = pak.read()
  
    PAK_FILE_VERSION = 4
    HEADER_LENGTH = 2 * 4 + 1  # Two uint32s. (file version, number of entries)
                               # and one uint8 (encoding of text resources)
    INDEX_ENTRY_SIZE = 2 + 4  # Each entry is a uint16 and a uint32.
    version, num_entries, _encoding = struct.unpack('<IIB', data[:HEADER_LENGTH])
    assert version == PAK_FILE_VERSION, ('Unsupported pak file '
                                         'version (%d) in %s. Only '
                                         'support version %d' %
                                         (version, pak_file, PAK_FILE_VERSION))
    if num_entries > 0:
      # Read the index and data.
      data = data[HEADER_LENGTH:]
      for _ in range(num_entries):
        resource_id, offset = struct.unpack('<HI', data[:INDEX_ENTRY_SIZE])
        data = data[INDEX_ENTRY_SIZE:]
        _next_id, next_offset = struct.unpack('<HI', data[:INDEX_ENTRY_SIZE])
        resource_size = next_offset - offset
  
        symbol_name = GetReadablePakResourceName(pak_file, resource_id)
        symbol_path = pak_file
        symbol_type = 'd' # Data. Approximation.
        symbol_size = resource_size
        symbols.append((symbol_name, symbol_type, symbol_size, symbol_path))
function_tokens: def AddPakData ( symbols , pak_file ) : pak_file = os . path . abspath ( pak_file ) with open ( pak_file , 'rb' ) as pak : data = pak . read ( ) PAK_FILE_VERSION = 4 HEADER_LENGTH = 2 * 4 + 1 # Two uint32s. (file version, number of entries) # and one uint8 (encoding of text resources) INDEX_ENTRY_SIZE = 2 + 4 # Each entry is a uint16 and a uint32. version , num_entries , _encoding = struct . unpack ( '<IIB' , data [ : HEADER_LENGTH ] ) assert version == PAK_FILE_VERSION , ( 'Unsupported pak file ' 'version (%d) in %s. Only ' 'support version %d' % ( version , pak_file , PAK_FILE_VERSION ) ) if num_entries > 0 : # Read the index and data. data = data [ HEADER_LENGTH : ] for _ in range ( num_entries ) : resource_id , offset = struct . unpack ( '<HI' , data [ : INDEX_ENTRY_SIZE ] ) data = data [ INDEX_ENTRY_SIZE : ] _next_id , next_offset = struct . unpack ( '<HI' , data [ : INDEX_ENTRY_SIZE ] ) resource_size = next_offset - offset symbol_name = GetReadablePakResourceName ( pak_file , resource_id ) symbol_path = pak_file symbol_type = 'd' # Data. Approximation. symbol_size = resource_size symbols . append ( ( symbol_name , symbol_type , symbol_size , symbol_path ) )