Skip to content

Commit 1daf6da

Browse files
committed
MERGE: Docs: Correctly link to the methods
2 parents 26c03bd + 647680e commit 1daf6da

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Doc/library/configparser.rst

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ Since this task is so common, config parsers provide a range of handy getter
150150
methods to handle integers, floats and booleans. The last one is the most
151151
interesting because simply passing the value to ``bool()`` would do no good
152152
since ``bool('False')`` is still ``True``. This is why config parsers also
153-
provide :meth:`getboolean`. This method is case-insensitive and recognizes
154-
Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``,
153+
provide :meth:`~ConfigParser.getboolean`. This method is case-insensitive and
154+
recognizes Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``,
155155
``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:
156156

157157
.. doctest::
@@ -163,8 +163,9 @@ Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``,
163163
>>> config.getboolean('bitbucket.org', 'Compression')
164164
True
165165

166-
Apart from :meth:`getboolean`, config parsers also provide equivalent
167-
:meth:`getint` and :meth:`getfloat` methods. You can register your own
166+
Apart from :meth:`~ConfigParser.getboolean`, config parsers also
167+
provide equivalent :meth:`~ConfigParser.getint` and
168+
:meth:`~ConfigParser.getfloat` methods. You can register your own
168169
converters and customize the provided ones. [1]_
169170

170171
Fallback Values
@@ -205,8 +206,9 @@ the ``fallback`` keyword-only argument:
205206
... fallback='No such things as monsters')
206207
'No such things as monsters'
207208

208-
The same ``fallback`` argument can be used with the :meth:`getint`,
209-
:meth:`getfloat` and :meth:`getboolean` methods, for example:
209+
The same ``fallback`` argument can be used with the
210+
:meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` and
211+
:meth:`~ConfigParser.getboolean` methods, for example:
210212

211213
.. doctest::
212214

@@ -670,14 +672,15 @@ the :meth:`__init__` options:
670672
* *converters*, default value: not set
671673

672674
Config parsers provide option value getters that perform type conversion. By
673-
default :meth:`getint`, :meth:`getfloat`, and :meth:`getboolean` are
674-
implemented. Should other getters be desirable, users may define them in
675-
a subclass or pass a dictionary where each key is a name of the converter and
676-
each value is a callable implementing said conversion. For instance, passing
677-
``{'decimal': decimal.Decimal}`` would add :meth:`getdecimal` on both the
678-
parser object and all section proxies. In other words, it will be possible
679-
to write both ``parser_instance.getdecimal('section', 'key', fallback=0)``
680-
and ``parser_instance['section'].getdecimal('key', 0)``.
675+
default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, and
676+
:meth:`~ConfigParser.getboolean` are implemented. Should other getters be
677+
desirable, users may define them in a subclass or pass a dictionary where each
678+
key is a name of the converter and each value is a callable implementing said
679+
conversion. For instance, passing ``{'decimal': decimal.Decimal}`` would add
680+
:meth:`getdecimal` on both the parser object and all section proxies. In
681+
other words, it will be possible to write both
682+
``parser_instance.getdecimal('section', 'key', fallback=0)`` and
683+
``parser_instance['section'].getdecimal('key', 0)``.
681684

682685
If the converter needs to access the state of the parser, it can be
683686
implemented as a method on a config parser subclass. If the name of this
@@ -690,11 +693,11 @@ be overridden by subclasses or by attribute assignment.
690693

691694
.. attribute:: BOOLEAN_STATES
692695

693-
By default when using :meth:`getboolean`, config parsers consider the
694-
following values ``True``: ``'1'``, ``'yes'``, ``'true'``, ``'on'`` and the
695-
following values ``False``: ``'0'``, ``'no'``, ``'false'``, ``'off'``. You
696-
can override this by specifying a custom dictionary of strings and their
697-
Boolean outcomes. For example:
696+
By default when using :meth:`~ConfigParser.getboolean`, config parsers
697+
consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``,
698+
``'on'`` and the following values ``False``: ``'0'``, ``'no'``, ``'false'``,
699+
``'off'``. You can override this by specifying a custom dictionary of strings
700+
and their Boolean outcomes. For example:
698701

699702
.. doctest::
700703

0 commit comments

Comments
 (0)