Skip to content

Commit

Permalink
doc: add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Exirel committed Apr 29, 2019
1 parent 7bfee1a commit 52a0d5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 14 additions & 6 deletions sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def setup(self):
load_error = 0
load_disabled = 0

stderr("\nWelcome to Sopel. Loading modules...\n\n")
stderr("Welcome to Sopel. Loading modules...")
usable_plugins = plugins.get_usable_plugins(self.config)
for name, info in usable_plugins.items():
plugin, is_enabled = info
Expand Down Expand Up @@ -219,13 +219,21 @@ def setup(self):

total = sum([load_success, load_error, load_disabled])
if total and load_success:
stderr('\n\nRegistered %d modules\n\n' % (load_success - 1))
stderr('%d modules failed to load\n\n' % load_error)
stderr('%d modules disabled\n\n' % load_disabled)
stderr('Registered %d modules' % (load_success - 1))
stderr('%d modules failed to load' % load_error)
stderr('%d modules disabled' % load_disabled)
else:
stderr("Warning: Couldn't load any modules")

def reload_plugin(self, name):
"""Reload a plugin
:param str name: name of the plugin to reload
:raise PluginNotRegistered: when there is no ``name`` plugin registered
It runs the plugin's shutdown routine and unregisters it. Then it
reloads it, runs its setup routines, and registers it again.
"""
if not self.has_plugin(name):
raise plugins.exceptions.PluginNotRegistered(name)

Expand All @@ -243,8 +251,8 @@ def reload_plugin(self, name):
def reload_plugins(self):
"""Reload all plugins
First it runs all plugin shutdown routines & unregisters all plugins.
Then it reloads them, runs their setup routines, and registers them
First, run all plugin shutdown routines and unregister all plugins.
Then reload all plugins, run their setup routines, and register them
again.
"""
registered = list(self._plugins.items())
Expand Down
4 changes: 3 additions & 1 deletion sopel/plugins/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# coding=utf-8
"""Sopel's plugins exceptions."""
from __future__ import unicode_literals, absolute_import, print_function, division


class PluginError(Exception):
pass
"""Base class for plugin related exceptions."""


class PluginNotRegistered(PluginError):
"""Exception raised when a plugin is not registered."""
def __init__(self, name):
message = 'Plugin "%s" not registered' % name
self.plugin_name = name
Expand Down

0 comments on commit 52a0d5d

Please sign in to comment.