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

# Class _NamedEnum

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

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

Instance Methods
    new empty dictionary
__init__(self, Class, *Classes, **name) New `_NamedEnum`. |
__getattr__(self, name) Get the value of an attribute or item by `name`. |
__repr__(self) Default `repr(self)`. |
__str__(self) Default `str(self)`. |
find(self, item, dflt=None) Find a registered item. |
D[k] if k in D, else d |
get(self, name, dflt=None) Get the value of a registered item. |
list of D's (key, value) pairs, as 2-tuples |
items(self, all=False) Yield all or only the registered items. |
list of D's keys |
keys(self, all=False) Yield the keys of all or only the registered items. |
(k, v), remove and return some (key, value) pair as a |
popitem(self) Remove an, any curretly registed item. |
register(self, item) Registed a new item. |
v, remove specified key and return the corresponding value |
unregister(self, name_or_item) Remove a registered item. |
v, remove specified key and return the corresponding value |
pop(self, name_or_item) Remove a registered item. |
toRepr(self, prec=6, fmt='F', sep=`'``,\n``'`, **all) Like `repr(dict)` but with `name` and `floats` formatting by `fstr`. |
toStr(self, *unused, **all) Like `str(dict)` but with `floats` formatting by `fstr`. |
list of D's values |
values(self, all=False) Yield the value of all or only the registered items. |
Inherited from `_NamedDict`: `__delattr__`, `__getitem__`, `__setattr__`, `__setitem__` Inherited from `_Dict`: `set_` Inherited from `dict`: `__cmp__`, `__contains__`, `__delitem__`, `__eq__`, `__ge__`, `__getattribute__`, `__gt__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__ne__`, `__new__`, `__sizeof__`, `clear`, `copy`, `fromkeys`, `has_key`, `iteritems`, `iterkeys`, `itervalues`, `setdefault`, `update`, `viewitems`, `viewkeys`, `viewvalues` Inherited from `_Named`: `_DOT_`, `attrs`, `classof`, `dup`, `rename`, `toStr2` Inherited from `object`: `__format__`, `__reduce__`, `__reduce_ex__`, `__subclasshook__`

Class Variables
Inherited from `dict`: `__hash__`

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

Method Details

### __init__ (self, Class, *Classes, **name) (Constructor) |
New `_NamedEnum`. Arguments: `Class` - Initial class or type acceptable as items values (`type`). `Classes` - Additional, acceptable classes or `type`s. Returns:
    new empty dictionary
Overrides: object.__init__

### __getattr__ (self, name) (Qualification operator) |
Get the value of an attribute or item by `name`. Overrides: _Dict.__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, dflt=None) |
Find a registered item. Arguments: `item` - The item to look for (any `type`). `dflt` - Value to return if not found (any `type`). Returns: The `item`'s name if found (`str`), or `{dflt}` if there is no such registered `item`.

### get (self, name, dflt=None) |
Get the value of a registered item. Arguments: `name` - The name of the item (`str`). `dflt` - Value to return (any `type`). Returns: D[k] if k in D, else d The item with `name` if found, or `dflt` if there is no item registered with that `name`. Overrides: dict.get

### items (self, all=False) |
Yield all or only the registered items. Arguments: `all` - Use `True` to yield {all} items or `False` for only the currently registered ones. Returns: list of D's (key, value) pairs, as 2-tuples Overrides: dict.items

### keys (self, all=False) |
Yield the keys of all or only the registered items. Arguments: `all` - Use `True` to yield {all} item keys or `False` for only the currently registered ones. Returns: list of D's keys Overrides: dict.keys

### popitem (self) |
Remove an, any curretly registed item. Returns: (k, v), remove and return some (key, value) pair as a The removed item. Overrides: dict.popitem

### 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`) or the item (any `type`). Returns: v, remove specified key and return the corresponding value The unregistered item. Raises: `NameError` - No item with that `name`. `ValueError` - No such item.

### pop (self, name_or_item) |
Remove a registered item. Arguments: `name_or_item` - Name (`str`) or the item (any `type`). Returns: v, remove specified key and return the corresponding value The unregistered item. Raises: `NameError` - No item with that `name`. `ValueError` - No such item. Overrides: dict.pop

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

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

### values (self, all=False) |
Yield the value of all or only the registered items. Arguments: `all` - Use `True` to yield {all} item values or `False` for only the currently registered ones. Returns: list of D's values Overrides: dict.values