Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Florian Strzelecki <florian.strzelecki@gmail.com>
  • Loading branch information
dgw and Exirel authored Oct 23, 2019
1 parent 519b652 commit c916d0e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sopel/config/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def configure_setting(self, name, prompt, default=NO_DEFAULT):


class BaseValidated(object):
"""The base type for a setting descriptor in a :class:`StaticSection`
"""The base type for a setting descriptor in a :class:`StaticSection`.
:param str name: the attribute name to use in the config file
:param default: the value to be returned if the setting has no value;
Expand Down Expand Up @@ -192,7 +192,7 @@ def _serialize_boolean(value):


class ValidatedAttribute(BaseValidated):
"""A descriptor for settings in a ``StaticSection``
"""A descriptor for settings in a :class:`StaticSection`.
:param str name: the attribute name to use in the config file
:param parse: a function to be used to read the string and create the
Expand All @@ -215,15 +215,15 @@ def __init__(self, name, parse=None, serialize=None, default=None):
self.default = default

def serialize(self, value):
"""Returns the ``value`` as a Unicode string.
"""Return the ``value`` as a Unicode string.
:param value: the option value
:rtype: str
"""
return unicode(value)

def parse(self, value):
"""No-op: simply returns the given `value``, unchanged.
"""No-op: simply returns the given ``value``, unchanged.
:param str value: the string read from the config file
:rtype: str
Expand Down Expand Up @@ -395,7 +395,7 @@ def __init__(self, name, choices, default=None):
self.choices = choices

def parse(self, value):
"""Checks the loaded ``value`` against the valid ``choices``
"""Check the loaded ``value`` against the valid ``choices``.
:param str value: the value loaded from the config file
:return: the ``value``, if it is valid
Expand All @@ -408,7 +408,7 @@ def parse(self, value):
raise ValueError('Value must be in {}'.format(self.choices))

def serialize(self, value):
"""Make sure ``value`` is valid and safe to write in the config file
"""Make sure ``value`` is valid and safe to write in the config file.
:param str value: the value needing to be saved
:return: the ``value``, if it is valid
Expand Down Expand Up @@ -482,7 +482,7 @@ def configure(self, prompt, default, parent, section_name):
return self.parse(parent, section_name, value)

def parse(self, main_config, this_section, value):
"""Used to validate ``value`` when loading the config
"""Used to validate ``value`` when loading the config.
:param main_config: the config object which contains this attribute
:type main_config: :class:`~sopel.config.Config`
Expand Down Expand Up @@ -516,7 +516,7 @@ def parse(self, main_config, this_section, value):
return value

def serialize(self, main_config, this_section, value):
"""Used to validate ``value`` when it is changed at runtime
"""Used to validate ``value`` when it is changed at runtime.
:param main_config: the config object which contains this attribute
:type main_config: :class:`~sopel.config.Config`
Expand Down

0 comments on commit c916d0e

Please sign in to comment.