| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -315,6 +315,7 @@ Data Types | |||
| 315 | 315 | Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and | |
| 316 | 316 | any public methods defined on *self.__class__*:: | |
| 317 | 317 | ||
| 318 | + >>> from enum import Enum | ||
| 318 | 319 | >>> from datetime import date | |
| 319 | 320 | >>> class Weekday(Enum): | |
| 320 | 321 | ... MONDAY = 1 | |
@@ -341,7 +342,7 @@ Data Types | |||
| 341 | 342 | A *staticmethod* that is used to determine the next value returned by | |
| 342 | 343 | :class:`auto`:: | |
| 343 | 344 | ||
| 344 | - >>> from enum import auto | ||
| 345 | + >>> from enum import auto, Enum | ||
| 345 | 346 | >>> class PowersOfThree(Enum): | |
| 346 | 347 | ... @staticmethod | |
| 347 | 348 | ... def _generate_next_value_(name, start, count, last_values): | |
@@ -373,7 +374,7 @@ Data Types | |||
| 373 | 374 | A *classmethod* for looking up values not found in *cls*. By default it | |
| 374 | 375 | does nothing, but can be overridden to implement custom search behavior:: | |
| 375 | 376 | ||
| 376 | - >>> from enum import StrEnum | ||
| 377 | + >>> from enum import auto, StrEnum | ||
| 377 | 378 | >>> class Build(StrEnum): | |
| 378 | 379 | ... DEBUG = auto() | |
| 379 | 380 | ... OPTIMIZED = auto() | |
@@ -412,6 +413,7 @@ Data Types | |||
| 412 | 413 | Returns the string used for *repr()* calls. By default, returns the | |
| 413 | 414 | *Enum* name, member name, and value, but can be overridden:: | |
| 414 | 415 | ||
| 416 | + >>> from enum import auto, Enum | ||
| 415 | 417 | >>> class OtherStyle(Enum): | |
| 416 | 418 | ... ALTERNATE = auto() | |
| 417 | 419 | ... OTHER = auto() | |
@@ -428,6 +430,7 @@ Data Types | |||
| 428 | 430 | Returns the string used for *str()* calls. By default, returns the | |
| 429 | 431 | *Enum* name and member name, but can be overridden:: | |
| 430 | 432 | ||
| 433 | + >>> from enum import auto, Enum | ||
| 431 | 434 | >>> class OtherStyle(Enum): | |
| 432 | 435 | ... ALTERNATE = auto() | |
| 433 | 436 | ... OTHER = auto() | |
@@ -443,6 +446,7 @@ Data Types | |||
| 443 | 446 | Returns the string used for *format()* and *f-string* calls. By default, | |
| 444 | 447 | returns :meth:`__str__` return value, but can be overridden:: | |
| 445 | 448 | ||
| 449 | + >>> from enum import auto, Enum | ||
| 446 | 450 | >>> class OtherStyle(Enum): | |
| 447 | 451 | ... ALTERNATE = auto() | |
| 448 | 452 | ... OTHER = auto() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments