# Path: cardinal/exceptions.py
# class CardinalException(Exception):
# class LockInUseError(CardinalException):
# class PluginError(CardinalException):
# class CommandNotFoundError(CardinalException):
# class ConfigNotFoundError(CardinalException):
# class EventAlreadyExistsError(CardinalException):
# class EventDoesNotExistError(CardinalException):
# class EventCallbackError(CardinalException):
# class EventRejectedMessage(CardinalException):
# 
# Path: cardinal/plugins.py
# class PluginManager:
# class EventManager:
#     COMMAND_REGEX = re.compile(r'\.([A-Za-z0-9_-]+)\s?.*$')
#     def __init__(self,
#                  cardinal,
#                  plugins,
#                  blacklist,
#                  _plugin_module_import_prefix='plugins',
#                  _plugin_module_directory=None):
#     def __iter__(self):
#     def __next__(self):
#     def _import_module(self, plugin, suffix='plugin'):
#     def _instantiate_plugin(self, module, config=None):
#     def _register_plugin_callbacks(self, callbacks):
#         def rollback():
#     def _unregister_plugin_callbacks(self, plugin):
#     def _close_plugin_instance(self, plugin):
#     def _load_plugin_config(self, plugin):
#     def _get_plugin_commands(self, instance):
#     def _get_plugin_callbacks(self, instance):
#     def itercommands(self, channel=None):
#     def load(self, plugins):
#     def unload(self, plugins):
#     def unload_all(self):
#     def blacklist(self, plugin, channels):
#     def unblacklist(self, plugin, channels):
#     def get_config(self, plugin):
#     def call_command(self, user, channel, message):
#     def _call_command(self, command, user, channel, message):
#         def errback(failure):
#     def __init__(self, cardinal):
#     def register(self, name, required_params):
#     def remove(self, name):
#     def register_callback(self, event_name, callback):
#     def remove_callback(self, event_name, callback_id):
#     def fire(self, name, *params):
#             def success(_result, callback_id=callback_id):
#             def eventRejectedErrback(failure, callback_id=callback_id):
#             def errback(failure, callback_id=callback_id):
#     def _reduce_callback_accepted_statuses(results):
#     def _add_callback(self, event_name, callback):
#     def _generate_id(size=6, chars=string.ascii_uppercase + string.digits):
# 
# Path: cardinal/bot.py
# USER_REGEX = re.compile(r'^(.*?)!(.*?)@(.*?)$')
# UNLOCKED = 'unlocked'
# LOCKED = 'locked'
#     MINIMUM_RECONNECTION_WAIT = 10
#     MAXIMUM_RECONNECTION_WAIT = 300
# class CardinalBot(irc.IRCClient, object):
# class CardinalBotFactory(protocol.ClientFactory):
# class ChannelManager:
# class Channel:
#     def network(self):
#     def network(self, value):
#     def nickname(self):
#     def nickname(self, value):
#     def password(self):
#     def password(self, value):
#     def username(self):
#     def username(self, value):
#     def realname(self):
#     def realname(self, value):
#     def storage_path(self):
#     def __init__(self):
#     def signedOn(self):
#     def isupport(self, options):
#     def joined(self, channel):
#     def irc_RPL_CHANNELMODEIS(self, prefix, params):
#     def left(self, channel):
#     def kickedFrom(self, channel):
#     def lineReceived(self, line):
#     def irc_PRIVMSG(self, prefix, params):
#     def irc_NOTICE(self, prefix, params):
#     def irc_NICK(self, prefix, params):
#     def irc_TOPIC(self, prefix, params):
#     def irc_MODE(self, prefix, params):
#     def irc_JOIN(self, prefix, params):
#     def irc_PART(self, prefix, params):
#     def irc_KICK(self, prefix, params):
#     def irc_QUIT(self, prefix, params):
#     def irc_RPL_WHOREPLY(self, prefix, params):
#     def irc_RPL_ENDOFWHO(self, prefix, params):
#     def irc_INVITE(self, prefix, params):
#     def who(self, channel):
#     def config(self, plugin):
#     def sendMsg(self, channel, message, length=None):
#     def send(self, message):
#     def disconnect(self, message=''):
#     def disconnected(self):
#     def get_db(self, name, network_specific=True, default=None):
#         def db():
#     def get_user_tuple(string):
#     def reactor(self):
#     def __init__(self,
#                  network,
#                  server_password,
#                  server_commands,
#                  channels,
#                  nickname,
#                  password,
#                  username,
#                  realname,
#                  plugins,
#                  blacklist,
#                  storage):
#     def _sigint(self, signal, frame):
#     def clientConnectionLost(self, connector, reason):
#     def clientConnectionFailed(self, connector, reason):
#     def __init__(self, chanmodes, param_modes):
#     def __len__(self):
#     def __getitem__(self, key):
#     def __iter__(self):
#     def add(self, name):
#     def remove(self, name):
#     def set_modes(self, channel, modes, args):
#     def __init__(self, name):
#     def allows_color(self):
# 
# Path: cardinal/unittest_util.py
# @contextmanager
# def tempdir(name):
#     tempdir_path = os.path.join(tempfile.gettempdir(), name)
#     os.mkdir(tempdir_path)
#     try:
#         yield tempdir_path
#     finally:
#         shutil.rmtree(tempdir_path)


import logging
import os
import signal
import pytest
from datetime import datetime
from mock import Mock, call, patch
from twisted.internet import defer
from twisted.internet.task import Clock
from twisted.words.protocols.irc import ServerSupportedFeatures
from cardinal import exceptions, plugins
from cardinal.bot import (
    CardinalBot,
    CardinalBotFactory,
    ChannelManager,
    user_info,
)
from .unittest_util import tempdir





class TestCardinalBot:
    @patch('cardinal.bot.EventManager', autospec=True)
    def setup_method(self, method, mock_event_manager):

# Path: cardinal/exceptions.py
# class CardinalException(Exception):
# class LockInUseError(CardinalException):
# class PluginError(CardinalException):
# class CommandNotFoundError(CardinalException):
# class ConfigNotFoundError(CardinalException):
# class EventAlreadyExistsError(CardinalException):
# class EventDoesNotExistError(CardinalException):
# class EventCallbackError(CardinalException):
# class EventRejectedMessage(CardinalException):
# 
# Path: cardinal/plugins.py
# class PluginManager:
# class EventManager:
#     COMMAND_REGEX = re.compile(r'\.([A-Za-z0-9_-]+)\s?.*$')
#     def __init__(self,
#                  cardinal,
#                  plugins,
#                  blacklist,
#                  _plugin_module_import_prefix='plugins',
#                  _plugin_module_directory=None):
#     def __iter__(self):
#     def __next__(self):
#     def _import_module(self, plugin, suffix='plugin'):
#     def _instantiate_plugin(self, module, config=None):
#     def _register_plugin_callbacks(self, callbacks):
#         def rollback():
#     def _unregister_plugin_callbacks(self, plugin):
#     def _close_plugin_instance(self, plugin):
#     def _load_plugin_config(self, plugin):
#     def _get_plugin_commands(self, instance):
#     def _get_plugin_callbacks(self, instance):
#     def itercommands(self, channel=None):
#     def load(self, plugins):
#     def unload(self, plugins):
#     def unload_all(self):
#     def blacklist(self, plugin, channels):
#     def unblacklist(self, plugin, channels):
#     def get_config(self, plugin):
#     def call_command(self, user, channel, message):
#     def _call_command(self, command, user, channel, message):
#         def errback(failure):
#     def __init__(self, cardinal):
#     def register(self, name, required_params):
#     def remove(self, name):
#     def register_callback(self, event_name, callback):
#     def remove_callback(self, event_name, callback_id):
#     def fire(self, name, *params):
#             def success(_result, callback_id=callback_id):
#             def eventRejectedErrback(failure, callback_id=callback_id):
#             def errback(failure, callback_id=callback_id):
#     def _reduce_callback_accepted_statuses(results):
#     def _add_callback(self, event_name, callback):
#     def _generate_id(size=6, chars=string.ascii_uppercase + string.digits):
# 
# Path: cardinal/bot.py
# USER_REGEX = re.compile(r'^(.*?)!(.*?)@(.*?)$')
# UNLOCKED = 'unlocked'
# LOCKED = 'locked'
#     MINIMUM_RECONNECTION_WAIT = 10
#     MAXIMUM_RECONNECTION_WAIT = 300
# class CardinalBot(irc.IRCClient, object):
# class CardinalBotFactory(protocol.ClientFactory):
# class ChannelManager:
# class Channel:
#     def network(self):
#     def network(self, value):
#     def nickname(self):
#     def nickname(self, value):
#     def password(self):
#     def password(self, value):
#     def username(self):
#     def username(self, value):
#     def realname(self):
#     def realname(self, value):
#     def storage_path(self):
#     def __init__(self):
#     def signedOn(self):
#     def isupport(self, options):
#     def joined(self, channel):
#     def irc_RPL_CHANNELMODEIS(self, prefix, params):
#     def left(self, channel):
#     def kickedFrom(self, channel):
#     def lineReceived(self, line):
#     def irc_PRIVMSG(self, prefix, params):
#     def irc_NOTICE(self, prefix, params):
#     def irc_NICK(self, prefix, params):
#     def irc_TOPIC(self, prefix, params):
#     def irc_MODE(self, prefix, params):
#     def irc_JOIN(self, prefix, params):
#     def irc_PART(self, prefix, params):
#     def irc_KICK(self, prefix, params):
#     def irc_QUIT(self, prefix, params):
#     def irc_RPL_WHOREPLY(self, prefix, params):
#     def irc_RPL_ENDOFWHO(self, prefix, params):
#     def irc_INVITE(self, prefix, params):
#     def who(self, channel):
#     def config(self, plugin):
#     def sendMsg(self, channel, message, length=None):
#     def send(self, message):
#     def disconnect(self, message=''):
#     def disconnected(self):
#     def get_db(self, name, network_specific=True, default=None):
#         def db():
#     def get_user_tuple(string):
#     def reactor(self):
#     def __init__(self,
#                  network,
#                  server_password,
#                  server_commands,
#                  channels,
#                  nickname,
#                  password,
#                  username,
#                  realname,
#                  plugins,
#                  blacklist,
#                  storage):
#     def _sigint(self, signal, frame):
#     def clientConnectionLost(self, connector, reason):
#     def clientConnectionFailed(self, connector, reason):
#     def __init__(self, chanmodes, param_modes):
#     def __len__(self):
#     def __getitem__(self, key):
#     def __iter__(self):
#     def add(self, name):
#     def remove(self, name):
#     def set_modes(self, channel, modes, args):
#     def __init__(self, name):
#     def allows_color(self):
# 
# Path: cardinal/unittest_util.py
# @contextmanager
# def tempdir(name):
#     tempdir_path = os.path.join(tempfile.gettempdir(), name)
#     os.mkdir(tempdir_path)
#     try:
#         yield tempdir_path
#     finally:
#         shutil.rmtree(tempdir_path)


# Path: cardinal/test_bot.py
import logging
import os
import signal
import pytest
from datetime import datetime
from mock import Mock, call, patch
from twisted.internet import defer
from twisted.internet.task import Clock
from twisted.words.protocols.irc import ServerSupportedFeatures
from cardinal import exceptions, plugins
from cardinal.bot import (
    CardinalBot,
    CardinalBotFactory,
    ChannelManager,
    user_info,
)
from .unittest_util import tempdir






class TestCardinalBot:
    @patch('cardinal.bot.EventManager', autospec=True)
    def setup_method(self, method, mock_event_manager):

        self.cardinal = CardinalBot()