-
-
Notifications
You must be signed in to change notification settings - Fork 410
quality: Docstring cleanup for pydocstyle prep #1978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -131,7 +131,7 @@ def scheduler(self): | |||||
|
||||||
@property | ||||||
def command_groups(self): | ||||||
"""A mapping of plugin names to lists of their commands. | ||||||
"""Map of plugin names to lists of their commands. | ||||||
|
||||||
.. versionchanged:: 7.1 | ||||||
This attribute is now generated on the fly from the registered list | ||||||
|
@@ -156,7 +156,7 @@ def command_groups(self): | |||||
|
||||||
@property | ||||||
def doc(self): | ||||||
"""A dictionary of command names to their documentation. | ||||||
"""Map of command names to their documentation. | ||||||
|
||||||
Each command is mapped to its docstring and any available examples, if | ||||||
declared in the plugin's code. | ||||||
|
@@ -188,7 +188,7 @@ def doc(self): | |||||
|
||||||
@property | ||||||
def hostmask(self): | ||||||
"""The current hostmask for the bot :class:`sopel.tools.target.User`. | ||||||
"""Get current hostmask for the bot :class:`sopel.tools.target.User`. | ||||||
|
||||||
:return: the bot's current hostmask | ||||||
:rtype: str | ||||||
|
@@ -823,7 +823,7 @@ def dispatch(self, pretrigger): | |||||
|
||||||
@property | ||||||
def running_triggers(self): | ||||||
"""Current active threads for triggers. | ||||||
"""Get current active threads for triggers. | ||||||
|
||||||
:return: the running thread(s) currently processing trigger(s) | ||||||
:rtype: :term:`iterable` | ||||||
|
@@ -853,7 +853,7 @@ def _update_running_triggers(self, running_triggers): | |||||
t for t in running_triggers if t.is_alive()] | ||||||
|
||||||
def on_scheduler_error(self, scheduler, exc): | ||||||
"""Called when the Job Scheduler fails. | ||||||
"""Handle failed Job Scheduler. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a clear case where compliance with a tool doesn't improve the quality, but decrease it. Two options here:
When is the important information, not what it does. |
||||||
|
||||||
:param scheduler: the job scheduler that errored | ||||||
:type scheduler: :class:`sopel.plugins.jobs.Scheduler` | ||||||
|
@@ -866,7 +866,7 @@ def on_scheduler_error(self, scheduler, exc): | |||||
self.error(exception=exc) | ||||||
|
||||||
def on_job_error(self, scheduler, job, exc): | ||||||
"""Called when a job from the Job Scheduler fails. | ||||||
"""Handle failed job from the Job Scheduler. | ||||||
|
||||||
:param scheduler: the job scheduler responsible for the errored ``job`` | ||||||
:type scheduler: :class:`sopel.plugins.jobs.Scheduler` | ||||||
|
@@ -881,9 +881,9 @@ def on_job_error(self, scheduler, job, exc): | |||||
self.error(exception=exc) | ||||||
|
||||||
def error(self, trigger=None, exception=None): | ||||||
"""Called internally when a plugin causes an error. | ||||||
r"""Handle uncaught plugin errors. | ||||||
|
||||||
:param trigger: the ``Trigger``\\ing line (if available) | ||||||
:param trigger: the ``Trigger``\ing line (if available) | ||||||
:type trigger: :class:`sopel.trigger.Trigger` | ||||||
:param Exception exception: the exception raised by the error (if | ||||||
available) | ||||||
|
@@ -933,7 +933,7 @@ def _nick_blocked(self, nick): | |||||
return False | ||||||
|
||||||
def _shutdown(self): | ||||||
"""Internal bot shutdown method.""" | ||||||
"""Shut down the bot.""" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's a private method, it's usually suggested to replace docstring with inline comments, such as this:
Suggested change
|
||||||
LOGGER.info('Shutting down') | ||||||
# Stop Job Scheduler | ||||||
LOGGER.info('Stopping the Job Scheduler.') | ||||||
|
@@ -1096,6 +1096,7 @@ class SopelWrapper(object): | |||||
to the sender (either a channel or in a private message) and even to | ||||||
:meth:`reply to someone<reply>` in a channel. | ||||||
""" | ||||||
|
||||||
def __init__(self, sopel, trigger, output_prefix=''): | ||||||
if not output_prefix: | ||||||
# Just in case someone passes in False, None, etc. | ||||||
|
@@ -1200,7 +1201,7 @@ def reply(self, message, destination=None, reply_to=None, notice=False): | |||||
self._bot.reply(message, destination, reply_to, notice) | ||||||
|
||||||
def kick(self, nick, channel=None, message=None): | ||||||
"""Override ``Sopel.kick`` to kick in a channel | ||||||
"""Override ``Sopel.kick`` to kick in a channel. | ||||||
|
||||||
:param str nick: nick to kick out of the ``channel`` | ||||||
:param str channel: optional channel to kick ``nick`` from | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ class ConfigurationError(Exception): | |
|
||
:param str value: a description of the error that has occurred | ||
""" | ||
|
||
def __init__(self, value): | ||
self.value = value | ||
|
||
|
@@ -92,6 +93,7 @@ class ConfigurationNotFound(ConfigurationError): | |
|
||
:param str filename: file path that could not be found | ||
""" | ||
|
||
def __init__(self, filename): | ||
super(ConfigurationNotFound, self).__init__(None) | ||
self.filename = filename | ||
|
@@ -118,6 +120,7 @@ class Config(object): | |
Sopel to run. All other sections must be defined later, by the code that | ||
needs them, using :meth:`define_section`. | ||
""" | ||
|
||
def __init__(self, filename, validate=True): | ||
self.filename = filename | ||
"""The config object's associated file.""" | ||
|
@@ -145,7 +148,7 @@ def __init__(self, filename, validate=True): | |
|
||
@property | ||
def homedir(self): | ||
"""The config file's home directory. | ||
"""Home directory for config file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto @ "property are not method from the reader pov". |
||
|
||
If the :attr:`core.homedir <.core_section.CoreSection.homedir>` setting | ||
is available, that value is used. Otherwise, the default ``homedir`` is | ||
|
@@ -215,11 +218,11 @@ def add_section(self, name): | |
return False | ||
|
||
def define_section(self, name, cls_, validate=True): | ||
"""Define the available settings in a section. | ||
r"""Define the available settings in a section. | ||
|
||
:param str name: name of the new section | ||
:param cls\\_: :term:`class` defining the settings within the section | ||
:type cls\\_: subclass of :class:`~.types.StaticSection` | ||
:param cls\_: :term:`class` defining the settings within the section | ||
:type cls\_: subclass of :class:`~.types.StaticSection` | ||
:param bool validate: whether to validate the section's values | ||
(optional; defaults to ``True``) | ||
:raise ValueError: if the section ``name`` has been defined already with | ||
|
@@ -260,16 +263,17 @@ def define_section(self, name, cls_, validate=True): | |
setattr(self, name, cls_(self, name, validate=validate)) | ||
|
||
class ConfigSection(object): | ||
"""Represents a section of the config file. | ||
r"""Represents a section of the config file. | ||
|
||
:param str name: name of this section | ||
:param items: key-value pairs | ||
:type items: :term:`iterable` of two-item :class:`tuple`\\s | ||
:type items: :term:`iterable` of two-item :class:`tuple`\s | ||
:param parent: this section's containing object | ||
:type parent: :class:`Config` | ||
|
||
Contains all keys in the section as attributes. | ||
""" | ||
|
||
def __init__(self, name, items, parent): | ||
object.__setattr__(self, '_name', name) | ||
object.__setattr__(self, '_parent', parent) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not keen on changing
@property
's docstring: from the documentation reader point of view, these are all attributes, and not methods.