mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
gh-139487: add missing imports for standalone doctest Enum examples (#139488)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
This commit is contained in:
parent
75b1afe562
commit
f3d7faeafa
1 changed files with 6 additions and 2 deletions
|
|
@ -315,6 +315,7 @@ Data Types
|
|||
Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and
|
||||
any public methods defined on *self.__class__*::
|
||||
|
||||
>>> from enum import Enum
|
||||
>>> from datetime import date
|
||||
>>> class Weekday(Enum):
|
||||
... MONDAY = 1
|
||||
|
|
@ -341,7 +342,7 @@ Data Types
|
|||
A *staticmethod* that is used to determine the next value returned by
|
||||
:class:`auto`::
|
||||
|
||||
>>> from enum import auto
|
||||
>>> from enum import auto, Enum
|
||||
>>> class PowersOfThree(Enum):
|
||||
... @staticmethod
|
||||
... def _generate_next_value_(name, start, count, last_values):
|
||||
|
|
@ -373,7 +374,7 @@ Data Types
|
|||
A *classmethod* for looking up values not found in *cls*. By default it
|
||||
does nothing, but can be overridden to implement custom search behavior::
|
||||
|
||||
>>> from enum import StrEnum
|
||||
>>> from enum import auto, StrEnum
|
||||
>>> class Build(StrEnum):
|
||||
... DEBUG = auto()
|
||||
... OPTIMIZED = auto()
|
||||
|
|
@ -412,6 +413,7 @@ Data Types
|
|||
Returns the string used for *repr()* calls. By default, returns the
|
||||
*Enum* name, member name, and value, but can be overridden::
|
||||
|
||||
>>> from enum import auto, Enum
|
||||
>>> class OtherStyle(Enum):
|
||||
... ALTERNATE = auto()
|
||||
... OTHER = auto()
|
||||
|
|
@ -428,6 +430,7 @@ Data Types
|
|||
Returns the string used for *str()* calls. By default, returns the
|
||||
*Enum* name and member name, but can be overridden::
|
||||
|
||||
>>> from enum import auto, Enum
|
||||
>>> class OtherStyle(Enum):
|
||||
... ALTERNATE = auto()
|
||||
... OTHER = auto()
|
||||
|
|
@ -443,6 +446,7 @@ Data Types
|
|||
Returns the string used for *format()* and *f-string* calls. By default,
|
||||
returns :meth:`__str__` return value, but can be overridden::
|
||||
|
||||
>>> from enum import auto, Enum
|
||||
>>> class OtherStyle(Enum):
|
||||
... ALTERNATE = auto()
|
||||
... OTHER = auto()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue