Module Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias alias alias alias alias alias alias alias ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad Expr Str Assign NameStore Num Expr Str Assign NameStore NameLoad Expr Str Assign NameStore NameLoad Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Str Assign NameStore Str Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str orelse If CompareIs NameLoad NameLoad body Return Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr AugAssignAdd AttributeStore NameLoad attr Num If CompareGt AttributeLoad NameLoad attr Call NameLoad NameLoad body Raise NameLoad Return SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index BinOpSub AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str Expr Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr NameLoad body Return Call NameLoad NameLoad orelse If Call NameLoad NameLoad NameLoad body Return Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If BoolOpOr UnaryOpNot Call NameLoad NameLoad Str UnaryOpNot Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr orelse If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad orelse Raise Call NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad For NameStore NameLoad body For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad For NameStore Call AttributeLoad SubscriptLoad NameLoad Index Str attr body For NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index NameLoad body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad NameLoad Expr Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index Str Index NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str If BoolOpAnd Call NameLoad NameLoad Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr orelse If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Num Str NameLoad Str TryExcept body Assign NameStore Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Num Str NameLoad Str TryExcept body Assign NameStore Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad orelse If NameLoad body Raise Call NameLoad Str Return NameLoad If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If BoolOpAnd Call NameLoad NameLoad BoolOpOr Call NameLoad NameLoad Str Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If BoolOpAnd Call NameLoad NameLoad Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr Dict Str Str AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If BoolOpAnd CompareIsNot NameLoad NameLoad CompareIn NameLoad SubscriptLoad NameLoad Index Str body Continue For NameStore SubscriptLoad NameLoad Index Str body Expr Yield NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad TryExcept body If CompareIn NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Assign NameStore NameLoad TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str orelse Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Continue Assign NameStore NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Continue ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Continue Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Continue If CompareIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Dict Str Str Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad ListLoad If NameLoad body AugAssignAdd AttributeStore AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Continue TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr ListComp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Return NameLoad Expr Call AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Return NameLoad Assign NameStore ListLoad For NameStore NameLoad body If CompareNotIn NameLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str body Expr Call AttributeLoad NameLoad attr NameLoad Continue Expr Call AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Str If CompareIs SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str NameLoad body Raise Call NameLoad Str Return SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpMod AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword AttributeLoad NameLoad attr For NameStore Call AttributeLoad NameLoad attr NameLoad body If BoolOpAnd Call NameLoad NameLoad Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore NameLoad Continue If UnaryOpNot NameLoad body Continue If BoolOpAnd Call NameLoad NameLoad Str CompareIn Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr body Assign NameStore NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Continue If BoolOpOr UnaryOpNot NameLoad NameLoad body Return Raise Call NameLoad BinOpMod Str NameLoad decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore NameLoad Expr Str Assign NameStore NameLoad Expr Str Assign NameStore NameLoad Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad If CompareIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad BinOpMod Str NameLoad If UnaryOpNot Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad Str Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Dict Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad BinOpMod Str NameLoad Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad If UnaryOpNot Call NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore BinOpAdd SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Num If Call AttributeLoad NameLoad attr NameLoad body AugAssignSub NameStore Num If BoolOpAnd CompareNotEq NameLoad NameLoad UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Return If CompareNotIn NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Return Delete SubscriptDel SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad Call NameLoad NameLoad NameLoad Assign NameStore NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body TryExcept body Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr While BoolOpAnd CompareIn NameLoad AttributeLoad NameLoad attr CompareIn NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Str Return Call AttributeLoad Str attr GeneratorExp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore Call NameLoad Num decorator_list decorator_list
N/A N/A os N/A sys N/A re N/A string N/A logging N/A importlib N/A inspect N/A linecache N/A random N/A json N/A yaml collections defaultdict cardinal.exceptions AmbiguousConfigError CommandNotFoundError ConfigNotFoundError EventAlreadyExistsError EventCallbackError EventDoesNotExistError EventRejectedMessage PluginError PluginManager N/A object N/A N/A Keeps track of, loads, and unloads plugins. N/A logger None N/A Logging object for PluginManager N/A iteration_counter 0 N/A Holds our current iteration point N/A cardinal None N/A Holds an instance of `CardinalBot` N/A plugins None N/A List of loaded plugins N/A command_regex N/A N/A re compile \.([A-Za-z0-9_-]+)\s?.*$ N/A Regex for matching standard commands.

    This will check for anything beginning with a period (.) followed by any
    alphanumeric character, then whitespace, then any character(s). This means
    registered commands will be found so long as the registered command is
    alphanumeric (or either _ or -), and any additional arguments will be up to
    the plugin for handling.
     N/A natural_command_regex %s:\s+([A-Za-z0-9_-]+)\s?.*$ N/A Regex for matching natural commands.

    This will check for anything beginning with the bot's nickname, a colon
    (:), whitespace, then an alphanumeric command. This may optionally be the
    end of the message, or there may be whitespace followed by any characters
    (additional arguments) which will be up to the plugin for handling.
     __init__ N/A N/A self cardinal plugins N/A None N/A N/A Creates a new instance, optionally with a list of plugins to load

        Keyword arguments:
          cardinal -- An instance of `CardinalBot` to pass to plugins.
          plugins -- A list of plugins to be loaded when instanced.

        Raises:
          TypeError -- When the `plugins` argument is not a list.

         N/A N/A self logger N/A N/A logging getLogger __name__ N/A N/A self plugins N/A N/A N/A self cardinal cardinal N/A N/A N/A plugins None N/A N/A isinstance plugins list N/A N/A N/A TypeError Plugins argument must be a list N/A N/A N/A plugins None N/A N/A N/A N/A N/A self load plugins N/A __iter__ N/A N/A self N/A N/A N/A Part of the iterator protocol, returns iterator object.

        In this case, this will return itself as it keeps track of the iterator
        internally. Before returning itself, the iteration counter will be
        reset to 0.

        Returns:
          PluginManager -- Returns the current instance.

         N/A N/A self iteration_counter 0 N/A self N/A next N/A N/A self N/A N/A N/A Part of the iterator protocol, returns the next plugin.

        Returns:
          dict -- Dictionary containing a plugin's data.

        Raises:
          StopIteration -- Raised when there are no plugins left.

         N/A keys N/A sorted N/A N/A N/A self plugins keys N/A N/A self iteration_counter 1 N/A N/A N/A self iteration_counter N/A len keys N/A N/A StopIteration N/A N/A N/A self plugins N/A N/A keys N/A N/A N/A self iteration_counter 1 N/A _import_module N/A N/A self module type N/A plugin N/A N/A Given a plugin name, will import it from its directory or reload it.

        If we are passing in a module, we can safely assume at this point that
        it's a plugin we've already loaded, so we just need to run reload() on
        it. However, if we're loading it fresh then we need to import it out
        of the plugins directory.

        Returns:
          object -- The module that was loaded.

         N/A N/A N/A linecache clearcache N/A N/A N/A inspect ismodule module N/A N/A N/A reload module N/A N/A N/A isinstance module basestring N/A N/A N/A N/A importlib import_module N/A plugins.%s.%s N/A module type N/A _create_plugin_instance N/A N/A self module config N/A None N/A N/A Creates an instance of the plugin module.

        If the setup() function of the plugin's module takes an argument then
        we will provide the instance of CardinalBot to the plugin. If it takes
        two, we will provide Cardinal, and its config.

        Keyword arguments:
          module -- The module to instantiate.
          config -- A config, if any, belonging to the plugin.

        Returns:
          object -- The instance of the plugin.

        Raises:
          PluginError -- When a plugin's setup function has more than one
            argument.
         N/A N/A N/A N/A hasattr module setup N/A N/A N/A inspect isfunction N/A module setup N/A N/A N/A PluginError Plugin does not have a setup function N/A argspec N/A N/A inspect getargspec N/A module setup N/A N/A N/A len N/A argspec args 0 N/A N/A instance N/A N/A module setup N/A N/A N/A N/A len N/A argspec args 1 N/A N/A instance N/A N/A module setup N/A self cardinal N/A N/A N/A N/A len N/A argspec args 2 N/A N/A instance N/A N/A module setup N/A self cardinal config N/A N/A N/A PluginError Unknown arguments for setup function N/A instance N/A _register_plugin_callbacks N/A N/A self callbacks N/A N/A N/A Registers callbacks found in a plugin

        Registers all event callbacks provided by _get_plugin_callbacks with
        EventManager. Callback IDs will be stored in callback_ids so we can
        remove them on unload. It is possible to have multiple methods as
        callbacks for a single event, and to use the same method as a callback
        for multiple events.

        Keyword arguments:
            callbacks - List of callbacks to register.

        Returns:
            dict -- Maps event names to a list of EventManager callback IDs.
         N/A callback_ids N/A defaultdict list N/A callback callbacks N/A N/A event_name N/A callback N/A event_names N/A N/A callback_id N/A N/A N/A N/A self cardinal event_manager register_callback event_name N/A callback N/A method N/A N/A N/A N/A callback_ids N/A event_name append callback_id N/A callback_ids N/A _unregister_plugin_callbacks N/A N/A self plugin N/A N/A N/A Unregisters all events found in a plugin.

        Will remove all callbacks stored in callback_ids from EventManager.

        Keyword arguments:
            plugin - The name of plugin to unregister events for.
         N/A plugin N/A N/A self plugins N/A plugin N/A event_name N/A N/A N/A plugin N/A callback_ids keys N/A N/A callback_id N/A N/A plugin N/A callback_ids N/A event_name N/A N/A N/A N/A N/A N/A self cardinal event_manager remove_callback event_name callback_id N/A N/A N/A N/A N/A plugin N/A callback_ids N/A event_name remove callback_id N/A _close_plugin_instance N/A N/A self plugin N/A N/A N/A Calls the close method on an instance of a plugin.

        If the plugin's module has a close() function, we will check whether
        it expects an instance of CardinalBot or not by checking whether it
        accepts an argument or not. If it does, we will pass in the instance of
        CardinalBot. This method is called just prior to removing the internal
        reference to the plugin's instance.

        Keyword arguments:
          plugin -- The name of the plugin to remove the instance of.

        Raises:
          PluginError -- When a plugin's close function has more than one
            argument.
         N/A instance N/A N/A N/A self plugins N/A plugin N/A instance N/A N/A N/A hasattr instance close N/A N/A inspect ismethod N/A instance close N/A N/A argspec N/A N/A inspect getargspec N/A instance close N/A N/A N/A len N/A argspec args 1 N/A N/A N/A N/A instance close N/A N/A N/A N/A len N/A argspec args 2 N/A N/A N/A N/A instance close N/A self cardinal N/A N/A N/A PluginError Unknown arguments for close function N/A _load_plugin_config N/A N/A self plugin N/A N/A N/A Loads a JSON or YAML config for a given plugin

        Keyword arguments:
          plugin -- Name of plugin to load config for.

        Raises:
          AmbiguousConfigError -- Raised when two configs exist for plugin.
          ConfigNotFoundError -- Raised when expected config isn't found.

         N/A json_config False N/A yaml_config False N/A file N/A N/A N/A os path join N/A N/A N/A os path dirname N/A N/A N/A os path realpath N/A N/A sys argv N/A 0 plugins plugin config.json N/A N/A N/A f N/A open file r N/A json_config N/A N/A json load f N/A N/A N/A f close N/A N/A N/A IOError N/A N/A N/A N/A N/A self logger debug N/A Can't open %s - maybe it doesn't exist? file N/A N/A ValueError N/A N/A N/A N/A N/A self logger warning N/A Invalid JSON in %s, skipping it file N/A file N/A N/A N/A os path join N/A N/A N/A os path dirname N/A N/A N/A os path realpath N/A N/A sys argv N/A 0 plugins plugin config.yaml N/A N/A N/A f N/A open file r N/A yaml_config N/A N/A yaml load f N/A N/A N/A f close N/A N/A N/A IOError N/A N/A N/A N/A N/A self logger debug N/A Can't open %s - maybe it doesn't exist? file N/A N/A ValueError N/A N/A N/A N/A N/A self logger warning N/A Invalid YAML in %s, skipping it file N/A N/A json_config N/A N/A N/A AmbiguousConfigError Found both a JSON and YAML config for plugin N/A yaml_config N/A N/A N/A yaml_config N/A json_config N/A N/A N/A ConfigNotFoundError N/A No config found for plugin: %s plugin N/A json_config N/A _get_plugin_commands N/A N/A self instance N/A N/A N/A Find the commands in a plugin and return them as callables.

        Keyword arguments:
          instance -- An instance of a plugin.

        Returns:
          list -- A list of callable commands.

         N/A commands N/A N/A method N/A dir instance N/A N/A method N/A getattr instance method N/A N/A N/A callable method N/A N/A hasattr method regex N/A hasattr method commands N/A N/A N/A N/A commands append method N/A commands N/A _get_plugin_callbacks N/A N/A self instance N/A N/A N/A Finds the event callbacks in a plugin and returns them as a list.

        Keyword arguments:
            instane -- An instance of plugin

        Returns:
            list -- A list of dictionaries holding event names and callable
                    methods.
         N/A callbacks N/A N/A method N/A dir instance N/A N/A method N/A getattr instance method N/A N/A N/A callable method N/A hasattr method events N/A N/A N/A N/A callbacks append N/A event_names method N/A method events method N/A callbacks N/A itercommands N/A N/A self channel N/A None N/A N/A Simple generator to iterate through all commands of loaded plugins.

        Returns:
          iterator -- Iterator for looping through commands
         N/A N/A name plugin N/A N/A N/A self plugins items N/A N/A N/A N/A channel None N/A channel N/A plugin N/A blacklist N/A N/A N/A command N/A plugin N/A commands N/A N/A N/A command N/A load N/A N/A self plugins N/A N/A N/A Takes either a plugin name or a list of plugins and loads them.

        This involves attempting to import the plugin's module, import the
        plugin's config module, instance the plugin's object, and finding its
        commands and events.

        Keyword arguments:
          plugins -- This can be either a single or list of plugin names.

        Returns:
          list -- A list of failed plugins, or an empty list.

        Raises:
          TypeError -- When the `plugins` argument is not a string or list.

         N/A N/A isinstance plugins basestring N/A N/A plugins N/A N/A N/A plugins encode utf-8 N/A N/A N/A isinstance plugins list N/A N/A N/A TypeError Plugins argument must be a string or list of plugins N/A failed_plugins N/A N/A plugin plugins N/A N/A reload_flag False N/A N/A N/A N/A self logger info N/A Attempting to load plugin: %s plugin N/A N/A N/A N/A plugin N/A N/A N/A self plugins keys N/A N/A N/A N/A N/A self logger info N/A Already loaded, reloading: %s plugin N/A reload_flag True N/A N/A N/A N/A N/A self _close_plugin_instance plugin N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Didn't close plugin cleanly: %s plugin N/A module_to_import N/A N/A N/A self plugins N/A plugin N/A module N/A N/A module_to_import plugin N/A module N/A N/A self _import_module module_to_import N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Could not load plugin module: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A config None N/A N/A N/A config N/A N/A self _load_plugin_config plugin N/A N/A N/A AmbiguousConfigError N/A N/A N/A N/A N/A self logger exception N/A Could not load plugin: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A N/A ConfigNotFoundError N/A N/A N/A N/A N/A self logger debug N/A No config found for plugin: %s plugin N/A N/A N/A instance N/A N/A self _create_plugin_instance module config N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Could not instantiate plugin: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A commands N/A N/A self _get_plugin_commands instance N/A callbacks N/A N/A self _get_plugin_callbacks instance N/A N/A N/A callback_ids N/A N/A self _register_plugin_callbacks callbacks N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Could not register events for plugin: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A N/A plugin N/A self plugins N/A N/A N/A N/A self unload plugin N/A N/A N/A self plugins N/A plugin N/A name module instance commands callbacks callback_ids config blacklist plugin module instance commands callbacks callback_ids config N/A N/A reload_flag N/A N/A N/A N/A self cardinal reloads 1 N/A N/A N/A N/A self logger info N/A Plugin %s successfully loaded plugin N/A failed_plugins N/A unload N/A N/A self plugins N/A N/A N/A Takes either a plugin name or a list of plugins and unloads them.

        Simply validates whether we have loaded a plugin by a given name, and
        if so, clears all the data associated with it.

        Keyword arguments:
          plugins -- This can be either a single or list of plugin names.

        Returns:
          list -- A list of failed plugins, or an empty list.

        Raises:
          TypeError -- When the `plugins` argument is not a string or list.

         N/A N/A isinstance plugins basestring N/A N/A plugins N/A N/A N/A plugins encode utf-8 N/A N/A N/A isinstance plugins list N/A N/A N/A TypeError Plugins must be a string or list of plugins N/A failed_plugins N/A N/A plugin plugins N/A N/A N/A N/A N/A self logger info N/A Attempting to unload plugin: %s plugin N/A N/A plugin N/A self plugins N/A N/A N/A N/A N/A self logger warning N/A Plugin was never loaded: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A N/A N/A N/A N/A self _unregister_plugin_callbacks plugin N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception Didn't remove all plugin callbacks: %s plugin N/A N/A N/A N/A N/A self _close_plugin_instance plugin N/A N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Didn't close plugin cleanly: %s plugin N/A N/A N/A failed_plugins append plugin N/A N/A N/A self plugins N/A plugin N/A failed_plugins N/A unload_all N/A N/A self N/A N/A N/A Unloads all loaded plugins.

        This should theoretically only be called when quitting Cardinal (or
        perhaps during a full reload) and therefore we don't need to really
        pay attention to any failed plugins.

         N/A N/A N/A N/A self logger info Unloading all plugins N/A N/A N/A self unload N/A plugin N/A N/A plugin data N/A N/A N/A self plugins items N/A blacklist N/A N/A self plugin channels N/A N/A N/A Blacklists a plugin from given channels.

        Keyword arguments:
          plugin -- Name of plugin whose blacklist to operate on
          channels -- A list of channels to add to the blacklist

        Returns:
          bool -- False if plugin doesn't exist.
         N/A N/A isinstance channels basestring N/A N/A channels N/A N/A N/A channels encode utf-8 N/A N/A N/A isinstance channels list N/A N/A N/A TypeError Plugins must be a string or list of plugins N/A N/A plugin N/A self plugins N/A N/A False N/A N/A N/A N/A N/A N/A self plugins N/A plugin N/A blacklist extend channels N/A True N/A unblacklist N/A N/A self plugin channels N/A N/A N/A Removes channels from a plugin's blacklist.

        Keyword arguments:
          plugin -- Name of plugin whose blacklist to operate on
          channels -- A list of channels to remove from the blacklist

        Returns:
          list/bool -- False if plugin doesn't exist, list of channels that
            weren't blacklisted in the first place if it does.
         N/A N/A isinstance channels basestring N/A N/A channels N/A N/A N/A channels encode utf-8 N/A N/A N/A isinstance channels list N/A N/A N/A TypeError Plugins must be a string or list of plugins N/A N/A plugin N/A self plugins N/A N/A False N/A not_blacklisted N/A N/A channel channels N/A N/A N/A channel N/A N/A N/A self plugins N/A plugin N/A blacklist N/A N/A N/A N/A not_blacklisted append channel N/A N/A N/A N/A N/A N/A N/A self plugins N/A plugin N/A blacklist remove channel N/A not_blacklisted N/A get_config N/A N/A self plugin N/A N/A N/A Returns a loaded config for given plugin.

        When a plugin is loaded, if a config is found, it will be stored in
        PluginManager. This method returns a given plugin's config, so it can
        be accessed elsewhere.

        Keyword arguments:
          plugin -- A string containing the name of a plugin.

        Returns:
          dict -- A dictionary containing the config.

        Raises:
          ConfigNotFoundError -- When no config exists for a given plugin name.
         N/A N/A plugin N/A self plugins N/A N/A N/A ConfigNotFoundError Couldn't find requested plugin config N/A N/A N/A N/A N/A self plugins N/A plugin N/A config None N/A N/A N/A ConfigNotFoundError Couldn't find requested plugin config N/A N/A N/A N/A self plugins N/A plugin N/A config N/A call_command N/A N/A self user channel message N/A N/A N/A Checks a message to see if it appears to be a command and calls it.

        This is done by checking both the `command_regex` and
        `natural_command_regex` properties on this object. If one or both of
        these tests succeeds, we then check whether any plugins have registered
        a matching command. If both of these tests fail, we will check whether
        any plugins have registered a custom regex expression matching the
        message.

        Keyword arguments:
          user -- A tuple containing a user's nick, ident, and hostname.
          channel -- A string representing where replies should be sent.
          message -- A string containing a message received by CardinalBot.

        Raises:
          CommandNotFoundError -- If the message appeared to be a command but
            no matching plugins are loaded.
         N/A called_command False N/A get_command N/A N/A re match N/A self command_regex message N/A N/A get_command N/A N/A get_command N/A N/A re match N/A N/A self natural_command_regex N/A N/A re escape N/A N/A self cardinal nickname message flags N/A re IGNORECASE N/A command N/A N/A self itercommands channel N/A N/A N/A N/A hasattr command regex N/A N/A re search N/A command regex message N/A N/A N/A command N/A self cardinal user channel message N/A called_command True N/A N/A N/A get_command N/A N/A N/A N/A N/A hasattr command commands N/A N/A N/A get_command group 1 N/A command commands N/A N/A called_command True N/A N/A command N/A self cardinal user channel message N/A N/A N/A N/A get_command called_command N/A N/A N/A N/A CommandNotFoundError N/A Command syntax detected, but no matching command found: %s message N/A N/A EventManager N/A object N/A N/A cardinal None N/A Instance of CardinalBot N/A registered_events None N/A Contains all the registered events N/A registered_callbacks None N/A Contains all the registered callbacks __init__ N/A N/A self cardinal N/A N/A N/A Initializes the logger N/A N/A self cardinal cardinal N/A N/A self logger N/A N/A logging getLogger __name__ N/A N/A self registered_events N/A defaultdict dict N/A N/A self registered_callbacks N/A defaultdict dict N/A register N/A N/A self name required_params N/A N/A N/A Registers a plugin's event so other events can set callbacks.

        Keyword arguments:
          name -- Name of the event.
          required_params -- Number of parameters a callback must take.

        Raises:
          EventAlreadyExistsError -- If register is attempted for an event name
            already in use.
          TypeError -- If required_params is not a number.
         N/A N/A N/A N/A self logger debug N/A Attempting to register event: %s name N/A N/A name N/A self registered_events N/A N/A N/A N/A N/A self logger debug N/A Event already exists: %s name N/A N/A EventAlreadyExistsError N/A Event already exists: %s name N/A N/A N/A isinstance required_params N/A int long N/A N/A N/A N/A N/A self logger debug N/A Invalid required params: %s name N/A N/A TypeError Required params must be an integer N/A N/A N/A self registered_events N/A name required_params N/A N/A name N/A self registered_callbacks N/A N/A N/A N/A self registered_callbacks N/A name N/A N/A N/A N/A N/A self logger info N/A Registered event: %s name N/A remove N/A N/A self name N/A N/A N/A Removes a registered event. N/A N/A N/A N/A self logger debug N/A Attempting to unregister event: %s name N/A N/A name N/A self registered_events N/A N/A N/A N/A N/A self logger debug N/A Event does not exist: %s name N/A N/A EventDoesNotExistError N/A Can't remove nonexistent event: %s name N/A N/A N/A self registered_events N/A name N/A N/A N/A self registered_callbacks N/A name N/A N/A N/A N/A self logger info N/A Removed event: %s name N/A register_callback N/A N/A self event_name callback N/A N/A N/A Registers a callback to be called when an event fires.

        Keyword arguments:
          event_name -- Event name to bind callback to.
          callback -- Callable to bind.

        Raises:
          EventCallbackError -- If an invalid callback is passed in.
         N/A N/A N/A N/A self logger debug N/A Attempting to register callback for event: %s event_name N/A N/A N/A callable callback N/A N/A N/A N/A N/A self logger debug N/A Invalid callback for event: %s event_name N/A N/A EventCallbackError Can't register callback that isn't callable N/A N/A event_name N/A self registered_events N/A N/A N/A N/A self _add_callback event_name callback N/A argspec N/A N/A inspect getargspec callback N/A num_func_args N/A len N/A argspec args N/A num_needed_args N/A N/A N/A self registered_events N/A event_name 1 N/A N/A N/A inspect ismethod callback N/A N/A num_func_args 1 N/A N/A N/A num_func_args num_needed_args N/A N/A argspec varargs N/A N/A N/A N/A N/A self logger debug N/A Invalid callback for event: %s event_name N/A N/A EventCallbackError N/A Can't register callback with wrong number of arguments (%d needed, %d given) N/A num_needed_args num_func_args N/A N/A N/A self _add_callback event_name callback N/A remove_callback N/A N/A self event_name callback_id N/A N/A N/A Removes a callback with a given ID from an event's callback list.

        Keyword arguments:
          event_name -- Event name to remove the callback from.
          callback_id -- The ID generated when the callback was added.
         N/A N/A N/A N/A self logger debug N/A Removing callback %s from callback list for event: %s N/A callback_id event_name N/A N/A event_name N/A self registered_callbacks N/A N/A N/A N/A N/A self logger debug N/A Callback %s: Event has no callback list callback_id N/A N/A N/A callback_id N/A N/A self registered_callbacks N/A event_name N/A N/A N/A N/A N/A self logger debug N/A Callback %s: Callback does not exist in callback list callback_id N/A N/A N/A N/A N/A self registered_callbacks N/A event_name N/A callback_id N/A N/A N/A N/A self logger info Removed callback %s for event: %s callback_id event_name N/A fire N/A N/A self name N/A params N/A N/A Calls all callbacks with given event name.

        Keyword arguments:
          name -- Event name to fire.
          params -- Params to pass to callbacks.

        Raises:
          EventDoesNotExistError -- If fire is called a nonexistent event.

        Returns:
          boolean -- Whether a callback (or multiple) was called successfully.
         N/A N/A N/A N/A self logger debug N/A Attempting to fire event: %s name N/A N/A name N/A self registered_events N/A N/A N/A N/A N/A self logger debug N/A Event does not exist: %s name N/A N/A EventDoesNotExistError N/A Can't call an event that does not exist: %s name N/A callbacks N/A N/A self registered_callbacks N/A name N/A N/A N/A N/A self logger debug N/A Calling %d callbacks for event: %s N/A N/A len callbacks name N/A accepted False N/A N/A callback_id callback N/A N/A callbacks iteritems N/A N/A N/A N/A N/A callback N/A self cardinal params N/A N/A N/A N/A self logger debug N/A Callback %s accepted event: %s N/A callback_id name N/A accepted True N/A N/A N/A EventRejectedMessage N/A N/A N/A N/A N/A self logger debug N/A Callback %s rejected event: %s N/A callback_id name N/A N/A Exception N/A N/A N/A N/A N/A self logger exception N/A Exception during callback %s for event: %s N/A callback_id name N/A accepted N/A _add_callback N/A N/A self event_name callback N/A N/A N/A Adds a callback to the event's callback list and returns an ID.

        Keyword arguments:
          event_name -- Event name to add the callback to.
          callback -- The callback to add.

        Returns:
          string -- A callback ID to reference the callback with for removal.
         N/A callback_id N/A N/A self _generate_id N/A N/A N/A event_name N/A self registered_callbacks N/A callback_id N/A N/A self registered_callbacks N/A event_name N/A N/A callback_id N/A N/A self _generate_id N/A N/A N/A N/A self registered_callbacks N/A event_name N/A callback_id callback N/A N/A N/A N/A self logger info N/A Registered callback %s for event: %s N/A callback_id event_name N/A callback_id N/A _generate_id N/A N/A size chars N/A 6 N/A N/A string ascii_uppercase N/A string digits N/A N/A 
        Thank you StackOverflow: http://stackoverflow.com/a/2257449/242129

        Generates a random, 6 character string of letters and numbers (by
        default.)
         N/A N/A N/A join N/A N/A N/A random choice chars N/A _ N/A range 6 N/A N/A