[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 38539ef126)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-05-25 06:16:20 -07:00 committed by GitHub
parent 1a47d11f35
commit b328ba1941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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