Esempio n. 1
0
    def __init__(self, name, group_id, item_id, type_=None, tlvs=None, **k):
        if not isinstance(name, str):
            raise TypeError("SSIItem.name must be str, not %s" % type(name))

        type_ = k.pop("type", type_)
        if k:
            raise Exception('Only one extra keyword argument ("type") is allowed for SSIItems')

        self.name = name
        self.group_id = group_id
        self.item_id = item_id
        self.type = type_ or 0  # default to a Buddy
        self.tlvs = odict(tlvs or {})  # default to no tlvs (maybe this should be storage/named tlvs)

        self.c8_to_ints()
Esempio n. 2
0
def plist(xml):
    "Apple PLIST xml -> ordered dict"

    from util.primitives import odict

    d = odict()

    for child in tag(xml).dict:
        contents = unicode(child)

        if child._name.lower() == "key":
            key = contents
        else:
            d[key] = plist_types[child._name](contents)

    return d
Esempio n. 3
0
def plist(xml):
    'Apple PLIST xml -> ordered dict'

    from util.primitives import odict

    d = odict()

    for child in tag(xml).dict:
        contents = unicode(child)

        if child._name.lower() == 'key':
            key = contents
        else:
            d[key] = plist_types[child._name](contents)

    return d
Esempio n. 4
0
    def __init__(self, name, group_id, item_id, type_=None, tlvs=None, **k):
        if not isinstance(name, str):
            raise TypeError('SSIItem.name must be str, not %s' % type(name))

        type_ = k.pop('type', type_)
        if k:
            raise Exception(
                'Only one extra keyword argument ("type") is allowed for SSIItems'
            )

        self.name = name
        self.group_id = group_id
        self.item_id = item_id
        self.type = type_ or 0  #default to a Buddy
        self.tlvs = odict(
            tlvs or
            {})  #default to no tlvs (maybe this should be storage/named tlvs)

        self.c8_to_ints()
Esempio n. 5
0
def tlv_list_to_dict(tlv_list):
    return odict((tlv.t, tlv.v) for tlv in tlv_list)