def load_pack_index_file(path, f):
 (contents, size) = _load_file_contents(f)
 if (contents[:4] == '\xfftOc'):
  version = struct.unpack('>L', contents[4:8])[0]
  if (version == 2):
   return PackIndex2(path, file=f, contents=contents, size=size)
  else:
   raise KeyError(('Unknown pack index format %d' % version))
 else:
  return PackIndex1(path, file=f, contents=contents, size=size)

def load_pack_index_file ( path , f ) : ( contents , size ) = _load_file_contents ( f ) if ( contents [ : 4 ] == '\xfftOc' ) : version = struct . unpack ( '>L' , contents [ 4 : 8 ] ) [ 0 ] if ( version == 2 ) : return PackIndex2 ( path , file = f , contents = contents , size = size ) else : raise KeyError ( ( 'Unknown pack index format %d' % version ) ) else : return PackIndex1 ( path , file = f , contents = contents , size = size )
load an index file from a file-like object .