# Path: onix/contexts.py
# class Context(object):
# class ResourceMissingError(Exception):
#     def __init__(self, **resources):
#     def __init__(self, resource):
# def require(context, *resources):
# def _get_context(commit, force_refresh):
# def get_standard_context(force_refresh=False):
# def get_historical_context(timestamp):
# 
# Path: onix/collection/log_reader.py
# class ParsingError(Exception):
# class LogReader(with_metaclass(abc.ABCMeta, object)):
# class JsonFileLogReader(LogReader):
#     def __init__(self, log_ref, message):
# def get_all_formes(species, ability, item, moves,
#                    context, hackmons=False, any_ability=False):
# def rating_dict_to_model(rating_dict):
# def normalize_hidden_power(moves, ivs):
#     def __init__(self, context):
#     def _parse_log(self, log_ref):
#     def parse_log(self, log_ref):
#     def _parse_moveset(self, moveset_dict, hackmons, any_ability,
#                        mega_rayquaza_allowed, default_level):
#     def __init__(self, context):
#     def _parse_log(self, log_ref):
# 
# Path: onix/collection/sinks.py
# class _Sink(with_metaclass(abc.ABCMeta, object)):
# class MovesetSink(_Sink):
# class BattleInfoSink(_Sink):
# class BattleSink(_Sink):
#     def flush(self):
#     def close(self):
#     def __enter__(self):
#     def __exit__(self, *exc):
#     def store_movesets(self, movesets):
#     def store_battle_info(self, battle_info):
#     def store_battle(self, battle):


import os
import warnings
from onix import contexts
from onix.collection import log_reader
from onix.collection import sinks
                A log reader suitable for parsing the log. If there are no
                suitable readers and it's not possible to instantiate one,
                returns ``None``.
        """

        # determine the metagame from the filename
        metagame = None
        path = log_ref.split(os.sep)
        filename = path[-1].split('-')
        if not filename[-1].endswith('.log.json'):
            """Currently only json logs are supported"""
            return None
        if len(filename) == 3:
            metagame = filename[1]

        if metagame is None:
            """can't determine the metagame :("""
            return None

        if metagame not in self._std_ctx.formats.keys():
            """no idea what the metagame is"""
            return None

        if 'mod' in self._std_ctx.formats[metagame].keys():
            """Non-standard metagames are not currently supported"""
            return None

        # Okay, phew. We're past all that. Now just return the standard reader

        if 'json_std' not in self._readers.keys():

# Path: onix/contexts.py
# class Context(object):
# class ResourceMissingError(Exception):
#     def __init__(self, **resources):
#     def __init__(self, resource):
# def require(context, *resources):
# def _get_context(commit, force_refresh):
# def get_standard_context(force_refresh=False):
# def get_historical_context(timestamp):
# 
# Path: onix/collection/log_reader.py
# class ParsingError(Exception):
# class LogReader(with_metaclass(abc.ABCMeta, object)):
# class JsonFileLogReader(LogReader):
#     def __init__(self, log_ref, message):
# def get_all_formes(species, ability, item, moves,
#                    context, hackmons=False, any_ability=False):
# def rating_dict_to_model(rating_dict):
# def normalize_hidden_power(moves, ivs):
#     def __init__(self, context):
#     def _parse_log(self, log_ref):
#     def parse_log(self, log_ref):
#     def _parse_moveset(self, moveset_dict, hackmons, any_ability,
#                        mega_rayquaza_allowed, default_level):
#     def __init__(self, context):
#     def _parse_log(self, log_ref):
# 
# Path: onix/collection/sinks.py
# class _Sink(with_metaclass(abc.ABCMeta, object)):
# class MovesetSink(_Sink):
# class BattleInfoSink(_Sink):
# class BattleSink(_Sink):
#     def flush(self):
#     def close(self):
#     def __enter__(self):
#     def __exit__(self, *exc):
#     def store_movesets(self, movesets):
#     def store_battle_info(self, battle_info):
#     def store_battle(self, battle):


# Path: onix/collection/log_processor.py
import os
import warnings
from onix import contexts
from onix.collection import log_reader
from onix.collection import sinks

                A log reader suitable for parsing the log. If there are no
                suitable readers and it's not possible to instantiate one,
                returns ``None``.
        """

        # determine the metagame from the filename
        metagame = None
        path = log_ref.split(os.sep)
        filename = path[-1].split('-')
        if not filename[-1].endswith('.log.json'):
            """Currently only json logs are supported"""
            return None
        if len(filename) == 3:
            metagame = filename[1]

        if metagame is None:
            """can't determine the metagame :("""
            return None

        if metagame not in self._std_ctx.formats.keys():
            """no idea what the metagame is"""
            return None

        if 'mod' in self._std_ctx.formats[metagame].keys():
            """Non-standard metagames are not currently supported"""
            return None

        # Okay, phew. We're past all that. Now just return the standard reader

        if 'json_std' not in self._readers.keys():

            self._readers['json_std'] = log_reader.JsonFileLogReader(