Angelin BOOZ
68526fe258
bpo-40084: Enum - dir() includes member attributes (GH-19219)
2020-09-21 06:11:06 -07:00
Ethan Furman
7219e27087
Enum: make `Flag` and `IntFlag` members iterable (GH-22221)
2020-09-16 13:01:00 -07:00
Ethan Furman
fc23a9483e
_auto_called cleanup (GH-22285)
2020-09-16 12:37:54 -07:00
Ethan Furman
c95ad7a91f
bpo-39728: Enum: fix duplicate `ValueError` (GH-22277)
...
fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
2020-09-16 10:26:50 -07:00
Ethan Furman
3064dbf5df
bpo-41517: do not allow Enums to be extended ( #22271 )
...
fix bug that let Enums be extended via multiple inheritance
2020-09-16 07:11:57 -07:00
Ethan Furman
22415ad625
bpo-41789: honor object overrides in Enum classes (GH-22250)
...
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.
Automerge-Triggered-By: @ethanfurman
2020-09-15 16:28:25 -07:00
Ethan Furman
bff01f3a3a
bpo-39587: Enum - use correct mixed-in data type (GH-22263)
2020-09-15 15:56:26 -07:00
Ethan Furman
5a565b3d7c
minor reformat of enum tests (GH-22259)
...
Automerge-Triggered-By: @ethanfurman
2020-09-15 12:27:06 -07:00
Zackery Spytz
2ec67526a6
bpo-38967: Improve the error msg for reserved _sunder_ names in enum (GH-18370)
2020-09-13 13:27:51 -07:00
Hai Shi
e80697d687
bpo-40275: Adding threading_helper submodule in test.support (GH-20263)
2020-05-28 00:10:27 +02:00
Ethan Onstott
d9a43e20fa
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
...
require `_generate_next_value_` to be defined before members
2020-04-28 10:20:55 -07:00
Serhiy Storchaka
7d44e7a456
bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167)
2019-08-08 08:43:18 +03:00
Walter Dörwald
323842c279
bpo-34443: Use __qualname__ instead of __name__ in enum exception messages. (GH-14809)
...
* Use __qualname__ instead of __name__ in enum exception messages.
2019-07-18 11:37:13 -07:00
thatneat
2f19e82fbe
bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__ (GH-14545)
...
* bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__
2019-07-04 11:28:37 -07:00
Raymond Hettinger
62be33870e
bpo-36401: Have help() show readonly properties separately (GH-12517)
2019-03-24 17:07:47 -07:00
Brennan D Baraban
8b914d2767
bpo-35899: Fix Enum handling of empty and weird strings (GH-11891)
...
Co-authored-by: Maxwell <maxwellpxt@gmail.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
https://bugs.python.org/issue35899
2019-03-03 14:09:11 -08:00
Rémi Lapeyre
1fd06f1eca
bpo-35717: Fix KeyError exception raised when using enums and compile (GH-11523)
...
https://bugs.python.org/issue17467
2019-01-24 11:43:13 -08:00
Victor Stinner
4acf6c9d4b
bpo-34536: Cleanup test_enum imports (GH-9979)
...
sys and threading were imported twice.
2018-10-19 16:57:19 -07:00
Ethan Furman
cd45385ffa
bpo-34909: keep searching mixins until base class is found (GH-9737)
2018-10-05 23:29:36 -07:00
Ethan Furman
5bdab641da
bpo-29577: Enum: mixin classes don't mix well with already mixed Enums (GH-9328)
...
* bpo-29577: allow multiple mixin classes
2018-09-21 19:03:09 -07:00
Ethan Furman
019f0a0cb8
bpo-34536: raise error for invalid _missing_ results (GH-9147)
...
* raise exception if _missing_ returns None or invalid type
2018-09-12 11:43:34 -07:00
orlnub123
0fb9fadd3b
bpo-34282: Fix Enum._convert shadowing members named _convert (GH-8568)
...
* Fix enum members getting shadowed by parent attributes
* Move Enum._convert to EnumMeta._convert_
* Deprecate _convert
2018-09-12 10:28:53 -07:00
Rahul Jha
9430652535
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
...
* bpo-33217: Raise TypeError for non-Enum lookups in Enums
2018-09-10 11:21:04 -07:00
Ethan Furman
a4b1bb4801
bpo-31801: Enum: add _ignore_ as class option ( #5237 )
...
* 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_
2018-01-22 07:56:37 -08:00
Antoine Pitrou
a6a4dc816d
bpo-31370: Remove support for threads-less builds ( #3385 )
...
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Dong-hee Na
dcc8ce44c7
bpo-30616: Functional API of enum allows to create empty enums. ( #2304 )
...
* bpo-30616: Functional API of enum allows to create empty enums.
* Update NEWS
move addition to avoid conflict
2017-06-21 09:52:32 -07:00
Ethan Furman
0105606f55
issue29167: fix race condition in (Int)Flag
2017-01-24 12:13:34 -08:00
Ethan Furman
28cf663ff0
closes issue29167: fix race condition in (Int)Flag
2017-01-24 12:12:06 -08:00
Serhiy Storchaka
90f6332382
Issue #29338 : Fix test_enum.
2017-01-24 09:06:22 +02:00
Ethan Furman
23bb6f48ea
close issue28172: Change all example enum member names to uppercase, per Guido; patch by Chris Angelico.
2016-11-21 09:22:05 -08:00
Ethan Furman
3515dcce80
issue23591: fix flag decomposition and repr
2016-09-18 13:15:41 -07:00
Ethan Furman
c16595e567
issue23591: add auto() for auto-generating Enum member values
2016-09-10 23:36:59 -07:00
Ethan Furman
27682d2698
issue23591: more docs; slight change to repr
2016-09-04 11:39:01 -07:00
Ethan Furman
25d94bbf05
issue23591: bool(empty_flags) == False; more docs & tests
2016-09-02 16:32:32 -07:00
Ethan Furman
65a5a47d79
issue23591: add docs; code cleanup; more tests
2016-09-01 23:55:19 -07:00
Ethan Furman
ee47e5cf8a
issue23591: add Flags, IntFlags, and tests
2016-08-31 00:12:15 -07:00
Ethan Furman
e8e61277ff
issue26981: add _order_ compatibility shim to enum.Enum
2016-08-20 07:19:31 -07:00
Ethan Furman
332dbc7325
Issue26988: remove AutoEnum
2016-08-20 00:00:52 -07:00
Ethan Furman
73fc586d9f
Add AutoEnum: automatically provides next value if missing. Issue 26988.
2016-08-05 16:03:16 -07:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)
6f20bd6063
signal, socket, and ssl module IntEnum constant name lookups now return a
...
consistent name for values having multiple names. Ex: signal.Signals(6)
now refers to itself as signal.SIGALRM rather than flipping between that
and signal.SIGIOT based on the interpreter's hash randomization seed.
This helps finish issue27167.
2016-06-03 19:14:52 +00:00
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:37:58 +03:00
Serhiy Storchaka
1f364438ad
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:39:32 +03:00
Ethan Furman
354706915c
issue26893: use mro() to examine class heirarchy
2016-05-01 10:04:21 -07:00
Ethan Furman
3803ad47bb
issue26893: use mro() to examine class heirarchy
2016-05-01 10:03:53 -07:00
Ethan Furman
0fe7978c68
Issue26748: Enum classes should evaluate as True
2016-04-13 23:55:40 -07:00
Ethan Furman
de4e079d3d
Issue26748: Enum classes should evaluate as True
2016-04-13 23:53:45 -07:00
Ethan Furman
5de67b106a
Issue26748: Enum classes should evaluate as True
2016-04-13 23:52:09 -07:00
Ethan Furman
60255b67b9
revert change 87a9dff5106c: pure Enum members again evaluate to True;
...
update Finer Points section of docs to cover boolean evaluation;
add more tests for pure and mixed boolean evaluation
2016-01-15 15:01:33 -08:00
Martin Panter
19e69c5a20
Issue #23883 : Add missing APIs to __all__; patch by Jacek Kołodziej
2015-11-14 12:46:42 +00:00
Ethan Furman
6db1fd5fb8
Close issue24840: Enum._value_ is queried for bool(); original patch by Mike Lundy
2015-09-17 21:49:12 -07:00
Ethan Furman
48a724fa33
Close issue23900: add default __doc__ to new enumerations that do not specify one.
2015-04-11 23:23:06 -07:00
Ethan Furman
3323da92e7
Issue23826: fix doc test for -OO runs
2015-04-11 09:39:59 -07:00
Serhiy Storchaka
b599ca8cff
Fixed test_enum for issue #15582 .
2015-04-04 12:48:04 +03:00
Serhiy Storchaka
e50e780234
Issue #23611 : Fixed enums pickling tests. Now all picklings work with all
...
protocols.
2015-03-31 16:56:49 +03:00
Ethan Furman
24e837f231
issue23673
...
add private method to enum to support replacing global constants with Enum members:
- search for candidate constants via supplied filter
- create new enum class and members
- insert enum class and replace constants with members via supplied module name
- replace __reduce_ex__ with function that returns member name, so previous Python versions can unpickle
modify IntEnum classes to use new method
2015-03-18 17:27:57 -07:00
Ethan Furman
987f3dd161
Issue22506: merge from 3.4
2014-10-14 08:59:14 -07:00
Ethan Furman
0ae550bdde
Issue22506: added methods on base Enum class now show up in dir of Enum subclass (3.4)
2014-10-14 08:58:32 -07:00
Ethan Furman
d9925a18ec
Close issue21706: add 'start' parameter to functional API
2014-09-16 20:35:55 -07:00
Victor Stinner
4b0432d190
Issue #21773 : Fix TestStdLib.test_pydoc() of test_enum. Patch written by
...
Claudiu Popa.
The print_diffs() function was not defined, using the assertEqual() is more
reliable.
2014-06-16 22:48:43 +02:00
Ethan Furman
482fe0477e
issue23673
...
add private method to enum to support replacing global constants with Enum members:
- search for candidate constants via supplied filter
- create new enum class and members
- insert enum class and replace constants with members via supplied module name
- replace __reduce_ex__ with function that returns member name, so previous Python versions can unpickle
modify IntEnum classes to use new method
2015-03-18 18:19:30 -07:00
Ethan Furman
dc87052c0c
Close issue20653: allow Enum subclasses to override __reduce_ex__
2014-02-18 12:37:12 -08:00
Ethan Furman
ca1b794dac
Close issue20534: all pickle protocols now supported.
2014-02-08 11:36:27 -08:00
Ethan Furman
2ddb39a695
Close issue20534: test_enum now tests all supported pickle protocols (2 - HIGHEST_PROTOCOL, inclusive).
2014-02-06 17:28:50 -08:00
Ethan Furman
be3c2fea35
removed Enum.__eq__ as it added nothing
2013-11-13 14:25:45 -08:00
Ethan Furman
5875d74748
Close #19263 : add tests to ensure __objclass__ correctly set.
2013-10-21 20:45:55 -07:00
Ethan Furman
1a16288197
Close #19252 : better test coverage for Enum. Thanks, CliffM
2013-10-16 19:09:31 -07:00
Ethan Furman
648f860c22
Close #19156 : add tests and fix for Enum helper edge cases. Patch from CliffM.
2013-10-06 17:19:54 -07:00
Ethan Furman
64a9972b40
Close #19025 : Better error message when trying to delete an Enum member.
...
Also slight code reorg for PEP 8 guidelines.
2013-09-22 16:18:19 -07:00
Ethan Furman
c850f34220
Close #18693 : Enum is now more help() friendly.
2013-09-15 16:59:35 -07:00
Ethan Furman
101e0746d3
Close #18989 : enum members will no longer overwrite other attributes, nor be overwritten by them.
2013-09-15 12:34:36 -07:00
Ethan Furman
2131a4a2fc
Add __reversed__ to Enum. Minor code reorg (moved __members__ to be in alpha order).
2013-09-14 18:11:24 -07:00
Ethan Furman
f203f2d51d
Close #18924 : Block naive attempts to change an Enum member.
2013-09-06 07:16:48 -07:00
Ethan Furman
ec15a826ce
Close #18738 : Route __format__ calls to mixed-in type for mixed Enums (such as IntEnum).
2013-08-31 19:17:41 -07:00
Ethan Furman
388a3921cf
Issue 18693: Put custom __dir__ back in place. Will instead look at fixing `help()`.
2013-08-12 06:51:41 -07:00
Ethan Furman
53f58dbd12
Close #18693 : __dir__ removed from Enum; help() now helpful.
2013-08-10 13:07:49 -07:00
Ethan Furman
5e5a8230c2
Close #18635 : Move class level private attribute from instance to class.
2013-08-04 08:42:23 -07:00
Ethan Furman
b41803e3ef
Close #18545 : now only executes member_type if no _value_ is assigned in __new__.
2013-07-25 13:50:45 -07:00
Ethan Furman
520ad57916
Change _names to _names_ since the latter is reserved for Enum use.
...
Before this change only the methods were _single_underscored_; now
the attributes are as well.
2013-07-19 19:47:21 -07:00
Ethan Furman
2aa2732eaf
Close #18508 -- fix _value2member_map to always have the member's value
2013-07-19 19:35:56 -07:00
Ethan Furman
f24bb35a69
closes issue18042 -- a `unique` decorator is added to enum.py
...
The docs also clarify the 'Interesting Example' duplicate-free enum is for
demonstration purposes.
2013-07-18 17:05:39 -07:00
Ethan Furman
6b3d64ab5d
Closes issue 17947. Adds PEP-0435 (Adding an Enum type to the Python standard library).
...
Missing files added.
News entry added.
2013-06-14 16:55:46 -07:00