Commit Graph

26 Commits

Author SHA1 Message Date
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 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