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