parameters: (game_info, aux_path, expansion=False)
return_statement: return GameEdition(game_name, game_id, support, game_version_info,
                         game_mediapaths, modpacks, expansions, **flags)
docstring: Create a GameEdition or GameExpansion object from the contents
      of the game_info dictionary and its version hash file.
      Use expansion parameter to decide if a GameEdition object
      is needed to be created or GameExpansion.
docstring_summary: Create a GameEdition or GameExpansion object from the contents
      of the game_info dictionary and its version hash file.
      Use expansion parameter to decide if a GameEdition object
      is needed to be created or GameExpansion.
docstring_tokens: Create a GameEdition or GameExpansion object from the contents of the game_info dictionary and its version hash file . Use expansion parameter to decide if a GameEdition object is needed to be created or GameExpansion .
function: def create_game_obj(game_info, aux_path, expansion=False):
      """
      Create a GameEdition or GameExpansion object from the contents
      of the game_info dictionary and its version hash file.
      Use expansion parameter to decide if a GameEdition object
      is needed to be created or GameExpansion.
      """
      # initialize necessary parameters
      game_name = game_info['name']
      game_id = game_info['game_edition_id']
      support = game_info['support']
      modpacks = game_info['targetmod']
      if not expansion:
          expansions = game_info['expansions']
  
      flags = {}
  
      # add mediapaths for the game
      game_mediapaths = []
      for media_type in game_info['mediapaths']:
          game_mediapaths.append(
              (media_type, game_info['mediapaths'][media_type]))
  
      # add version hashes from the auxiliary file specific for the game
      game_hash_path = aux_path["version_hashes.toml"]
      with game_hash_path.open() as game_hash_toml:
          game_hashes = toml.loads(game_hash_toml.read())
  
      file_version = game_hashes.pop("file_version")
      hash_algo = game_hashes.pop("hash_algo")
      if hash_algo != "SHA3-256":
          warn(f"{game_hash_path}: Unrecognized hash algorithm: {hash_algo}")
  
      game_version_info = []
      for item in game_hashes.items():
          if file_version == "1.0":
              game_version_info.append((
                  [item[1]['path']],
                  item[1]['map']
              ))
  
          elif file_version == "2.0":
              game_version_info.append((
                  item[1]['paths'],
                  item[1]['map']
              ))
  
          else:
              raise Exception(
                  f"{game_hash_path}: Unrecognized file version: '{file_version}'")
  
      # Check if there is a media cache file and save the path if it exists
      if aux_path["media_cache.toml"].is_file():
          flags["media_cache"] = aux_path["media_cache.toml"]
  
      if expansion:
          return GameExpansion(game_name, game_id, support, game_version_info,
                               game_mediapaths, modpacks, **flags)
  
      return GameEdition(game_name, game_id, support, game_version_info,
                         game_mediapaths, modpacks, expansions, **flags)
function_tokens: def create_game_obj ( game_info , aux_path , expansion = False ) : # initialize necessary parameters game_name = game_info [ 'name' ] game_id = game_info [ 'game_edition_id' ] support = game_info [ 'support' ] modpacks = game_info [ 'targetmod' ] if not expansion : expansions = game_info [ 'expansions' ] flags = { } # add mediapaths for the game game_mediapaths = [ ] for media_type in game_info [ 'mediapaths' ] : game_mediapaths . append ( ( media_type , game_info [ 'mediapaths' ] [ media_type ] ) ) # add version hashes from the auxiliary file specific for the game game_hash_path = aux_path [ "version_hashes.toml" ] with game_hash_path . open ( ) as game_hash_toml : game_hashes = toml . loads ( game_hash_toml . read ( ) ) file_version = game_hashes . pop ( "file_version" ) hash_algo = game_hashes . pop ( "hash_algo" ) if hash_algo != "SHA3-256" : warn ( f"{game_hash_path}: Unrecognized hash algorithm: {hash_algo}" ) game_version_info = [ ] for item in game_hashes . items ( ) : if file_version == "1.0" : game_version_info . append ( ( [ item [ 1 ] [ 'path' ] ] , item [ 1 ] [ 'map' ] ) ) elif file_version == "2.0" : game_version_info . append ( ( item [ 1 ] [ 'paths' ] , item [ 1 ] [ 'map' ] ) ) else : raise Exception ( f"{game_hash_path}: Unrecognized file version: '{file_version}'" ) # Check if there is a media cache file and save the path if it exists if aux_path [ "media_cache.toml" ] . is_file ( ) : flags [ "media_cache" ] = aux_path [ "media_cache.toml" ] if expansion : return GameExpansion ( game_name , game_id , support , game_version_info , game_mediapaths , modpacks , * * flags ) return GameEdition ( game_name , game_id , support , game_version_info , game_mediapaths , modpacks , expansions , * * flags )