# Path: onix/model.py
# 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
# 
# 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 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


import collections
import hashlib
import json
import re
import pkg_resources
from past.builtins import basestring
from onix.model import Moveset, Forme, PokeStats
            ...
            >>> try:
            ...     aliases = json.load(open('.psdata/aliases.json'))
            ... except IOError:
            ...     aliases = scrapers.scrape_battle_aliases()
            ...
            >>> sanitizer = utilities.Sanitizer(pokedex, aliases)
            >>> sanitizer.sanitize('Wormadam-Trash')
            'wormadamtrash'
            >>> print(', '.join(sanitizer.sanitize(['Volt Switch', 'Thunder',
            ...                                     'Giga Drain', 'Web'])))
            gigadrain, stickyweb, thunder, voltswitch
        """
        if input_object is None:
            sanitized = input_object

        elif isinstance(input_object, basestring):
            sanitized = sanitize_string(input_object)
            if sanitized in self.aliases.keys():
                sanitized = sanitize_string(self.aliases[sanitized])

        elif isinstance(input_object, Moveset):

            sanitized_dict = self.sanitize(dict(zip(input_object._fields[1:],
                                                    input_object[1:])))
            primary_forme = self.sanitize(input_object.formes[0])
            alternate_formes = self.sanitize(input_object.formes[1:])
            sanitized_dict['formes'] = [primary_forme] + alternate_formes
            sanitized = Moveset(**sanitized_dict)


# Path: onix/model.py
# 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
# 
# 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 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


# Path: onix/utilities.py
import collections
import hashlib
import json
import re
import pkg_resources
from past.builtins import basestring
from onix.model import Moveset, Forme, PokeStats

            ...
            >>> try:
            ...     aliases = json.load(open('.psdata/aliases.json'))
            ... except IOError:
            ...     aliases = scrapers.scrape_battle_aliases()
            ...
            >>> sanitizer = utilities.Sanitizer(pokedex, aliases)
            >>> sanitizer.sanitize('Wormadam-Trash')
            'wormadamtrash'
            >>> print(', '.join(sanitizer.sanitize(['Volt Switch', 'Thunder',
            ...                                     'Giga Drain', 'Web'])))
            gigadrain, stickyweb, thunder, voltswitch
        """
        if input_object is None:
            sanitized = input_object

        elif isinstance(input_object, basestring):
            sanitized = sanitize_string(input_object)
            if sanitized in self.aliases.keys():
                sanitized = sanitize_string(self.aliases[sanitized])

        elif isinstance(input_object, Moveset):

            sanitized_dict = self.sanitize(dict(zip(input_object._fields[1:],
                                                    input_object[1:])))
            primary_forme = self.sanitize(input_object.formes[0])
            alternate_formes = self.sanitize(input_object.formes[1:])
            sanitized_dict['formes'] = [primary_forme] + alternate_formes
            sanitized = Moveset(**sanitized_dict)


        elif isinstance(input_object, Forme):