# 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
"""Functionality for processing of logs and routing parsed data to sinks"""



class LogProcessor(object):
    """
    Executor in charge of processing battle logs and routing the parsed data to
    the appropriate sinks. The LogProcessor is in charge of instantiating
    "log readers" to process the logs that come in based on the format of
    the log (_e.g._ JSON file) and the metagame of the battle.

    Args:
        moveset_sink (sinks.MovesetSink) : The sink to route movesets data
        battle_info_sink (sinks.BattleInfoSink) :
            The sink to route battle metadata
        battle_sink (sinks.BattleSink) :
            The sink to route the actual turn-by-turn battle representations
        force_context_refresh (:obj:`bool`, optional) : Defaults to `False`. If
            `True`, any contexts that get loaded will be pull fresh data from
            Pokemon Showdown rather than rely on the local cache.
    """

    def __init__(self, moveset_sink, battle_info_sink, battle_sink,
                 force_context_refresh=False):

        self.moveset_sink = moveset_sink
        self.battle_info_sink = battle_info_sink
        self.battle_sink = battle_sink


# 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

"""Functionality for processing of logs and routing parsed data to sinks"""



class LogProcessor(object):
    """
    Executor in charge of processing battle logs and routing the parsed data to
    the appropriate sinks. The LogProcessor is in charge of instantiating
    "log readers" to process the logs that come in based on the format of
    the log (_e.g._ JSON file) and the metagame of the battle.

    Args:
        moveset_sink (sinks.MovesetSink) : The sink to route movesets data
        battle_info_sink (sinks.BattleInfoSink) :
            The sink to route battle metadata
        battle_sink (sinks.BattleSink) :
            The sink to route the actual turn-by-turn battle representations
        force_context_refresh (:obj:`bool`, optional) : Defaults to `False`. If
            `True`, any contexts that get loaded will be pull fresh data from
            Pokemon Showdown rather than rely on the local cache.
    """

    def __init__(self, moveset_sink, battle_info_sink, battle_sink,
                 force_context_refresh=False):

        self.moveset_sink = moveset_sink
        self.battle_info_sink = battle_info_sink
        self.battle_sink = battle_sink


        self._std_ctx = contexts.get_standard_context(force_context_refresh)