# Path: cardinal/util.py
# def is_action(message):
# def parse_action(nick, message):
# def sleep(secs):
# def strip_formatting(line):
#         def white(text):
#         def black(text):
#         def blue(text):
#         def green(text):
#         def light_red(text):
#         def brown(text):
#         def purple(text):
#         def orange(text):
#         def yellow(text):
#         def light_green(text):
#         def cyan(text):
#         def light_cyan(text):
#         def light_blue(text):
#         def pink(text):
#         def grey(text):
#         def light_grey(text):
#     def bold(text):
#     def monospace(text):
#     def italic(text):
#     def strikethrough(text):
#     def underline(text):
# class formatting:
#     class color:
#     C = color
# F = formatting
# 
# 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/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def regex(expression):
#     if (not isinstance(expression, str) and
#             not isinstance(expression, _RETYPE)):
#         raise TypeError("Regular expression must be a string or regex type")
# 
#     def wrap(f):
#         f.regex = expression
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap
# 
# Path: cardinal/util.py
# F = formatting


import logging
import re
import requests
from twisted.internet import defer
from twisted.internet.threads import deferToThread
from cardinal import util
from cardinal.bot import user_info
from cardinal.decorators import command, regex, help
from cardinal.util import F
            for quote_currency, quote in coin['quote'].items():
                price = quote['price']
                if price >= 1:
                    price = round(price, 2)
                else:
                    price = float("%.4g" % price)

                cardinal.sendMsg(
                    channel,
                    "{} ({}) = {} {} - Daily Change (24h): {} "
                    "(Market Cap: {:,.2f} - Ranked #{})".format(
                        name, F.bold(symbol),
                        price, quote_currency,
                        colorize(quote['percent_change_24h']),
                        quote['market_cap'],
                        cmc_rank))

    @regex(CRYPTO_REGEX)
    @defer.inlineCallbacks
    def crypto_regex(self, cardinal, user, channel, message):
        """Hack to support relayed messages"""
        match = re.match(CRYPTO_REGEX, message)

        # this group should only be present when a relay bot is relaying a
        # message for another user
        if not match.group(1):
            return
        if not self.is_relay_bot(user):
            return


# Path: cardinal/util.py
# def is_action(message):
# def parse_action(nick, message):
# def sleep(secs):
# def strip_formatting(line):
#         def white(text):
#         def black(text):
#         def blue(text):
#         def green(text):
#         def light_red(text):
#         def brown(text):
#         def purple(text):
#         def orange(text):
#         def yellow(text):
#         def light_green(text):
#         def cyan(text):
#         def light_cyan(text):
#         def light_blue(text):
#         def pink(text):
#         def grey(text):
#         def light_grey(text):
#     def bold(text):
#     def monospace(text):
#     def italic(text):
#     def strikethrough(text):
#     def underline(text):
# class formatting:
#     class color:
#     C = color
# F = formatting
# 
# 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/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def regex(expression):
#     if (not isinstance(expression, str) and
#             not isinstance(expression, _RETYPE)):
#         raise TypeError("Regular expression must be a string or regex type")
# 
#     def wrap(f):
#         f.regex = expression
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap
# 
# Path: cardinal/util.py
# F = formatting


# Path: plugins/crypto/plugin.py
import logging
import re
import requests
from twisted.internet import defer
from twisted.internet.threads import deferToThread
from cardinal import util
from cardinal.bot import user_info
from cardinal.decorators import command, regex, help
from cardinal.util import F

            for quote_currency, quote in coin['quote'].items():
                price = quote['price']
                if price >= 1:
                    price = round(price, 2)
                else:
                    price = float("%.4g" % price)

                cardinal.sendMsg(
                    channel,
                    "{} ({}) = {} {} - Daily Change (24h): {} "
                    "(Market Cap: {:,.2f} - Ranked #{})".format(
                        name, F.bold(symbol),
                        price, quote_currency,
                        colorize(quote['percent_change_24h']),
                        quote['market_cap'],
                        cmc_rank))

    @regex(CRYPTO_REGEX)
    @defer.inlineCallbacks
    def crypto_regex(self, cardinal, user, channel, message):
        """Hack to support relayed messages"""
        match = re.match(CRYPTO_REGEX, message)

        # this group should only be present when a relay bot is relaying a
        # message for another user
        if not match.group(1):
            return
        if not self.is_relay_bot(user):
            return


        user = user_info(util.strip_formatting(match.group(1)),