Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants
WARNING: Version 3.1 has breaking changes in custom Enum settings
WARNING:
WARNING: AutoNumber has been removed
WARNING: AutoValue has been removed
aenum includes a Python stdlib Enum-compatible data type, as well as a metaclass-based NamedTuple implementation and a NamedConstant class.
An Enum is a set of symbolic names (members) bound to unique, constant values. Within an enumeration, the members can be compared by identity, and the enumeration itself can be iterated over. Support exists for unique values, multiple values, auto-numbering, and suspension of aliasing (members with the same value are not identical), plus the ability to have values automatically bound to attributes.
A NamedTuple is a class-based, fixed-length tuple with a name for each possible position accessible using attribute-access notation as well as the standard index notation.
A NamedConstant is a class whose members cannot be rebound; it lacks all other Enum capabilities, however.
Enum classes:
- Enum: Base class for creating enumerated constants.
- IntEnum: Base class for creating enumerated constants that are also
subclasses of int.
- Flag: Base class for creating enumerated constants that can be combined
using the bitwise operations without losing their Flag membership.
- IntFlag: Base class for creating enumerated constants that can be combined
using the bitwise operators without losing their IntFlag membership.
IntFlag members are also subclasses of int.
- AutoNumberEnum: Derived class that automatically assigns an int value to each
member.
- OrderedEnum: Derived class that adds <, <=, >=, and > methods to an Enum.
- UniqueEnum: Derived class that ensures only one name is bound to any one
value.
Utility functions include:
- convert: helper to convert target global variables into an Enum
- constant: helper class for creating constant members
- enum: helper class for creating members with keywords
- enum_property: property to enable enum members to have same named attributes
(e.g. `name` and `value`)
- export: helper to insert Enum members into a namespace (usually globals())
- extend_enum: add new members to enumerations after creation
- module: inserts NamedConstant and Enum classes into sys.modules
where it will appear to be a module whose top-level names
cannot be rebound
- skip: class that prevents attributes from being converted to a
constant or enum member
- unique: decorator that ensures no duplicate members
Raw data
{
"_id": null,
"home_page": "https://github.com/ethanfurman/aenum",
"name": "aenum",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Ethan Furman",
"author_email": "ethan@stoneleaf.us",
"download_url": "https://files.pythonhosted.org/packages/c1/6e/3df8055152e187bb708e612a66994bd37d925001b508c3aa8360a68a8d33/aenum-3.1.14.tar.gz",
"platform": null,
"description": "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants\n\nWARNING: Version 3.1 has breaking changes in custom Enum settings\nWARNING:\nWARNING: AutoNumber has been removed\nWARNING: AutoValue has been removed\n\naenum includes a Python stdlib Enum-compatible data type, as well as a metaclass-based NamedTuple implementation and a NamedConstant class.\n\nAn Enum is a set of symbolic names (members) bound to unique, constant values. Within an enumeration, the members can be compared by identity, and the enumeration itself can be iterated over. Support exists for unique values, multiple values, auto-numbering, and suspension of aliasing (members with the same value are not identical), plus the ability to have values automatically bound to attributes.\n\nA NamedTuple is a class-based, fixed-length tuple with a name for each possible position accessible using attribute-access notation as well as the standard index notation.\n\nA NamedConstant is a class whose members cannot be rebound; it lacks all other Enum capabilities, however.\n\nEnum classes:\n\n- Enum: Base class for creating enumerated constants.\n\n- IntEnum: Base class for creating enumerated constants that are also\n subclasses of int.\n\n- Flag: Base class for creating enumerated constants that can be combined\n using the bitwise operations without losing their Flag membership.\n\n- IntFlag: Base class for creating enumerated constants that can be combined\n using the bitwise operators without losing their IntFlag membership.\n IntFlag members are also subclasses of int.\n\n- AutoNumberEnum: Derived class that automatically assigns an int value to each\n member.\n\n- OrderedEnum: Derived class that adds <, <=, >=, and > methods to an Enum.\n\n- UniqueEnum: Derived class that ensures only one name is bound to any one\n value.\n\nUtility functions include:\n\n- convert: helper to convert target global variables into an Enum\n\n- constant: helper class for creating constant members\n\n- enum: helper class for creating members with keywords\n\n- enum_property: property to enable enum members to have same named attributes\n (e.g. `name` and `value`)\n\n- export: helper to insert Enum members into a namespace (usually globals())\n\n- extend_enum: add new members to enumerations after creation\n\n- module: inserts NamedConstant and Enum classes into sys.modules\n where it will appear to be a module whose top-level names\n cannot be rebound\n\n- skip: class that prevents attributes from being converted to a\n constant or enum member\n\n- unique: decorator that ensures no duplicate members\n\n\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants",
"version": "3.1.14",
"project_urls": {
"Homepage": "https://github.com/ethanfurman/aenum"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "566fb5220f43d06d0c8156fbb2a1beab7012df8bc7cdb86e0f10c47afd17e110",
"md5": "ee72dd3069f8b9cfcc65d841aa5e4544",
"sha256": "93ba417f1c461d2aab6d107204110381d1b3e53561193ae53df3a17701821777"
},
"downloads": -1,
"filename": "aenum-3.1.14-py2-none-any.whl",
"has_sig": false,
"md5_digest": "ee72dd3069f8b9cfcc65d841aa5e4544",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 124562,
"upload_time": "2023-06-22T04:14:27",
"upload_time_iso_8601": "2023-06-22T04:14:27.124404Z",
"url": "https://files.pythonhosted.org/packages/56/6f/b5220f43d06d0c8156fbb2a1beab7012df8bc7cdb86e0f10c47afd17e110/aenum-3.1.14-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5b72b04f7e298fb3abf8569c12e38031ed38b28d6172d56dfc92be35e8f3d05e",
"md5": "ccccff0e0a2c5ffd21b37be300dc486e",
"sha256": "1d60e15f2e2d4ba66371c19c691edb085ecf82027e773309a9c4291b5cbccc17"
},
"downloads": -1,
"filename": "aenum-3.1.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ccccff0e0a2c5ffd21b37be300dc486e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 137631,
"upload_time": "2023-06-22T04:14:29",
"upload_time_iso_8601": "2023-06-22T04:14:29.784884Z",
"url": "https://files.pythonhosted.org/packages/5b/72/b04f7e298fb3abf8569c12e38031ed38b28d6172d56dfc92be35e8f3d05e/aenum-3.1.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c16e3df8055152e187bb708e612a66994bd37d925001b508c3aa8360a68a8d33",
"md5": "66f6c630cc2bc98583f150b0bec6b265",
"sha256": "7c4b04b5c9621533d6311e6ca23ea2ee213c7a992ed0be79a2b944cdaf2a45ec"
},
"downloads": -1,
"filename": "aenum-3.1.14.tar.gz",
"has_sig": false,
"md5_digest": "66f6c630cc2bc98583f150b0bec6b265",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 99899,
"upload_time": "2023-06-22T04:14:24",
"upload_time_iso_8601": "2023-06-22T04:14:24.531583Z",
"url": "https://files.pythonhosted.org/packages/c1/6e/3df8055152e187bb708e612a66994bd37d925001b508c3aa8360a68a8d33/aenum-3.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-22 04:14:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ethanfurman",
"github_project": "aenum",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "aenum"
}