# Path: hypebot/hypecore.py
# class RequestTracker(object):
# class OutputUtil(object):
# class UserPreferences(object):
# class Core(object):
#   _REQUEST_TIMEOUT_SEC = 60
#   _PREFS = {
#       'location': 'MTV',
#       'temperature_unit': 'F',
#       'stocks': 'GOOG,GOOGL',
#       # Comma separated list of your summoner names. First is considered main.
#       'lol_summoner': None,
#       'lol_region': 'NA',
#       '_dynamite_dm': None,
#       # Maps 'user/####' to '$ldap'.
#       '_dynamite_ldap': None,
#   }
#   _SUBKEY = 'preferences'
#   def __init__(self, reply_fn: Callable) -> None:
#   def HasPendingRequest(self, user: hype_types.User) -> bool:
#   def RequestConfirmation(self,
#                           user: hype_types.User,
#                           summary: Text,
#                           request_details: Dict,
#                           action_fn: Callable,
#                           parse_fn: Optional[Callable] = None) -> None:
#   def ResolveRequest(self, user: hype_types.User, user_msg: Text) -> None:
#   def __init__(self, output_fn: Callable) -> None:
#   def LogAndOutput(self, log_level: int, channel: channel_pb2.Channel,
#                    message: hype_types.CommandResponse) -> None:
#   def Output(self, channel: channel_pb2.Channel,
#              message: hype_types.CommandResponse) -> None:
#   def __init__(self, store: storage_lib.HypeStore):
#   def IsValid(self, pref: Text) -> bool:
#   def Get(self, user: user_pb2.User, pref: Text) -> Text:
#   def Set(self, user: user_pb2.User, pref: Text, value: Text) -> None:
#   def _Set(self, user: user_pb2.User, pref: Text, value: Text,
#            tx: storage_lib.HypeTransaction) -> None:
#   def GetAll(self, user: user_pb2.User) -> Dict[Text, Text]:
#   def __init__(
#       self,
#       params: Any,  # HypeParams
#       interface: interface_lib.BaseChatInterface) -> None:
#   def Reply(self,
#             channel: hype_types.Target,
#             msg: hype_types.CommandResponse,
#             default_channel: Optional[channel_pb2.Channel] = None,
#             limit_lines: bool = False,
#             max_public_lines: int = 6,
#             user: Optional[hype_types.User] = None,
#             log: bool = False,
#             log_level: int = logging.INFO) -> None:
#   def PublishMessage(self,
#                      topic: Text,
#                      msg: hype_types.CommandResponse,
#                      notice: bool = False) -> None:
#   def ReloadData(self) -> bool:
# 
# Path: hypebot/commands/command_factory.py

# 
# Path: hypebot/core/params_lib.py
# def _ParseChannel(channel):
# def _ParseChannels(channels):
#   def __init__(self, defaults=None):
#   def __str__(self):
#   def Override(self, params):
#   def _AssignValueConvertDict(self, key, value):
#   def _ParseDict(self, params):
#   def __setattr__(self, key, value):
#   def get(self, key, default_value=None):  # pylint: disable=invalid-name
#   def AsDict(self):
#   def Lock(self):
#   def _RaiseIfLocked(self):
# def MergeParams(defaults, *overrides):
# class HypeParams(object):
#   SPECIAL_ATTRS = ['_locked']
#   HAS_DYNAMIC_ATTRIBUTES = True
# 
# Path: hypebot/interfaces/interface_factory.py

# 
# Path: hypebot/plugins/alias_lib.py
# ALIAS_SUBKEY = 'user_aliases'
# ME_REGEX = re.compile(r'\\me\b')
# ALL_ARGS_REGEX = re.compile(r'\\@:?')
# ALL_ARGS_RANGED_REGEX = re.compile(r'\\@(-?\d+)?:(-?\d+)?')
# ARGS_REGEX = re.compile(r'\\\d+')
# def GetAliases(store, user: user_pb2.User):
# def AddOrUpdateAlias(store, user: user_pb2.User, alias_name, alias_cmd):
# def RemoveAlias(store, user: user_pb2.User, alias_name):
# def ExpandAliases(store, user: user_pb2.User, msg: Text):
# def _ExpandAllSign(alias, msg_args):


import re
from absl import app
from absl import flags
from absl import logging
from hypebot import hypecore
from hypebot.commands import command_factory
from hypebot.core import params_lib
from hypebot.interfaces import interface_factory
from hypebot.plugins import alias_lib
from hypebot.protos import channel_pb2
from hypebot.protos import user_pb2
from typing import Text
    if self._params.interface:
      self._params.interface.Override({'name': self._params.name.lower()})
    self._params.Lock()

    # self.interface always maintains the connected interface that is listening
    # for messages. self._core.interface holds the interface desired for
    # outgoing communication. It may be swapped out on the fly, e.g., to handle
    # nested callbacks.
    self.interface = interface_factory.CreateFromParams(self._params.interface)
    self._InitCore()
    self.interface.RegisterHandlers(self.HandleMessage, self._core.user_tracker,
                                    self._core.user_prefs)

    # TODO: Factory built code change listener.

    self._commands = [
        command_factory.Create(name, params, self._core)
        for name, params in self._params.commands.AsDict().items()
        if params not in (None, False)
    ]

  def _InitCore(self):
    """Initialize hypecore.

    Broken out from __init__ so that subclasses can ensure the core is
    initialized before dependent things (e.g., commands) are constructed.

    We define initialization as the instantiation of all objects attached to
    core. However, the objects don't need to be fully loaded.
    """

# Path: hypebot/hypecore.py
# class RequestTracker(object):
# class OutputUtil(object):
# class UserPreferences(object):
# class Core(object):
#   _REQUEST_TIMEOUT_SEC = 60
#   _PREFS = {
#       'location': 'MTV',
#       'temperature_unit': 'F',
#       'stocks': 'GOOG,GOOGL',
#       # Comma separated list of your summoner names. First is considered main.
#       'lol_summoner': None,
#       'lol_region': 'NA',
#       '_dynamite_dm': None,
#       # Maps 'user/####' to '$ldap'.
#       '_dynamite_ldap': None,
#   }
#   _SUBKEY = 'preferences'
#   def __init__(self, reply_fn: Callable) -> None:
#   def HasPendingRequest(self, user: hype_types.User) -> bool:
#   def RequestConfirmation(self,
#                           user: hype_types.User,
#                           summary: Text,
#                           request_details: Dict,
#                           action_fn: Callable,
#                           parse_fn: Optional[Callable] = None) -> None:
#   def ResolveRequest(self, user: hype_types.User, user_msg: Text) -> None:
#   def __init__(self, output_fn: Callable) -> None:
#   def LogAndOutput(self, log_level: int, channel: channel_pb2.Channel,
#                    message: hype_types.CommandResponse) -> None:
#   def Output(self, channel: channel_pb2.Channel,
#              message: hype_types.CommandResponse) -> None:
#   def __init__(self, store: storage_lib.HypeStore):
#   def IsValid(self, pref: Text) -> bool:
#   def Get(self, user: user_pb2.User, pref: Text) -> Text:
#   def Set(self, user: user_pb2.User, pref: Text, value: Text) -> None:
#   def _Set(self, user: user_pb2.User, pref: Text, value: Text,
#            tx: storage_lib.HypeTransaction) -> None:
#   def GetAll(self, user: user_pb2.User) -> Dict[Text, Text]:
#   def __init__(
#       self,
#       params: Any,  # HypeParams
#       interface: interface_lib.BaseChatInterface) -> None:
#   def Reply(self,
#             channel: hype_types.Target,
#             msg: hype_types.CommandResponse,
#             default_channel: Optional[channel_pb2.Channel] = None,
#             limit_lines: bool = False,
#             max_public_lines: int = 6,
#             user: Optional[hype_types.User] = None,
#             log: bool = False,
#             log_level: int = logging.INFO) -> None:
#   def PublishMessage(self,
#                      topic: Text,
#                      msg: hype_types.CommandResponse,
#                      notice: bool = False) -> None:
#   def ReloadData(self) -> bool:
# 
# Path: hypebot/commands/command_factory.py

# 
# Path: hypebot/core/params_lib.py
# def _ParseChannel(channel):
# def _ParseChannels(channels):
#   def __init__(self, defaults=None):
#   def __str__(self):
#   def Override(self, params):
#   def _AssignValueConvertDict(self, key, value):
#   def _ParseDict(self, params):
#   def __setattr__(self, key, value):
#   def get(self, key, default_value=None):  # pylint: disable=invalid-name
#   def AsDict(self):
#   def Lock(self):
#   def _RaiseIfLocked(self):
# def MergeParams(defaults, *overrides):
# class HypeParams(object):
#   SPECIAL_ATTRS = ['_locked']
#   HAS_DYNAMIC_ATTRIBUTES = True
# 
# Path: hypebot/interfaces/interface_factory.py

# 
# Path: hypebot/plugins/alias_lib.py
# ALIAS_SUBKEY = 'user_aliases'
# ME_REGEX = re.compile(r'\\me\b')
# ALL_ARGS_REGEX = re.compile(r'\\@:?')
# ALL_ARGS_RANGED_REGEX = re.compile(r'\\@(-?\d+)?:(-?\d+)?')
# ARGS_REGEX = re.compile(r'\\\d+')
# def GetAliases(store, user: user_pb2.User):
# def AddOrUpdateAlias(store, user: user_pb2.User, alias_name, alias_cmd):
# def RemoveAlias(store, user: user_pb2.User, alias_name):
# def ExpandAliases(store, user: user_pb2.User, msg: Text):
# def _ExpandAllSign(alias, msg_args):


# Path: hypebot/basebot.py
import re
from absl import app
from absl import flags
from absl import logging
from hypebot import hypecore
from hypebot.commands import command_factory
from hypebot.core import params_lib
from hypebot.interfaces import interface_factory
from hypebot.plugins import alias_lib
from hypebot.protos import channel_pb2
from hypebot.protos import user_pb2
from typing import Text

    if self._params.interface:
      self._params.interface.Override({'name': self._params.name.lower()})
    self._params.Lock()

    # self.interface always maintains the connected interface that is listening
    # for messages. self._core.interface holds the interface desired for
    # outgoing communication. It may be swapped out on the fly, e.g., to handle
    # nested callbacks.
    self.interface = interface_factory.CreateFromParams(self._params.interface)
    self._InitCore()
    self.interface.RegisterHandlers(self.HandleMessage, self._core.user_tracker,
                                    self._core.user_prefs)

    # TODO: Factory built code change listener.

    self._commands = [
        command_factory.Create(name, params, self._core)
        for name, params in self._params.commands.AsDict().items()
        if params not in (None, False)
    ]

  def _InitCore(self):
    """Initialize hypecore.

    Broken out from __init__ so that subclasses can ensure the core is
    initialized before dependent things (e.g., commands) are constructed.

    We define initialization as the instantiation of all objects attached to
    core. However, the objects don't need to be fully loaded.
    """

    self._core = hypecore.Core(self._params, self.interface)