Commit Graph

25 Commits

Author SHA1 Message Date
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
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
0081f23a08 consistently use _name_ and _value_; patch from Kiss Gyorgy 2014-09-16 17:31:23 -07:00
Ethan Furman
2da950460d Close issue20653: improve functional API docs; minor code changes 2014-03-03 12:42:52 -08: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
be3c2fea35 removed Enum.__eq__ as it added nothing 2013-11-13 14:25:45 -08: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
33918c128b Issue19030: fixed comment that was still referring to a changed descriptor. 2013-09-27 23:02:02 -07:00
Ethan Furman
e03ea37a7b Close #19030: improvements to inspect and Enum.
inspect.getmembers and inspect.classify_class_attrs now search the metaclass
mro for types.DynamicClassAttributes (what use to be called
enum._RouteClassAttributeToGetattr); in part this means that these two
functions no longer rely solely on dir().

Besides now returning more accurate information, these improvements also
allow a more helpful help() on Enum classes.
2013-09-25 07:14:41 -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
Ezio Melotti
9a3777e525 #18705: merge with 3.3. 2013-08-17 15:53:55 +03: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