# 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):
#     """
#     Strips all non-alphanumeric characters and puts everything in lowercase
# 
#     Args:
#         input_string (str) : string to be sanitized
# 
#     Returns:
#         str : the sanitized string
# 
#     Examples:
#         >>> from onix.utilities import sanitize_string
#         >>> print(sanitize_string('Hello World'))
#         helloworld
# 
#     """
#     return re.compile(r'[^A-Za-z0-9]').sub('', input_string).lower()


import json
import re
from collections import defaultdict
from future.utils import iteritems
from onix import scrapers
from onix.utilities import sanitize_string
    for pokemon, entry in iteritems(pokedex):
        formes[entry['num']].append((pokemon, entry['baseStats'],
                                    entry['types']))

    # policy: formes get combined iff they have the same base stats and typing
    for num, formes in iteritems(formes):
        if len(formes) < 2:
            continue
        formes = sorted(formes, key=lambda x:len(x[0]))
        base = formes[0]
        for forme in formes[1:]:
            if base[1:] == forme[1:]:
                species_lookup[forme[0]] = species_lookup[base[0]]

    return species_lookup


def main():
    try:
        items = json.load(open('.psdata/items.json'))
    except IOError:
        items = scrapers.scrape_battle_items()

    accessible_formes = {}
    species_lookup = generate_single_forme_species_lookup()

    # first the megas
    for item, attributes in iteritems(items):
        if 'megaStone' not in attributes:
            continue

# 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):
#     """
#     Strips all non-alphanumeric characters and puts everything in lowercase
# 
#     Args:
#         input_string (str) : string to be sanitized
# 
#     Returns:
#         str : the sanitized string
# 
#     Examples:
#         >>> from onix.utilities import sanitize_string
#         >>> print(sanitize_string('Hello World'))
#         helloworld
# 
#     """
#     return re.compile(r'[^A-Za-z0-9]').sub('', input_string).lower()


# Path: onix/scripts/generate_forme_change_rules.py
import json
import re
from collections import defaultdict
from future.utils import iteritems
from onix import scrapers
from onix.utilities import sanitize_string

    for pokemon, entry in iteritems(pokedex):
        formes[entry['num']].append((pokemon, entry['baseStats'],
                                    entry['types']))

    # policy: formes get combined iff they have the same base stats and typing
    for num, formes in iteritems(formes):
        if len(formes) < 2:
            continue
        formes = sorted(formes, key=lambda x:len(x[0]))
        base = formes[0]
        for forme in formes[1:]:
            if base[1:] == forme[1:]:
                species_lookup[forme[0]] = species_lookup[base[0]]

    return species_lookup


def main():
    try:
        items = json.load(open('.psdata/items.json'))
    except IOError:
        items = scrapers.scrape_battle_items()

    accessible_formes = {}
    species_lookup = generate_single_forme_species_lookup()

    # first the megas
    for item, attributes in iteritems(items):
        if 'megaStone' not in attributes:
            continue

        start_forme = sanitize_string(attributes['megaEvolves'])