# Path: onix/scrapers.py
# def get_commit_from_timestamp(timestamp):
# def _write(data, destination_filename):
# def _scrape(url, entry, commit=None, destination_filename=None):
# def scrape_battle_formats_data(commit=None):
# def scrape_battle_pokedex(commit=None):
# def scrape_battle_aliases(commit=None):
# def scrape_battle_items(commit=None):
# def scrape_battle_movedex(commit=None):
# def scrape_formats(commit=None):
# 
# Path: onix/utilities.py
# def sanitize_string(input_string):
#     def __init__(self, pokedex, aliases):
#     def sanitize(self, input_object):
# def compute_sid(moveset, sanitizer=None):
# def stats_dict_to_model(stats_dict):
# def calculate_stats(base_stats, nature, ivs, evs, level):
# def load_natures():
# def load_accessible_formes():
# def load_species_lookup():
# def parse_ruleset(ruleset):
# def determine_hidden_power_type(ivs):
# class Sanitizer(object):
# 
# Path: onix/model.py
# class PokeStats(namedtuple('PokeStats', ['hp',
#                                          'atk',
#                                          'dfn',
#                                          'spa',
#                                          'spd',
#                                          'spe'])):
#     """
#     Container to represent a Pokemon's stats. This could be base stats, IVs/EVs
#     or battle-stats.
# 
#     Args:
#         hp (int) : hit point stat
#         atk (int) : attack stat
#         dfn (int) : defense stat (you can't have a field named "def")
#         spa (int) : special attack stat
#         spd (int) : special defense stat
#         spe (int) : speed stat
#     """
#     pass
# 
# class Forme(namedtuple('Forme', ['species',
#                                  'ability',
#                                  'stats'])):
#     """
#     Container to represent a Pokemon's Forme (that is, the aspects of a moveset
#     that might change when forme changes).
# 
#     Args:
#         species (str) : forme name
#         ability (str) : the Pokemon's ability
#         stats (PokeStats) : the Pokemon's battle stats (that is, not base stats)
#     """
# 
# class Moveset(namedtuple('Moveset', ['formes',
#                                      'gender',
#                                      'item',
#                                      'moves',
#                                      'level',
#                                      'happiness'])):
#     """
#     Container comprising a complete description of a specific build's
#     battle-relevant attributes (read: not nickname).
# 
#     Args:
#         formes (:obj:`list` of :obj:`Forme`) : the formes the Pokemon might
#             take over the course of the battle
# 
#             .. note ::
#                 The first forme in this list is considered the Pokemon's
#                 "primary forme." It is the forme the Pokemon will appear in
#                 the first time it appears on the field (making an exception for
#                 orb-holding Groudon and Kyogre who transform immediately into
#                 their Primal formes and do not change back)
# 
#         gender ('m', 'f' or 'u') : the Pokemon's gender ('u' represents "not
#             specified")
#         item (str) : the Pokemon's held item
#         moves (:obj:`list` of :obj:`str`) : the moves the Pokemon knows
#         level (int) : the Pokemon's level
#         happiness (int) : the Pokemon's happiness
# 
#     Note:
#         Nature, IVs and EVs aren't included in this description, since there
#         might be multiple ways to get to the same battle-stats, but they're all
#         functionally equivalent.
# 
#     """
#     pass


import json
import pytest
from onix import scrapers
from onix import utilities
from onix.model import PokeStats, Forme, Moveset

        try:
            pokedex = json.load(open('.psdata/pokedex.json'))
        except IOError:
            pokedex = scrapers.scrape_battle_pokedex()

        try:
            aliases = json.load(open('.psdata/aliases.json'))
        except IOError:
            aliases = scrapers.scrape_battle_aliases()

        self.sanitizer = utilities.Sanitizer(pokedex, aliases)

    def test_sanitize_list(self):
        input_object = ['Giga Drain', 'Power Whip', 'Earthquake', 'Sunny Day']
        expected = ['earthquake', 'gigadrain', 'powerwhip', 'sunnyday']
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_iterable(self):
        input_object = {'Rock Polish', 'Explosion', 'Rock Blast', 'Hyper Beam'}
        expected = ['explosion', 'hyperbeam', 'rockblast', 'rockpolish']
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_dict(self):
        input_object = {'itEm': 'Mystic Water', 'level': 100}
        expected = {'itEm': 'mysticwater', 'level': 100}
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_forme(self):
        input_object = Forme('bugceus', 'Multi-type',

# Path: onix/scrapers.py
# def get_commit_from_timestamp(timestamp):
# def _write(data, destination_filename):
# def _scrape(url, entry, commit=None, destination_filename=None):
# def scrape_battle_formats_data(commit=None):
# def scrape_battle_pokedex(commit=None):
# def scrape_battle_aliases(commit=None):
# def scrape_battle_items(commit=None):
# def scrape_battle_movedex(commit=None):
# def scrape_formats(commit=None):
# 
# Path: onix/utilities.py
# def sanitize_string(input_string):
#     def __init__(self, pokedex, aliases):
#     def sanitize(self, input_object):
# def compute_sid(moveset, sanitizer=None):
# def stats_dict_to_model(stats_dict):
# def calculate_stats(base_stats, nature, ivs, evs, level):
# def load_natures():
# def load_accessible_formes():
# def load_species_lookup():
# def parse_ruleset(ruleset):
# def determine_hidden_power_type(ivs):
# class Sanitizer(object):
# 
# Path: onix/model.py
# class PokeStats(namedtuple('PokeStats', ['hp',
#                                          'atk',
#                                          'dfn',
#                                          'spa',
#                                          'spd',
#                                          'spe'])):
#     """
#     Container to represent a Pokemon's stats. This could be base stats, IVs/EVs
#     or battle-stats.
# 
#     Args:
#         hp (int) : hit point stat
#         atk (int) : attack stat
#         dfn (int) : defense stat (you can't have a field named "def")
#         spa (int) : special attack stat
#         spd (int) : special defense stat
#         spe (int) : speed stat
#     """
#     pass
# 
# class Forme(namedtuple('Forme', ['species',
#                                  'ability',
#                                  'stats'])):
#     """
#     Container to represent a Pokemon's Forme (that is, the aspects of a moveset
#     that might change when forme changes).
# 
#     Args:
#         species (str) : forme name
#         ability (str) : the Pokemon's ability
#         stats (PokeStats) : the Pokemon's battle stats (that is, not base stats)
#     """
# 
# class Moveset(namedtuple('Moveset', ['formes',
#                                      'gender',
#                                      'item',
#                                      'moves',
#                                      'level',
#                                      'happiness'])):
#     """
#     Container comprising a complete description of a specific build's
#     battle-relevant attributes (read: not nickname).
# 
#     Args:
#         formes (:obj:`list` of :obj:`Forme`) : the formes the Pokemon might
#             take over the course of the battle
# 
#             .. note ::
#                 The first forme in this list is considered the Pokemon's
#                 "primary forme." It is the forme the Pokemon will appear in
#                 the first time it appears on the field (making an exception for
#                 orb-holding Groudon and Kyogre who transform immediately into
#                 their Primal formes and do not change back)
# 
#         gender ('m', 'f' or 'u') : the Pokemon's gender ('u' represents "not
#             specified")
#         item (str) : the Pokemon's held item
#         moves (:obj:`list` of :obj:`str`) : the moves the Pokemon knows
#         level (int) : the Pokemon's level
#         happiness (int) : the Pokemon's happiness
# 
#     Note:
#         Nature, IVs and EVs aren't included in this description, since there
#         might be multiple ways to get to the same battle-stats, but they're all
#         functionally equivalent.
# 
#     """
#     pass


# Path: tests/test_utilities.py
import json
import pytest
from onix import scrapers
from onix import utilities
from onix.model import PokeStats, Forme, Moveset


        try:
            pokedex = json.load(open('.psdata/pokedex.json'))
        except IOError:
            pokedex = scrapers.scrape_battle_pokedex()

        try:
            aliases = json.load(open('.psdata/aliases.json'))
        except IOError:
            aliases = scrapers.scrape_battle_aliases()

        self.sanitizer = utilities.Sanitizer(pokedex, aliases)

    def test_sanitize_list(self):
        input_object = ['Giga Drain', 'Power Whip', 'Earthquake', 'Sunny Day']
        expected = ['earthquake', 'gigadrain', 'powerwhip', 'sunnyday']
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_iterable(self):
        input_object = {'Rock Polish', 'Explosion', 'Rock Blast', 'Hyper Beam'}
        expected = ['explosion', 'hyperbeam', 'rockblast', 'rockpolish']
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_dict(self):
        input_object = {'itEm': 'Mystic Water', 'level': 100}
        expected = {'itEm': 'mysticwater', 'level': 100}
        assert expected == self.sanitizer.sanitize(input_object)

    def test_sanitize_forme(self):
        input_object = Forme('bugceus', 'Multi-type',

                             PokeStats(444, 276, 277, 276, 372, 248))