| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
search all bases for a __reduce__ style method; if a __new__ method is
found first the enum will be made unpicklable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-26649) (GH-26652)
This enables, for example, two base Enums to both inherit from `str`, and then both be mixed into the same final Enum:
class Str1Enum(str, Enum):
GH- some behavior here
class Str2Enum(str, Enum):
GH- some more behavior here
class FinalStrEnum(Str1Enum, Str2Enum):
GH- this now works
(cherry picked from commit 8a4f0850d75747af8c96ca0e7eef1f5c1abfba25)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
|
| |
released (GH-25350). (GH-25370)
(cherry picked from commit 8c14f5a787b21d5a1eae5d5ee981431d1c0e055f)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
| |
(GH-24155)
Solution to support calls to `__init_subclass__` with members defined is too brittle and breaks with certain mixins..
(cherry picked from commit a581a868d97f649aedf868a1d27865a10925c73a)
|
|
|
|
|
|
|
|
|
| |
for multiple inheritance support:
use super().new
pass **kwds to super().new
(cherry picked from commit 786d97a66cac48e7a933010367b8993a5b3ab85b)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
| |
(GH-23926)
* [3.9] [Enum] EnumMeta.__prepare__ now accepts **kwds (GH-23917).
(cherry picked from commit 6ec0adefad60ec7cdec61c44baecf1dccc1461ab)
|
|
|
|
|
|
|
|
| |
(GH-23714) (GH-23772)
When creating an Enum, `type.__new__` calls `__init_subclass__`, but at that point the members have not been added.
This patch suppresses the initial call, then manually calls the ancestor `__init_subclass__` before returning the new Enum class.
(cherry picked from commit 6bd94de168b58ac9358277ed6f200490ab26c174)
|
|
|
| |
private names will raise a DeprecationWarning; in 3.10 they will become normal attributes
|
|
|
|
|
| |
(cherry picked from commit 68526fe258da8c01196fd7cf48e8e5f1280bf8fd)
Co-authored-by: Angelin BOOZ <9497359+lem2clide@users.noreply.github.com>
|
|
|
| |
* [3.9] [Enum] reformat and add doc strings (GH-23705).
|
|
|
| |
(cherry picked from commit 37440eef7f9a0c27e13fc9ce0850574bb00688b0)
|
|
|
| |
(cherry picked from commit c266736ec1f9ebef38b134ceb4832df015711b38)
|
|
|
|
|
|
|
| |
fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
(cherry picked from commit c95ad7a91fbd7636f33a098d3b39964ab083bf49)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
| |
(cherry picked from commit fc23a9483ef0d7c98bea9f82392377d0b6ef7b18)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
|
|
|
| |
fix bug that let Enums be extended via multiple inheritance
(cherry picked from commit 3064dbf5df1021e85b507366a7ea448c8895efe7)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
|
|
|
| |
EnumMeta double-checks that `__repr__`, `__str__`, `__format__`, and `__reduce_ex__` are not the same as `object`'s, and replaces them if they are -- even if that replacement was intentionally done in the Enum being constructed. This patch fixes that.
|
|
|
| |
(cherry picked from commit bff01f3a3aac0c15fe8fbe8b2f561f7927d117a1)
|
|
|
| |
require `_generate_next_value_` to be defined before members
|
|
|
|
|
|
| |
* Improve the performance of _decompose() in enum.py
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
|
|
|
|
|
|
|
| |
creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.
See for example GH-13135
|
| |
|
|
|
|
|
| |
(GH-14809)
* Use __qualname__ instead of __name__ in enum exception messages.
|
|
|
|
|
| |
__str__ (GH-14545)
* bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Co-authored-by: Maxwell <maxwellpxt@gmail.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
https://bugs.python.org/issue35899
|
|
|
| |
https://bugs.python.org/issue17467
|
|
|
| |
bpo-35585: Speed up enum by-value lookup
|
| |
|
|
|
| |
* bpo-29577: allow multiple mixin classes
|
|
|
| |
* raise exception if _missing_ returns None or invalid type
|
|
|
|
|
| |
* Fix enum members getting shadowed by parent attributes
* Move Enum._convert to EnumMeta._convert_
* Deprecate _convert
|
|
|
| |
* bpo-33217: Raise TypeError for non-Enum lookups in Enums
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-31801: Enum: add _ignore_ as class option
_ignore_ is a list, or white-space seperated str, of names that will not
be candidates for members; these names, and _ignore_ itself, are removed
from the final class.
* bpo-31801: Enum: add documentation for _ignore_
* bpo-31801: Enum: remove trailing whitespace
* bpo-31801: Enum: fix bulleted list format
* bpo-31801: add version added for _ignore_
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* bpo-30616: Functional API of enum allows to create empty enums.
* Update NEWS
move addition to avoid conflict
|
| |
|
| |
|
|
|
|
| |
Guido; patch by Chris Angelico.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|