8000 gh-96765: Update ConfigParser.read() docs with multi-file read example by timonviola · Pull Request #121664 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96765: Update ConfigParser.read() docs with multi-file read example #121664

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

Merged
merged 6 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: fix doc tests
  • Loading branch information
timonviola committed Jul 13, 2024
commit 31ba4f44c1a53d8e1fe25c29c7f1064af10f62d1
24 changes: 12 additions & 12 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ keys from the ``example.ini`` file.

.. doctest::

>>> config = configparser.ConfigParser()
>>> config['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> config_override = configparser.ConfigParser()
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> with open('override.ini', 'w') as configfile:
... config.write(configfile)
... config_override.write(configfile)
...
>>> config = configparser.ConfigParser()
>>> config.read(['example.ini','override.ini'])
>>> config_override = configparser.ConfigParser()
>>> config_override.read(['example.ini','override.ini'])
['example.ini', 'override.ini']
>>> print(config.get('DEFAULT', 'ServerAliveInterval'))
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
-1


Expand Down Expand Up @@ -1003,15 +1003,15 @@ ConfigParser Objects

.. doctest::

>>> config = configparser.ConfigParser()
>>> config['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> config_override = configparser.ConfigParser()
>>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
>>> with open('override.ini', 'w') as configfile:
... config.write(configfile)
... config_override.write(configfile)
...
>>> config = configparser.ConfigParser()
>>> config.read(['example.ini','override.ini'])
>>> config_override = configparser.ConfigParser()
>>> config_override.read(['example.ini','override.ini'])
['example.ini', 'override.ini']
>>> print(config.get('DEFAULT', 'ServerAliveInterval'))
>>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
-1

.. versionchanged:: 3.1
Expand Down
Loading
0