p_enum (version 0.4.4, 2009-08-26)
index
/home/pfeiffer/project-shared/publicize/bii_scripts-top/bii_scripts/lib/python/bii_scripts/p_enum.py

Robust enumerated type support in Python.
 
This package provides a module for robust enumerations in Python.
 
An enumeration object is created with a sequence of string arguments
to the Enum() constructor::
 
    >>> from enum import Enum
    >>> Colours = Enum('red', 'blue', 'green')
    >>> Weekdays = Enum('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
 
The return value is an immutable sequence object with a value for each
of the string arguments. Each value is also available as an attribute
named from the corresponding string argument::
 
    >>> pizza_night = Weekdays[4]
    >>> shirt_colour = Colours.green
 
The values are constants that can be compared only with values from
the same enumeration; comparison with other values will invoke
Python's fallback comparisons::
 
    >>> pizza_night == Weekdays.fri
    True
    >>> shirt_colour > Colours.red
    True
    >>> shirt_colour == "green"
    False
 
Each value from an enumeration exports its sequence index
as an integer, and can be coerced to a simple string matching the
original arguments used to create the enumeration::
 
    >>> str(pizza_night)
    'fri'
    >>> shirt_colour.index
    2

 
Modules
       
sys

 
Classes
       
__builtin__.object
Enum
EnumValue
exceptions.AssertionError(exceptions.StandardError)
EnumEmptyError(exceptions.AssertionError, EnumException)
exceptions.Exception(exceptions.BaseException)
EnumException
EnumBadKeyError(exceptions.TypeError, EnumException)
EnumEmptyError(exceptions.AssertionError, EnumException)
EnumImmutableError(exceptions.TypeError, EnumException)
exceptions.TypeError(exceptions.StandardError)
EnumBadKeyError(exceptions.TypeError, EnumException)
EnumImmutableError(exceptions.TypeError, EnumException)

 
class Enum(__builtin__.object)
    Enumerated type.
 
  Methods defined here:
__contains__(self, value)
__delattr__(self, name)
__delitem__(self, index)
__getitem__(self, index)
__init__(self, *keys, **kwargs)
Create an enumeration instance.
__iter__(self)
__len__(self)
__setattr__(self, name, value)
__setitem__(self, index, value)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class EnumBadKeyError(exceptions.TypeError, EnumException)
    Raised when creating an Enum with non-string keys.
 
 
Method resolution order:
EnumBadKeyError
exceptions.TypeError
exceptions.StandardError
EnumException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, key)
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.TypeError:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class EnumEmptyError(exceptions.AssertionError, EnumException)
    Raised when attempting to create an empty enumeration.
 
 
Method resolution order:
EnumEmptyError
exceptions.AssertionError
exceptions.StandardError
EnumException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.AssertionError:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.AssertionError:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class EnumException(exceptions.Exception)
    Base class for all exceptions in this module.
 
 
Method resolution order:
EnumException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, *args, **kwargs)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class EnumImmutableError(exceptions.TypeError, EnumException)
    Raised when attempting to modify an Enum.
 
 
Method resolution order:
EnumImmutableError
exceptions.TypeError
exceptions.StandardError
EnumException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, *args)
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.TypeError:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class EnumValue(__builtin__.object)
    A specific value of an enumerated type.
 
  Methods defined here:
__eq__(self, other)
x.__eq__(y) <==> x==y
__ge__(self, other)
x.__ge__(y) <==> x>=y
__gt__(self, other)
x.__gt__(y) <==> x>y
__hash__(self)
__init__(self, enumtype, index, key)
Set up a new instance.
__le__(self, other)
x.__le__(y) <==> x<=y
__lt__(self, other)
x.__lt__(y) <==> x<y
__ne__(self, other)
x.__ne__(y) <==> x!=y
__repr__(self)
__str__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
enumtype
index
key

 
Data
        __author__ = 'Ben Finney <ben+python@benfinney.id.au>'
__author_email__ = 'ben+python@benfinney.id.au'
__author_name__ = 'Ben Finney'
__copyright__ = 'Copyright \xc2\xa9 2007\xe2\x80\x932009 Ben Finney'
__date__ = '2009-08-26'
__license__ = 'Choice of GPL or Python license'
__url__ = 'http://pypi.python.org/pypi/enum/'
__version__ = '0.4.4'

 
Author
        Ben Finney <ben+python@benfinney.id.au>