comparison planemo/lib/python3.7/site-packages/aenum/CHANGES @ 0:d30785e31577 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:18:57 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d30785e31577
1 2.2.4
2 =====
3
4 add support to Constant to retrieve members by value
5
6 --> class K(Constant):
7 ... one = 1
8 ... two = 2
9
10 --> K.one
11 <K.one: 1>
12
13 --> K(1)
14 <K.one: 1>
15
16 add pickle/deepcopy support to Constant
17
18 add support for Constant to use other Constant values
19 (resulting members /are not/ the same)
20
21 --> class C(Constant)
22 ... one = K.one
23 ... three = 3
24
25 --> C.one == K.one
26 True
27
28 --> C.one is K.one
29 False
30
31 AutoNumber and auto() now work together
32
33 Enum members are now added to the class as enum_property, which supports
34 unshadowing of parent class attributes when called on an Enum member:
35
36 --> class StrEnum(str, Enum):
37 ... lower = 'lower'
38 ... upper = 'upper'
39 ... mixed = 'mixed'
40
41 --> StrEnum.lower
42 <StrEnum.lower: 'lower'>
43
44 --> StrEnum.lower.upper()
45 'LOWER'
46
47 --> StrEnum.upper
48 <StrEnum.upper: 'upper'>
49
50 --> StrEnum.upper.upper()
51 'UPPER'
52
53
54 2.2.3
55 =====
56
57 use members' type's methods __str__, __repr__, __format__, and
58 __reduce_ex__ if directly assigned in Enum class body; i.e.:
59
60 --> class Color(str, Enum):
61 ... red = 'red'
62 ... green = 'green'
63 ... blue = 'blue'
64 ... __str__ = str.__str__
65
66 --> print(repr(Color.green))
67 <Color.green: 'green'>
68
69 --> print(Color.green)
70 green
71
72
73 2.2.2
74 =====
75
76 replace _RouteClassAttributeToGetattr with enum_property (it is still
77 available as an alias)
78
79 support constant() and auto() being used together:
80
81 --> class Fruit(Flag):
82 ... _order_ = 'apple banana lemon orange'
83 ... apple = auto()
84 ... banana = auto()
85 ... lemon = auto()
86 ... orange = auto()
87 ... CitrusTypes = constant(lemon | orange)
88
89 --> list(Fruit)
90 [Fruit.apple, Fruit.banana, Fruit.lemon, Fruit.orange]
91
92 --> list(Fruit.CitrusTypes)
93 [Fruit.orange, Fruit.lemon]
94
95 --> Fruit.orange in Fruit.CitrusTypes
96 True
97
98
99 2.2.1
100 =====
101
102 allow Enums to be called without a value
103
104 class Color(Enum):
105 black = 0
106 red = 1
107 green = 2
108 blue = 3
109 #
110 @classmethod
111 def _missing_value_(cls, value):
112 if value is no_arg:
113 return cls.black
114
115 >>> Color()
116 <Color.black: 0>
117
118 allow Enum name use while constructing Enum (Python 3.4+ only)
119
120 --> class Color(Enum):
121 ... _order_ = 'BLACK WHITE'
122 ... BLACK = Color('black', '#000')
123 ... WHITE = Color('white', '#fff')
124 ... #
125 ... def __init__(self, label, hex):
126 ... self.label = label
127 ... self.hex = hex
128
129
130 2.2.0
131 =====
132
133 BREAKING CHANGE
134 ---------------
135 In Python 3+ classes defined inside an Enum no longer become members by
136 default; in Python 2 they still become members, but see below.
137
138 For cross-compatibility and full control two decorators are provided:
139
140 - @member --> forces item to become a member
141 - @nonmember --> excludes item from becoming a member
142
143 So to have an Enum that behaves the same in Python 2 and 3, use the
144 decorators (and other compatibility shims):
145
146 class Color(Enum):
147
148 _order_ = 'red green blue'
149
150 red = 1
151 green = 2
152 blue = 3
153
154 @nonmember
155 class Shades(Enum):
156
157 _order_ = 'light medium dark'
158
159 light = 1
160 medium = 2
161 dark = 3
162
163
164 2.1.4
165 =====
166
167 EnumMeta:
168 - change __member_new__ to __new_member__ (as the stdlib enum does)
169 - assign member name to enum() instances (an Enum helper for defining members)
170 - handle empty iterables when using functional API
171 - make auto() work with previous enum members
172 - keep searching mixins until base class is found
173
174 Enum:
175 - fix bug in Flag checks (ensure it is a Flag before checking the name)
176 - add multiple mixin support
177 - do not allow blank names (functional API)
178 - raise TypeError if _missing_* returns wrong type
179 - fix __format__ to honor custom __str__
180
181 extend_enum:
182 - support stdlib Enums
183 - use _generate_next_value_ if value not provided
184
185 general:
186 - standardize exception formatting
187 - use getfullargspec() in Python 3 (avoids deprecation warnings)
188
189
190 2.1.2
191 =====
192
193 when order is callable, save it for subclass use
194
195
196 2.1.1
197 =====
198
199 correctly raise TypeError for non-Enum containment checks
200 support combining names with | for Flag key access
201 support _order_ being a callable
202
203
204 2.1.0
205 =====
206
207 support Flags being combined with other data types:
208 - add _create_pseudo_member_values_
209 - add default __new__ and temporary _init_
210
211
212 2.0.10
213 ======
214
215 ensure _ignore_ is set when _settings_ specified in body which includes
216 AutoValue
217
218 make Flag members iterable
219
220
221 2.0.9
222 =====
223
224 fix missing comma in __all__
225 fix extend_enum with custom __new__ methods
226 fix MultiValue with AutoNumber without _init_
227
228
229 2.0.8
230 =====
231
232 extend_enum now handles aliases and multivalues correctly
233
234
235 2.0.7
236 =====
237
238 support mixin types with extend_enum
239 init and AutoNumber can now work together
240 add test for new Enum using EnumMeta
241 add tests for variations of multivalue and init
242 prevent deletion of NamedConstant.constant
243
244
245 2.0.6
246 =====
247
248 constants cannot be deleted (they already couldn't be changed)
249 constants can be used to define other constants
250
251
252 2.0.5
253 =====
254
255 _init_ and MultiValue can now work together
256
257
258 2.0.4
259 =====
260
261 _init_ and AutoValue (and _generate_next_value_) can now work together to
262 supply missing values even when some of the required values per member are
263 absent
264
265
266 2.0.3
267 =====
268
269 add _missing_value_ and _missing_name_ methods, deprecate _missing_
270 make enum instances comparable
271
272
273 2.0.2
274 =====
275
276 both EnumMeta.__getattr__ and Enum.__new__ fall back to _missing_
277
278
279 2.0.1
280 =====
281
282 auto() now works with other data types
283 AutoNumber supports legacy Enums (fixed regression)
284
285
286 2.0.0
287 =====
288
289 Flag and IntFlag added.
290
291
292 1.4.7
293 =====
294
295 fix %-interpolation bug
296 defined SqlLiteEnum only if sqlite exists
297 support pyflakes
298
299
300 1.4.6
301 =====
302
303 version numbering error
304
305
306 1.4.5
307 =====
308
309 revert AutoNumberEnum to custom __new__ instead of AutoNumber
310 use _ignore_ to shield against AutoNumber magic
311 inherit start and init settings from base Enums
312
313
314 1.4.4
315 =====
316
317 enabled export as a decorator
318 enabled _order_ to replace __order__
319 enabled python2 support for settings, init, and start
320
321
322 1.4.3
323 =====
324
325 support _ignore_ for dynamically creating class bodies
326
327
328 1.4.2
329 =====
330
331 MultiValue, NoAlias, Unique, and init now work with Python 2
332
333
334 1.4.1
335 =====
336
337 Py3: added Enum creation flags: Auto, MultiValue, NoAlias, Unique
338
339 fixed extend_enum to honor Enum flags
340
341
342 1.4.0
343 =====
344
345 When possible aenum inherits from Python's own enum.
346
347 Breaking change: enum members now default to evaluating as True to maintain
348 compatibility with the stdlib.
349
350 Add your own __bool__ (__nonzero__ in Python 2) if need this behavior:
351
352 def __bool__(self):
353 return bool(self.value)
354 __nonzero__ = __bool__
355