Package csb :: Package core :: Class DictionaryContainer

[frames] | no frames]

# Class DictionaryContainer

source code

             object --+
                      |
        AbstractIndexer --+
                          |
    BaseDictionaryContainer --+
                              |
                             DictionaryContainer

Known Subclasses:
  - bio.structure.ResidueAtomsTable
  - , bio.structure.StructureChainsTable
  - , bio.hmm.EmissionTable
  - , bio.hmm.HMMLayer
  - , bio.hmm.TransitionTable
  - , bio.io.vasco.ChemicalShiftContainer

Write-enabled Dictionary Container. New items can be added using a public `append` method. Subclasses may also override the internal `_update` and `_set` to expose them to the clients.

Instance Methods

__init__(self, items=None, restrict=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code

append(self, key, item) Append a new key-value to the collection. | source code

Inherited from `BaseDictionaryContainer`: `__bool__`, `__contains__`, `__getitem__`, `__iter__`, `__len__`, `__nonzero__`, `__repr__`, `keys` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `BaseDictionaryContainer`: `length` Inherited from `object`: `__class__`

Method Details

### __init__(self, items=None, restrict=None)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `items` - an initialization dictionary
  - `restrict` - a list of keys allowed for this dictionary
Overrides: object.__init__
  (inherited documentation)

### append(self, key, item)

source code

Append a new key-value to the collection.

Parameters:
  - `key` - key
  - `item` - value
Raises:
  - `InvalidKeyError` - when the key is not allowed for this container
  - `DuplicateKeyError` - when such a key already exists