# Path: ice/model.py
# ROM = collections.namedtuple('ROM', [
#   'name',
#   'path',
#   'console',
# ])
# 
# Path: ice/roms.py
# ICE_FLAG_TAG = "~ManagedByIce"
# def roms_directory(config):
# def rom_shortcut_name(rom):
# def rom_to_shortcut(rom):


import collections
import os
import random
import shutil
import tempfile
from pysteam import model as steam_model
from pysteam import paths
from ice import model
from ice import roms
    # The "config" directory, which stores shortcuts.vdf and the grid directory
    # TODO: There should probably be a helper function for this in pysteam
    os.mkdir(os.path.join(paths.user_specific_data_directory(self.get_context()), "config"))
    # The directory which stores grid images
    os.mkdir(paths.custom_images_directory(self.get_context()))

  def get_user_id(self):
    return self.uid

  def get_context(self):
    return steam_model.LocalUserContext(self.steam_fixture.get_steam(), self.uid)

def DataFixture(data):
  """Creates a pseudo class out of the parameter dictionary `data`, and
  populates the object such that calling `object.foo` will return `bar` if the
  input dictionary has a key/value pair `"foo": "bar"`."""
  # Transform keys to remove invalid characters, like ` `.
  assert all([all([c.isalnum() or c=='_' for c in key]) for key in data.keys()]), "All dictionary keys must be valid python variable names"
  DataPseudoClass = collections.namedtuple('DataPseudoClass', data.keys())
  return DataPseudoClass(**data)

emulators = DataFixture({
  "mednafen": model.Emulator(
    name = 'Mednafen',
    location = '/emulators/Mednafen/mednafen',
    format = "%l %r"
  ),
})

consoles = DataFixture({

# Path: ice/model.py
# ROM = collections.namedtuple('ROM', [
#   'name',
#   'path',
#   'console',
# ])
# 
# Path: ice/roms.py
# ICE_FLAG_TAG = "~ManagedByIce"
# def roms_directory(config):
# def rom_shortcut_name(rom):
# def rom_to_shortcut(rom):


# Path: tests/testinfra/fixtures.py
import collections
import os
import random
import shutil
import tempfile
from pysteam import model as steam_model
from pysteam import paths
from ice import model
from ice import roms

    # The "config" directory, which stores shortcuts.vdf and the grid directory
    # TODO: There should probably be a helper function for this in pysteam
    os.mkdir(os.path.join(paths.user_specific_data_directory(self.get_context()), "config"))
    # The directory which stores grid images
    os.mkdir(paths.custom_images_directory(self.get_context()))

  def get_user_id(self):
    return self.uid

  def get_context(self):
    return steam_model.LocalUserContext(self.steam_fixture.get_steam(), self.uid)

def DataFixture(data):
  """Creates a pseudo class out of the parameter dictionary `data`, and
  populates the object such that calling `object.foo` will return `bar` if the
  input dictionary has a key/value pair `"foo": "bar"`."""
  # Transform keys to remove invalid characters, like ` `.
  assert all([all([c.isalnum() or c=='_' for c in key]) for key in data.keys()]), "All dictionary keys must be valid python variable names"
  DataPseudoClass = collections.namedtuple('DataPseudoClass', data.keys())
  return DataPseudoClass(**data)

emulators = DataFixture({
  "mednafen": model.Emulator(
    name = 'Mednafen',
    location = '/emulators/Mednafen/mednafen',
    format = "%l %r"
  ),
})

consoles = DataFixture({

  "nes": model.Console(