bpo-27351: Fix ConfigParser.read() documentation and docstring (GH-8123)

Switch "list" with "iterable" to match with the implementation.
This commit is contained in:
Zackery Spytz 2018-09-29 10:15:55 -06:00 committed by Brian Curtin
parent eef059657d
commit e45473e3ca
2 changed files with 10 additions and 9 deletions

View File

@ -963,16 +963,17 @@ ConfigParser Objects
.. method:: read(filenames, encoding=None) .. method:: read(filenames, encoding=None)
Attempt to read and parse a list of filenames, returning a list of Attempt to read and parse an iterable of filenames, returning a list of
filenames which were successfully parsed. filenames which were successfully parsed.
If *filenames* is a string, a :class:`bytes` object or a If *filenames* is a string, a :class:`bytes` object or a
:term:`path-like object`, it is treated as :term:`path-like object`, it is treated as
a single filename. If a file named in *filenames* cannot be opened, that a single filename. If a file named in *filenames* cannot be opened, that
file will be ignored. This is designed so that you can specify a list of file will be ignored. This is designed so that you can specify an
potential configuration file locations (for example, the current iterable of potential configuration file locations (for example, the
directory, the user's home directory, and some system-wide directory), current directory, the user's home directory, and some system-wide
and all existing configuration files in the list will be read. directory), and all existing configuration files in the iterable will be
read.
If none of the named files exist, the :class:`ConfigParser` If none of the named files exist, the :class:`ConfigParser`
instance will contain an empty dataset. An application which requires instance will contain an empty dataset. An application which requires

View File

@ -80,7 +80,7 @@ ConfigParser -- responsible for parsing a list of
Return list of configuration options for the named section. Return list of configuration options for the named section.
read(filenames, encoding=None) read(filenames, encoding=None)
Read and parse the list of named configuration files, given by Read and parse the iterable of named configuration files, given by
name. A single filename is also allowed. Non-existing files name. A single filename is also allowed. Non-existing files
are ignored. Return list of successfully read files. are ignored. Return list of successfully read files.
@ -677,13 +677,13 @@ class RawConfigParser(MutableMapping):
return list(opts.keys()) return list(opts.keys())
def read(self, filenames, encoding=None): def read(self, filenames, encoding=None):
"""Read and parse a filename or a list of filenames. """Read and parse a filename or an iterable of filenames.
Files that cannot be opened are silently ignored; this is Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential designed so that you can specify an iterable of potential
configuration file locations (e.g. current directory, user's configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing home directory, systemwide directory), and all existing
configuration files in the list will be read. A single configuration files in the iterable will be read. A single
filename may also be given. filename may also be given.
Return list of successfully read files. Return list of successfully read files.