Package dbus :: Class Dictionary
[hide private]
[frames] | no frames]

Class Dictionary

source code

object --+    
         |    
      dict --+
             |
            Dictionary

An mapping whose keys are similar and whose values are similar, implemented as a subtype of dict.

As currently implemented, a Dictionary behaves just like a dict, but with the addition of a signature property set by the constructor; conversion of its items to D-Bus types is only done when it's sent in a Message. This may change in future so validation is done earlier.

Constructor:

Dictionary(mapping_or_iterable=(), signature=None, variant_level=0)

variant_level must be non-negative; the default is 0.

signature is either a string or None. If a string, it must consist of exactly two complete type signatures, representing the 'key' type (which must be a primitive type, i.e. one of "bdginoqstuxy") and the 'value' type. The signature of the whole Dictionary will be a{xx} where xx is replaced by the given signature.

If it is None (the default), when the Dictionary is sent over D-Bus, the key and value signatures will be guessed from an arbitrary element of the Dictionary.

Instance Methods [hide private]
new empty dictionary

__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
a new object with type S, a subtype of T
__new__(T, S, ...) source code
 
__repr__(x)
repr(x)
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Instance Variables [hide private]
int variant_level
Indicates how many nested Variant containers this object is contained in: if a message's wire format has a variant containing a variant containing an array of DICT_ENTRY, this is represented in Python by a Dictionary with variant_level==2.
Properties [hide private]
  signature
The D-Bus signature of each key in this Dictionary, followed by that of each value in this Dictionary, as a Signature instance.

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Returns:
new empty dictionary

Overrides: object.__init__

__new__(T, S, ...)

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__

Instance Variable Details [hide private]

variant_level

Indicates how many nested Variant containers this object is contained in: if a message's wire format has a variant containing a variant containing an array of DICT_ENTRY, this is represented in Python by a Dictionary with variant_level==2.