{ "info": { "author": "Martin Olejar", "author_email": "martin.olejar@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering", "Topic :: Software Development", "Topic :: Utilities" ], "description": "pyEnum\n======\n\n|Build Status| |Coverage Status| |PyPI Status| |Python Version|\n\nUser friendly implementation of documented ``Enum`` type for Python\nlanguage.\n\nInstallation\n------------\n\n.. code:: bash\n\n $ pip install easy_enum\n\nTo install the latest version from master branch execute in shell\nfollowing commands:\n\n.. code:: bash\n\n $ pip install -U https://github.com/molejar/pyEnum/archive/master.zip\n\nIn case of development, install pyEnum from sources:\n\n.. code:: bash\n\n $ git clone https://github.com/molejar/pyEnum.git\n $ cd pyEnum\n $ pip install -U -e .\n\nYou may run into a permissions issues running these commands. Here are a\nfew options how to fix it:\n\n1. Run with ``sudo`` to install pyEnum and dependencies globally\n2. Specify the ``--user`` option to install locally into your home\n directory (export \"~/.local/bin\" into PATH variable if haven't).\n3. Run the command in a\n `virtualenv `__ local to a\n specific project working set.\n\nUsage\n-----\n\nFollowing example is showing how easy you can use this Enum in your\ncode:\n\n.. code:: python\n\n from easy_enum import Enum\n\n class TestEnum(Enum):\n\n # attribute with no description, the name will be 'FIRST_ITEM' and empty string as description\n FIRST_ITEM = 1\n\n # attribute with description\n SECOND_ITEM = (2, 'Description for second item')\n\n # attribute with description and custom string name\n THIRD_ITEM = (3, 'third', 'Description for third item')\n\n # attribute with custom string name (the description must be specified as empty string)\n FOURTH_ITEM = (4, 'fourth', '')\n\n\n # Read attributes value and name\n print(TestEnum.SECOND_ITEM) # 2\n print(TestEnum['FIRST_ITEM']) # 1\n print(TestEnum[1]) # 'FIRST_ITEM'\n print(TestEnum[3]) # 'third'\n print(TestEnum['third']) # 3\n\n # Use get method with default value if want skip exception\n print(TestEnum.get(8)) # None\n print(TestEnum.get('eight')) # None\n print(TestEnum.get(8, 'eight')) # 'eight'\n\n # Check if exist attribute with specific value\n print(1 in TestEnum) # True\n print(8 in TestEnum) # False\n\n # Check if exist attribute with specific name\n print('first' in TestEnum) # False\n print('third' in TestEnum) # True\n\n # Get attribute description (as parameter use attribute name or value)\n print(TestEnum.desc(1)) # ''\n print(TestEnum.desc(2)) # 'Description for second item'\n print(TestEnum.desc('third')) # 'Description for third item'\n \n # Get count of all attributes\n print(len(TestEnum)) # 4\n\n # Get list with all attributes name\n names = [item[0] for item in TestEnum]\n print(names) # ['FIRST_ITEM', 'SECOND_ITEM', 'third', 'fourth']\n\n # Get list with all attributes value\n values = [item[1] for item in TestEnum]\n print(values) # [1, 2, 3, 4]\n\n # Read all items\n for name, value, desc in TestEnum:\n print('{} = {} ({})'.format(name, value, desc))\n\n.. |Build Status| image:: https://travis-ci.org/molejar/pyEnum.svg?branch=master\n :target: https://travis-ci.org/molejar/pyEnum\n.. |Coverage Status| image:: https://coveralls.io/repos/github/molejar/pyEnum/badge.svg?branch=master\n :target: https://coveralls.io/github/molejar/pyEnum?branch=master\n.. |PyPI Status| image:: https://img.shields.io/pypi/v/easy-enum.svg\n :target: https://pypi.python.org/pypi/easy-enum\n.. |Python Version| image:: https://img.shields.io/pypi/pyversions/easy-enum.svg\n :target: https://www.python.org", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/molejar/pyEnum", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "easy-enum", "package_url": "https://pypi.org/project/easy-enum/", "platform": "", "project_url": "https://pypi.org/project/easy-enum/", "project_urls": { "Homepage": "https://github.com/molejar/pyEnum" }, "release_url": "https://pypi.org/project/easy-enum/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "User friendly implementation of Enum in Python", "version": "0.3.0" }, "last_serial": 5697023, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8c878c6be2446fe6fb2839883bf995e0", "sha256": "081b2952325524f60a3772ddc10ba59a629f84d54dca84119d939b8e4c4c0e02" }, "downloads": -1, "filename": "easy_enum-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8c878c6be2446fe6fb2839883bf995e0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8142, "upload_time": "2019-03-04T20:16:43", "url": "https://files.pythonhosted.org/packages/13/c7/7096e554841c6d72febd4334dda1c8cd8d0ee3038addefbc5b2e11b8175c/easy_enum-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "67171fe2e6e64228bd6e3ac50574cb0e", "sha256": "2cc444eb3bc0ba3a3bd9048644596f96975875b0d490e5f748006e7f6c96110f" }, "downloads": -1, "filename": "easy_enum-0.1.0.tar.gz", "has_sig": false, "md5_digest": "67171fe2e6e64228bd6e3ac50574cb0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3559, "upload_time": "2019-03-04T20:16:45", "url": "https://files.pythonhosted.org/packages/19/63/e95775dbaba8b6b18fa1b8be47bf0cd5c828b39f8da8ede0e567c0bf87e0/easy_enum-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "910df24679e23042294fa9d1deb64e94", "sha256": "14392876234de11b0361995e0ae242c811e4a936734626004464f5e3c6f5b9f4" }, "downloads": -1, "filename": "easy_enum-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "910df24679e23042294fa9d1deb64e94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8313, "upload_time": "2019-04-01T18:26:46", "url": "https://files.pythonhosted.org/packages/e8/53/67466b29a840567738f0319def7e86f8ab833566e9fa83bcd3b4893f6b0e/easy_enum-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2772eabe4def677228eb75b8e354b7de", "sha256": "3f9326ba3a7c2332bca144af70681c943b98514399814896a443bc96e4e1a2dc" }, "downloads": -1, "filename": "easy_enum-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2772eabe4def677228eb75b8e354b7de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3819, "upload_time": "2019-04-01T18:26:47", "url": "https://files.pythonhosted.org/packages/fa/af/69c4801d0b30ccbcb322fdd77edc27e4223858dcd277c088f33d1dcb8423/easy_enum-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a0283d75250d33cefadfbe75448da7f8", "sha256": "f5123a3fda58acb23d9ae713fd539db95906354c681c01c1a321c28743c9caed" }, "downloads": -1, "filename": "easy_enum-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a0283d75250d33cefadfbe75448da7f8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6252, "upload_time": "2019-07-19T09:11:05", "url": "https://files.pythonhosted.org/packages/bf/89/4077083cb30f2e719fbf2f524de67555fbde6b758849c1c32d9328d30c23/easy_enum-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bdb56f3baf112e0b980934c0633a17e3", "sha256": "ec07740bff9f624354562c37385349069b58609b1af5e68544bb2eed40884225" }, "downloads": -1, "filename": "easy_enum-0.2.0.tar.gz", "has_sig": false, "md5_digest": "bdb56f3baf112e0b980934c0633a17e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3729, "upload_time": "2019-07-21T21:16:01", "url": "https://files.pythonhosted.org/packages/7b/f0/cadf6b905ddbadf3312f2f5561948db6549dcd36bd3e0721d63ce416ce15/easy_enum-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "6ff419ba738c64506a6a4bf9dae56157", "sha256": "29dcabaa6ab151f0026f68b9a2cb58ae3e4dc6f14edb4a0ee70d12a07c512603" }, "downloads": -1, "filename": "easy_enum-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6ff419ba738c64506a6a4bf9dae56157", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7839, "upload_time": "2019-08-19T07:12:45", "url": "https://files.pythonhosted.org/packages/ae/02/8cacde00c54689169f048295179e5356876a392975297e33f0b4c7021e0a/easy_enum-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9a4195320c991f08148a77bcdf0ee2f6", "sha256": "aa9baffd64ba0421ae9abcee045347e7d783b105ccce38caf55fd80c21f95b6a" }, "downloads": -1, "filename": "easy_enum-0.3.0.tar.gz", "has_sig": false, "md5_digest": "9a4195320c991f08148a77bcdf0ee2f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3842, "upload_time": "2019-08-19T07:10:25", "url": "https://files.pythonhosted.org/packages/a6/ee/5a432f5c91037ba0a289d4e79751c7c88d23a315aa1017656d15364865ec/easy_enum-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6ff419ba738c64506a6a4bf9dae56157", "sha256": "29dcabaa6ab151f0026f68b9a2cb58ae3e4dc6f14edb4a0ee70d12a07c512603" }, "downloads": -1, "filename": "easy_enum-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6ff419ba738c64506a6a4bf9dae56157", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7839, "upload_time": "2019-08-19T07:12:45", "url": "https://files.pythonhosted.org/packages/ae/02/8cacde00c54689169f048295179e5356876a392975297e33f0b4c7021e0a/easy_enum-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9a4195320c991f08148a77bcdf0ee2f6", "sha256": "aa9baffd64ba0421ae9abcee045347e7d783b105ccce38caf55fd80c21f95b6a" }, "downloads": -1, "filename": "easy_enum-0.3.0.tar.gz", "has_sig": false, "md5_digest": "9a4195320c991f08148a77bcdf0ee2f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3842, "upload_time": "2019-08-19T07:10:25", "url": "https://files.pythonhosted.org/packages/a6/ee/5a432f5c91037ba0a289d4e79751c7c88d23a315aa1017656d15364865ec/easy_enum-0.3.0.tar.gz" } ] }