This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
========
richenum
========
.. image:: https://travis-ci.org/hearsaycorp/richenum.png
:alt: Build Status
:target: https://travis-ci.org/#!/hearsaycorp/richenum/

.. image:: https://img.shields.io/pypi/v/richenum.svg
:alt: Latest PyPI Version
:target: https://pypi.python.org/pypi/richenum/

=====
About
=====
A enum library for Python.

enum
A simple enum implementation that maps a "variable" to a constant.
RichEnum
An enum implementation that offers more functionality than a basic enum, hence the
name: RichEnum. Provided functionality include specifying a canonical name and a display name.
The canonical name should be used if you need to do a lookup or reference in your code.
The display name should be used if you need to display text to a user.
OrderedRichEnum
Exactly like RichEnum but also has an index specified for each enum value. Also, iteration over
an OrderedRichEnum will be sorted (ascending) by the enum value's index.

-----
Links
-----
| `GitHub <https: github.com="" hearsaycorp="" richenum="">`_
| `PyPi <https: pypi.python.org="" pypi="" richenum=""/>`_
| `Blog post about the motivation behind RichEnum <http: engineering.hearsaysocial.com="" 2013="" 09="" 16="" enums-in-python=""/>`_

============
Installation
============
.. code:: bash

$ pip install richenum

=====
Example Usage
=====
----
enum
----
.. code:: python

>>> from richenum import enum
>>> MY_ENUM = enum(FOO=1, BAR=2)
>>> MY_ENUM.FOO
1
>>> MY_ENUM.BAR
2

--------
RichEnum
--------
.. code:: python

>>> from richenum import RichEnum, RichEnumValue
>>> class MyRichEnum(RichEnum):
... FOO = RichEnumValue(canonical_name="foo", display_name="Foo")
... BAR = RichEnumValue(canonical_name="bar", display_name="Bar")
...
>>> MyRichEnum.FOO
RichEnumValue - canonical_name: 'foo' display_name: 'Foo'
>>> MyRichEnum.from_canonical("foo")
RichEnumValue - canonical_name: 'foo' display_name: 'Foo'


---------------
OrderedRichEnum
---------------
.. code:: python

>>> from richenum import OrderedRichEnum, OrderedRichEnumValue
>>> class MyOrderedRichEnum(OrderedRichEnum):
... FOO = OrderedRichEnumValue(index=1, canonical_name="foo", display_name="Foo")
... BAR = OrderedRichEnumValue(index=2, canonical_name="bar", display_name="Bar")
...
>>> MyOrderedRichEnum.FOO
OrderedRichEnumValue - idx: 1 canonical_name: 'foo' display_name: 'Foo'
>>> MyOrderedRichEnum.from_canonical("foo")
OrderedRichEnumValue - idx: 1 canonical_name: 'foo' display_name: 'Foo'
>>> MyOrderedRichEnum.from_index(1)
OrderedRichEnumValue - idx: 1 canonical_name: 'foo' display_name: 'Foo'


================
Related Packages
================

django-richenum
Makes RichEnum and OrderedRichEnum available in as model fields and form fields in Django.

| `GitHub <https: github.com="" hearsaycorp="" django-richenum="">`_

| `PyPi <https: pypi.python.org="" pypi="" django-richenum=""/>`_

enum
Starting with Python 3.4, there is a standard library for enumerations.
This class has a similar API, but is not directly compatible with that
class.


============
Contributing
============

#. Fork the repo from `GitHub <https: github.com="" hearsaycorp="" richenum="">`_.
#. Make your changes.
#. Add unittests for your changes.
#. Run `pep8 <https: pypi.python.org="" pypi="" pep8="">`_, `pyflakes <https: pypi.python.org="" pypi="" pyflakes="">`_, and `pylint <https: pypi.python.org="" pypi="" pyflakes="">`_ to make sure your changes follow the Python style guide and doesn't have any errors.
#. Add yourself to the AUTHORS file (in alphabetical order).
#. Send a pull request from your fork to the main repo.


Changelog
=========

1.2.1 (2016-09-16)
------------------
- ``EnumLookupError`` class now inherits from built-in ``LookupError``.

1.2.0 (2016-04-15)
------------------
- added simple ``LookupError`` members that are thrown when
``RichEnum.lookup`` is called for a nonexistent attr/val pair.
Users can choose to catch either the specific ``LookupError`` or
continue to catch ``EnumLookupError``.

1.1.0 (2014-04-17)
------------------
- support for Python 3 and PyPy

1.0.4 (2013-12-03)
------------------
- Better unicode handling in ``__str__``, ``__unicode__``, and
``__repr__`` magic methods.

1.0.3 (2013-12-03)
------------------
- Stop throwing warnings.

1.0.2 (2013-11-05)
------------------
- Suppress warnings from mismatched type comparisons when generated
in RichEnum.lookup.

1.0.1 (2013-09-20)
------------------
- Raise warnings when comparing enum values to other types, but not
when checking membership or comparing to None.

1.0.0 (2013-08-16)
------------------
- Initial public release.


Developed and maintained by `Hearsay Social, Inc.
<http: hearsaysocial.com="">`_.

Contributors
============
| `Adam DePue <http: github.com="" adepue="">`_
| `Akshay Shah <http: github.com="" akshayjshah="">`_
| `Dale Hui <http: github.com="" dhui="">`_
| `Robert MacCloy <http: github.com="" rbm="">`_
| `Sam Vilain <http: github.com="" samv="">`_
Release History

Release History

1.2.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
richenum-1.2.1.tar.gz (7.8 kB) Copy SHA256 Checksum SHA256 Source Dec 5, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting