From d95098e7a67fea589d419023920c809ff1a759b8 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 2 May 2022 02:40:32 +0900 Subject: [PATCH] gh-92120: The docstring of enum.Enum is invalid in reST Closes #92120 --- Lib/enum.py | 42 +++++------ Lib/test/test_enum.py | 70 +++++++++---------- ...2-05-06-01-53-34.gh-issue-92122.96Lf2p.rst | 1 + 3 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2022-05-06-01-53-34.gh-issue-92122.96Lf2p.rst diff --git a/Lib/enum.py b/Lib/enum.py index 85245c95f9a9c7..35257c69c28b6d 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -501,20 +501,20 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k Access them by: - - attribute access:: + - attribute access: - >>> Color.RED - + >>> Color.RED + - value lookup: - >>> Color(1) - + >>> Color(1) + - name lookup: - >>> Color['RED'] - + >>> Color['RED'] + Enumerations can be iterated over, and know how many members they have: @@ -555,20 +555,20 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k Access them by: - - attribute access:: + - attribute access: - >>> %s.%s - <%s.%s: %r> + >>> %s.%s + <%s.%s: %r> - value lookup: - >>> %s(%r) - <%s.%s: %r> + >>> %s(%r) + <%s.%s: %r> - name lookup: - >>> %s[%r] - <%s.%s: %r> + >>> %s[%r] + <%s.%s: %r> Enumerations can be iterated over, and know how many members they have: @@ -1087,20 +1087,20 @@ class Enum(metaclass=EnumType): Access them by: - - attribute access:: + - attribute access: - >>> Color.RED - + >>> Color.RED + - value lookup: - >>> Color(1) - + >>> Color(1) + - name lookup: - >>> Color['RED'] - + >>> Color['RED'] + Enumerations can be iterated over, and know how many members they have: diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index b1b8e82b3859f2..aa0880ad0f2287 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -3832,20 +3832,20 @@ class Color(enum.Enum) |\x20\x20 | Access them by: |\x20\x20 - | - attribute access:: + | - attribute access: |\x20\x20 - | >>> Color.CYAN - | + | >>> Color.CYAN + | |\x20\x20 | - value lookup: |\x20\x20 - | >>> Color(1) - | + | >>> Color(1) + | |\x20\x20 | - name lookup: |\x20\x20 - | >>> Color['CYAN'] - | + | >>> Color['CYAN'] + | |\x20\x20 | Enumerations can be iterated over, and know how many members they have: |\x20\x20 @@ -4110,20 +4110,20 @@ class Single(Enum): Access them by: - - attribute access:: + - attribute access: - >>> Single.ONE - + >>> Single.ONE + - value lookup: - >>> Single(1) - + >>> Single(1) + - name lookup: - >>> Single['ONE'] - + >>> Single['ONE'] + Enumerations can be iterated over, and know how many members they have: @@ -4148,20 +4148,20 @@ class Double(Enum): Access them by: - - attribute access:: + - attribute access: - >>> Double.ONE - + >>> Double.ONE + - value lookup: - >>> Double(1) - + >>> Double(1) + - name lookup: - >>> Double['ONE'] - + >>> Double['ONE'] + Enumerations can be iterated over, and know how many members they have: @@ -4188,20 +4188,20 @@ class Triple(Enum): Access them by: - - attribute access:: + - attribute access: - >>> Triple.ONE - + >>> Triple.ONE + - value lookup: - >>> Triple(1) - + >>> Triple(1) + - name lookup: - >>> Triple['ONE'] - + >>> Triple['ONE'] + Enumerations can be iterated over, and know how many members they have: @@ -4228,20 +4228,20 @@ class Quadruple(Enum): Access them by: - - attribute access:: + - attribute access: - >>> Quadruple.ONE - + >>> Quadruple.ONE + - value lookup: - >>> Quadruple(1) - + >>> Quadruple(1) + - name lookup: - >>> Quadruple['ONE'] - + >>> Quadruple['ONE'] + Enumerations can be iterated over, and know how many members they have: diff --git a/Misc/NEWS.d/next/Library/2022-05-06-01-53-34.gh-issue-92122.96Lf2p.rst b/Misc/NEWS.d/next/Library/2022-05-06-01-53-34.gh-issue-92122.96Lf2p.rst new file mode 100644 index 00000000000000..d585535ee38d20 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-05-06-01-53-34.gh-issue-92122.96Lf2p.rst @@ -0,0 +1 @@ +Fix reStructuredText syntax errors in docstrings in the :mod:`enum` module.