Return the contents of an object as a dict.
493274
def bvlpdu_contents(self, use_dict=None, as_class=dict):
        """"""
        # make/extend the dictionary of content
        if use_dict is None:
            use_dict = as_class()

        # save the content
        use_dict.__setitem__('address', str(self.fdAddress))
        use_dict.__setitem__('ttl', self.fdTTL)
        use_dict.__setitem__('remaining', self.fdRemain)

        # return what we built/updated
        return use_dict
678347
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'credentials') and self.credentials is not None:
            _dict['credentials'] = [x._to_dict() for x in self.credentials]
        return _dict
31449
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'label') and self.label is not None:
            _dict['label'] = self.label
        if hasattr(self, 'value') and self.value is not None:
            _dict['value'] = self.value._to_dict()
        if hasattr(self, 'output') and self.output is not None:
            _dict['output'] = self.output
        return _dict
525564
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        return _dict
946997
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'output') and self.output is not None:
            _dict['output'] = self.output._to_dict()
        if hasattr(self, 'context') and self.context is not None:
            _dict['context'] = self.context._to_dict()
        return _dict
653514
def dict_contents(self, use_dict=None, as_class=dict):
        """"""
        if _debug: APDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)

        # make/extend the dictionary of content
        if use_dict is None:
            use_dict = as_class()

        # call the parent classes
        self.apci_contents(use_dict=use_dict, as_class=as_class)
        self.apdu_contents(use_dict=use_dict, as_class=as_class)

        # return what we built/updated
        return use_dict
197404
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'fields') and self.fields is not None:
            _dict['fields'] = [x._to_dict() for x in self.fields]
        return _dict
437132
def object_to_dict(obj):
    '''
    
    '''
    if isinstance(obj, list) or isinstance(obj, tuple):
        ret = []
        for item in obj:
            ret.append(object_to_dict(item))
    elif hasattr(obj, '__dict__'):
        ret = {}
        for item in obj.__dict__:
            if item.startswith('_'):
                continue
            ret[item] = object_to_dict(obj.__dict__[item])
    else:
        ret = obj
    return ret
953428
def to_dict(self):
        """"""
        return {
            'high': self.high,
            'low': self.low,
            'mean': self.mean,
            'count': self.count,
            'deviation': self.deviation,
        }
68326
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'size') and self.size is not None:
            _dict['size'] = self.size
        if hasattr(self, 'hits') and self.hits is not None:
            _dict['hits'] = self.hits._to_dict()
        return _dict
28294
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self, 'location') and self.location is not None:
            _dict['location'] = self.location._to_dict()
        if hasattr(self, 'level') and self.level is not None:
            _dict['level'] = self.level
        if hasattr(self,
                   'element_locations') and self.element_locations is not None:
            _dict['element_locations'] = [
                x._to_dict() for x in self.element_locations
            ]
        return _dict
1147756
def _dict_contents(self, use_dict=None, as_class=dict):
        """"""
        if _debug: Object._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)

        # make/extend the dictionary of content
        if use_dict is None:
            use_dict = as_class()

        klasses = list(self.__class__.__mro__)
        klasses.reverse()

        # build a list of property identifiers "bottom up"
        property_names = []
        properties_seen = set()
        for c in klasses:
            for prop in getattr(c, 'properties', []):
                if prop.identifier not in properties_seen:
                    property_names.append(prop.identifier)
                    properties_seen.add(prop.identifier)

        # extract the values
        for property_name in property_names:
            # get the value
            property_value = self._properties.get(property_name).ReadProperty(self)
            if property_value is None:
                continue

            # if the value has a way to convert it to a dict, use it
            if hasattr(property_value, "dict_contents"):
                property_value = property_value.dict_contents(as_class=as_class)

            # save the value
            use_dict.__setitem__(property_name, property_value)

        # return what we built/updated
        return use_dict
1198095
def dict_contents(self, use_dict=None, as_class=dict):
        """"""
        if _debug: Sequence._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)
        global _sequence_of_classes, _list_of_classes

        # make/extend the dictionary of content
        if use_dict is None:
            use_dict = as_class()

        # loop through the elements
        for element in self.sequenceElements:
            value = getattr(self, element.name, None)
            if value is None:
                continue

            if (element.klass in _sequence_of_classes) or (element.klass in _list_of_classes):
                helper = element.klass(value)
                mapped_value = helper.dict_contents(as_class=as_class)

            elif issubclass(element.klass, Atomic):
                mapped_value = value                        ### ambiguous

            elif issubclass(element.klass, AnyAtomic):
                mapped_value = value.value                  ### ambiguous

            elif isinstance(value, element.klass):
                mapped_value = value.dict_contents(as_class=as_class)
                use_dict.__setitem__(element.name, mapped_value)

            else:
                continue

            # update the dictionary being built
            use_dict.__setitem__(element.name, mapped_value)

        # return what we built/updated
        return use_dict
650728
def dict_contents(self, use_dict=None, as_class=dict):
        """"""
        if _debug: PDU._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class)

        # make/extend the dictionary of content
        if use_dict is None:
            use_dict = as_class()

        # call into the two base classes
        self.pci_contents(use_dict=use_dict, as_class=as_class)
        self.pdudata_contents(use_dict=use_dict, as_class=as_class)

        # return what we built/updated
        return use_dict
207627
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self, 'top_class') and self.top_class is not None:
            _dict['top_class'] = self.top_class
        if hasattr(self, 'classes') and self.classes is not None:
            _dict['classes'] = [x._to_dict() for x in self.classes]
        return _dict
366908
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'code') and self.code is not None:
            _dict['code'] = self.code
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self, 'error_id') and self.error_id is not None:
            _dict['error_id'] = self.error_id
        return _dict
85446
def fields_to_dict(self):
        """"""
        d = {}
        for container in FieldsContainer.class_container.values():
            fields = getattr(self, container)
            if fields:
                d[container] = [field.to_dict() for field in fields]
        return d