[Python-checkins] [3.12] Fix indentation in `json.AttrDict` REPL example (GH-104930) (#104931)

AlexWaygood webhook-mailer at python.org
Thu May 25 09:16:35 EDT 2023


https://github.com/python/cpython/commit/b328ba194157ab5191d056608d35ab4353fc61af
commit: b328ba194157ab5191d056608d35ab4353fc61af
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: AlexWaygood <Alex.Waygood at Gmail.com>
date: 2023-05-25T14:16:20+01:00
summary:

[3.12] Fix indentation in `json.AttrDict` REPL example (GH-104930) (#104931)

Fix indentation in `json.AttrDict` REPL example (GH-104930)

This is causing the docs to be rendered incorrectly.
(cherry picked from commit 38539ef1267f26a8b3508fcc8c6199cf46fc300b)

Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>

files:
M Doc/library/json.rst

diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index a752efd7ef22..ef58dd094236 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -559,14 +559,14 @@ Exceptions
 
    .. doctest::
 
-        >>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
-        >>> orbital_period = json.loads(json_string, object_hook=AttrDict)
-        >>> orbital_period['earth']     # Dict style lookup
-        365
-        >>> orbital_period.earth        # Attribute style lookup
-        365
-        >>> orbital_period.keys()       # All dict methods are present
-        dict_keys(['mercury', 'venus', 'earth', 'mars'])
+       >>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
+       >>> orbital_period = json.loads(json_string, object_hook=AttrDict)
+       >>> orbital_period['earth']     # Dict style lookup
+       365
+       >>> orbital_period.earth        # Attribute style lookup
+       365
+       >>> orbital_period.keys()       # All dict methods are present
+       dict_keys(['mercury', 'venus', 'earth', 'mars'])
 
    Attribute style access only works for keys that are valid attribute
    names.  In contrast, dictionary style access works for all keys.  For



More information about the Python-checkins mailing list