Package groupthink :: Module dbus_tools
[hide private]
[frames] | no frames]

Module dbus_tools

source code

a very small collection of dbus-related conveniences.

Functions [hide private]
 
undbox(x)
undbox is a function that unwraps dbus types such as dbus.Int64 into python types such as int.
source code
Variables [hide private]
  inttypes = (<type 'dbus.Int16'>, <type 'dbus.Int32'>, <type 'd...
  strtypes = (<type 'dbus.ByteArray'>, <type 'dbus.String'>, <ty...
Function Details [hide private]

undbox(x)

source code 

undbox is a function that unwraps dbus types such as dbus.Int64 into python types such as int. The principal purpose of this unwrapping is to allow pickling, because dbus objects cannot be pickled.

Parameters:
  • x (any type) - an object that might contain dbus types
Returns:
an object that compares as equal to x, but has been recursively stripped of all dbus types
>>> a = dbus.Struct((dbus.UInt64(4252), dbus.ByteArray('asdf;lkj')))
>>> b = undbox(a)
>>> b
(4252, 'asdf;lkj')
>>> a == b
True

Variables Details [hide private]

inttypes

Value:
(<type 'dbus.Int16'>,
 <type 'dbus.Int32'>,
 <type 'dbus.Int64'>,
 <type 'dbus.Byte'>,
 <type 'dbus.UInt16'>,
 <type 'dbus.UInt32'>,
 <type 'dbus.UInt64'>)

strtypes

Value:
(<type 'dbus.ByteArray'>,
 <type 'dbus.String'>,
 <type 'dbus.UTF8String'>,
 <type 'dbus.Signature'>,
 <type 'dbus.ObjectPath'>)