Package pygeodesy :: Module named :: Class _NamedEnum |
[frames] | no frames]

# Class _NamedEnum

    object --+
             |
          dict --+
                 |
    object --+   |
             |   |
        _Named --+
                 |
        _NamedDict --+
                     |
                    _NamedEnum

(INTERNAL) Enum-like `_NamedDict` with attribute access restricted to valid keys.

Instance Methods
    new empty dictionary
__init__(self, name, *Classes) New `_NamedEnum`. |
__getattr__(self, name) Get the value of an attribute or enum by `name`. |
__repr__(self) Default `repr(self)`. |
__str__(self) Default `str(self)`. |
find(self, item) Find a registered item. |
register(self, item) Registed a new item. |
unregister(self, name_or_item) Remove a registered item. |
toRepr(self, prec=6, fmt=`'``F``'`, sep=`'``,\n``'`) Like `repr(dict)` but with `name` and `floats` formatting by `fstr`. |
toStr2(self, prec=6, fmt=`'``F``'`, sep=`'``,\n``'`) DEPRECATED, use method `toRepr`. |
toStr(self, *unused) Like `str(dict)` but with `floats` formatting by `fstr`. |
Inherited from `_NamedDict`: `__delattr__`, `__getitem__`, `__setattr__`, `__setitem__` Inherited from `dict`: `__cmp__`, `__contains__`, `__delitem__`, `__eq__`, `__ge__`, `__getattribute__`, `__gt__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__ne__`, `__new__`, `__sizeof__`, `clear`, `copy`, `fromkeys`, `get`, `has_key`, `items`, `iteritems`, `iterkeys`, `itervalues`, `keys`, `pop`, `popitem`, `setdefault`, `update`, `values`, `viewitems`, `viewkeys`, `viewvalues` Inherited from `_Named`: `_dot_`, `attrs`, `classof` Inherited from `object`: `__format__`, `__reduce__`, `__reduce_ex__`, `__subclasshook__`

Class Variables
Inherited from `dict`: `__hash__`

Properties
Inherited from `_Named`: `classname`, `classnaming`, `name`, `named`, `named2` Inherited from `object`: `__class__`

Method Details

### __init__ (self, name, *Classes) (Constructor) |
New `_NamedEnum`. Arguments: `name` - Name (`str`). `Classes` - One or more classes or types acceptable as enum values (`class`- or `type`s). Returns:
    new empty dictionary
Overrides: object.__init__

### __getattr__ (self, name) (Qualification operator) |
Get the value of an attribute or enum by `name`. Overrides: _NamedDict.__getattr__

### __repr__ (self) (Representation operator) |
Default `repr(self)`. Overrides: object.__repr__

### __str__ (self) (Informal representation operator) |
Default `str(self)`. Overrides: object.__str__

### find (self, item) |
Find a registered item. Arguments: `item` - The item to look for (any `type`). Returns: If found the `item`'s name (`str`), `None` otherwise.

### register (self, item) |
Registed a new item. Arguments: `item` - The item (any `type`). Returns: The item name (`str`). Raises: `NameError` - An `item` already registered with that name or the `item` has no, an empty or an invalid name. `TypeError` - The `item` type invalid.

### unregister (self, name_or_item) |
Remove a registered item. Arguments: `name_or_item` - Name (`str`) of or the item (any `type`). Returns: The unregistered item. Raises: `NameError` - No item with that `name`. `ValueError` - No such item.

### toRepr (self, prec=6, fmt=`'``F``'`, sep=`'``,\n``'`) |
Like `repr(dict)` but with `name` and `floats` formatting by `fstr`. Overrides: _Named.toRepr

### toStr2 (self, prec=6, fmt=`'``F``'`, sep=`'``,\n``'`) |
DEPRECATED, use method `toRepr`. Overrides: _Named.toRepr

### toStr (self, *unused) |
Like `str(dict)` but with `floats` formatting by `fstr`. Overrides: _Named.toStr