Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding=utf-8
"""Tasks that allow the bot to run, but aren't user-facing functionality

This is written as a module to make it easier to extend to support more
This is written as a plugin to make it easier to extend to support more
responses to standard IRC codes without having to shove them all into the
dispatch function in bot.py and making it easier to maintain.
"""
Expand Down Expand Up @@ -37,7 +37,7 @@
LOGGER = logging.getLogger(__name__)

batched_caps = {}
who_reqs = {} # Keeps track of reqs coming from this module, rather than others
who_reqs = {} # Keeps track of reqs coming from this plugin, rather than others


def setup(bot):
Expand Down
20 changes: 10 additions & 10 deletions sopel/irc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@ def log_raw(self, line, prefix):
logger = logging.getLogger('sopel.raw')
logger.info('\t'.join([prefix, line.strip()]))

def cap_req(self, module_name, capability, arg=None, failure_callback=None,
def cap_req(self, plugin_name, capability, arg=None, failure_callback=None,
success_callback=None):
"""Tell Sopel to request a capability when it starts.

:param str module_name: the module requesting the capability
:param str plugin_name: the plugin requesting the capability
:param str capability: the capability requested, optionally prefixed
with ``-`` or ``=``
:param str arg: arguments for the capability request
Expand All @@ -352,16 +352,16 @@ def cap_req(self, module_name, capability, arg=None, failure_callback=None,
By prefixing the capability with ``-``, it will be ensured that the
capability is not enabled. Similarly, by prefixing the capability with
``=``, it will be ensured that the capability is enabled. Requiring and
disabling is "first come, first served"; if one module requires a
disabling is "first come, first served"; if one plugin requires a
capability, and another prohibits it, this function will raise an
exception in whichever module loads second. An exception will also be
raised if the module is being loaded after the bot has already started,
exception in whichever plugin loads second. An exception will also be
raised if the plugin is being loaded after the bot has already started,
and the request would change the set of enabled capabilities.

If the capability is not prefixed, and no other module prohibits it, it
If the capability is not prefixed, and no other plugin prohibits it, it
will be requested. Otherwise, it will not be requested. Since
capability requests that are not mandatory may be rejected by the
server, as well as by other modules, a module which makes such a
server, as well as by other plugins, a plugin which makes such a
request should account for that possibility.

The actual capability request to the server is handled after the
Expand All @@ -377,7 +377,7 @@ def cap_req(self, module_name, capability, arg=None, failure_callback=None,
capability negotiation, or later.

If ``arg`` is given, and does not exactly match what the server
provides or what other modules have requested for that capability, it is
provides or what other plugins have requested for that capability, it is
considered a conflict.
"""
# TODO raise better exceptions
Expand All @@ -394,7 +394,7 @@ def cap_req(self, module_name, capability, arg=None, failure_callback=None,
'connection has been completed.')
if any((ent.prefix != '-' for ent in entry)):
raise Exception('Capability conflict')
entry.append(CapReq(prefix, module_name, failure_callback, arg,
entry.append(CapReq(prefix, plugin_name, failure_callback, arg,
success_callback))
self._cap_reqs[cap] = entry
else:
Expand All @@ -409,7 +409,7 @@ def cap_req(self, module_name, capability, arg=None, failure_callback=None,
# rejected it.
if any((ent.prefix == '-' for ent in entry)) and prefix == '=':
raise Exception('Capability conflict')
entry.append(CapReq(prefix, module_name, failure_callback, arg,
entry.append(CapReq(prefix, plugin_name, failure_callback, arg,
success_callback))
self._cap_reqs[cap] = entry

Expand Down
5 changes: 3 additions & 2 deletions sopel/irc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def safe(string):
class CapReq(object):
"""Represents a pending CAP REQ request.

:param str prefix: either ``=`` (must be enabled)
or ``-`` (must **not** be enabled)
:param str prefix: either ``=`` (must be enabled),
``-`` (must **not** be enabled),
or empty string (desired but optional)
:param str module: the requesting package/module name
:param failure: function to call if this capability request fails
:type failure: :term:`function`
Expand Down
6 changes: 6 additions & 0 deletions sopel/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ def setup_logging(settings):
dictConfig(logging_config)


@tools.deprecated(
reason='use sopel.tools.get_logger instead',
version='7.0',
warning_in='8.0',
removed_in='9.0',
)
def get_logger(name=None):
"""Return a logger for a module, if the name is given.

Expand Down
6 changes: 3 additions & 3 deletions sopel/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

.. versionadded:: 7.0

Sopel uses plugins (also called "modules") and uses what are called
Plugin Handlers as an interface between the bot and its plugins. This interface
is defined by the :class:`~.handlers.AbstractPluginHandler` abstract class.
Sopel uses what are called Plugin Handlers as an interface between the bot and
its plugins (formerly called "modules"). This interface is defined by the
:class:`~.handlers.AbstractPluginHandler` abstract class.

Plugins that can be used by Sopel are provided by :func:`~.get_usable_plugins`
in an :class:`ordered dict<collections.OrderedDict>`. This dict contains one
Expand Down
4 changes: 2 additions & 2 deletions sopel/plugins/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def __init__(self, filename):

def _load(self):
# The current implementation uses `imp.load_module` to perform the
# load action, which also reload the module. However, `imp` is
# load action, which also reloads the module. However, `imp` is
# deprecated in Python 3, so that might need to be changed when the
# support for Python 2 is dropped.
#
Expand Down Expand Up @@ -422,7 +422,7 @@ class EntryPointPlugin(PyModulePlugin):

In this example, the plugin ``custom`` is loaded from an entry point.
Unlike the :class:`~.PyModulePlugin`, the name is not derived from the
actual python module, but from its entry point's name.
actual Python module, but from its entry point's name.

.. seealso::

Expand Down