Unpacks gdb.Value objects and returns the best-matched python object.
323436
def _UnpackGdbVal(self, gdb_value):
    """"""
    val_type = gdb_value.type.code
    if val_type == gdb.TYPE_CODE_INT or val_type == gdb.TYPE_CODE_ENUM:
      return int(gdb_value)
    if val_type == gdb.TYPE_CODE_VOID:
      return None
    if val_type == gdb.TYPE_CODE_PTR:
      return long(gdb_value)
    if val_type == gdb.TYPE_CODE_ARRAY:
      # This is probably a string
      return str(gdb_value)
    # I'm out of ideas, let's return it as a string
    return str(gdb_value)
136780
def _value(obj):
    
    # TODO: this is ugly and makes everything ugly
    # can we handle this with a clean decorator or just requiring that only floats be passed??
    if hasattr(obj, 'value'):
        return obj.value
    elif isinstance(obj, np.ndarray):
        return np.array([o.value for o in obj])
    elif hasattr(obj, '__iter__'):
        return [_value(o) for o in obj]
    return obj
194540
def _fromstring(value):
    '''
    '''

    if not value:
        return [None]
    std_value = value.strip().lower()
    if std_value == 'true':
        return True
    elif std_value == 'false':
        return False
    try:
        return int(std_value)
    except ValueError:
        pass
    try:
        return float(std_value)
    except ValueError:
        pass
    return value
96614
def _from_dict(cls, values, value_filter, dictionary, allow_unset=True):
        """"""
        if not isinstance(dictionary, Mapping):
            raise TypeError('dictionary should be mapping')
        obj = cls(values, value_filter)
        values = obj.__values
        for name, value in dictionary.items():
            if not isinstance(name, string_types):
                raise TypeError('Key %s is not a string' % str(name))
            setattr(values, name, value)
        if obj.missing and not allow_unset:
            raise ValueError('%d value(s) are unset' % len(obj.missing))
        return obj
524401
def unpack(packed, object_hook=decode,
           list_hook=None, use_list=False, encoding='utf-8',
           unicode_errors='strict', object_pairs_hook=None,
           max_buffer_size=0, ext_hook=ExtType):
    

    return Unpacker(packed, object_hook=object_hook,
                    list_hook=list_hook,
                    use_list=use_list, encoding=encoding,
                    unicode_errors=unicode_errors,
                    object_pairs_hook=object_pairs_hook,
                    max_buffer_size=max_buffer_size,
                    ext_hook=ext_hook)
500835
def unpack(self, buff, offset=0):
        """"""
        begin = offset
        for name, value in list(self.get_class_attributes())[:-1]:
            size = self._unpack_attribute(name, value, buff, begin)
            begin += size
        self._unpack_attribute('oxm_match_fields', type(self).oxm_match_fields,
                               buff[:offset+self.length], begin)
1159837
def unpack(d):
    
    p = SBP._parser.parse(d)
    assert p.preamble == SBP_PREAMBLE, "Invalid preamble 0x%x." % p.preamble
    return SBP(p.msg_type, p.sender, p.length, p.payload, p.crc)
523974
def dbStore(self, typ, py_value):
        
        if py_value is not None:
            py_value = projex.text.decoded(py_value)

            if self.cleaned():
                py_value = self.clean(py_value)

            if self.escaped():
                py_value = self.escape(py_value)

            return py_value
        else:
            return py_value
803152
def recover(self, key, value):
        """"""
        if key not in self._dtypes:
            self.read_types()
        if key not in self._dtypes:
            raise ValueError("Unknown datatype for {} and {}".format(key, value))
        return self._dtypes[key][2](value)
298842
def to_python(self, value):
        """"""
        if value is None or value == '':
            return {}

        if isinstance(value, six.string_types):
            res = loads(value)
        else:
            res = value

        if isinstance(res, dict):
            return JSONDict(**res)
        elif isinstance(res, list):
            return JSONList(res)

        return res
511387
public static String unpackString(Object obj) {
        Object value = unpack(obj);
        return value == null ? null : value.toString();
    }
1039791
def from_object(updates):
    ""
    import sys
    config = sys.modules[__name__]
    
    prefix = config.__name__.split('.')[0].upper()
    keys = [k for k in config.__dict__ if \
        k != from_object.__name__ and not k.startswith('_')]
    get_value = lambda c, k: hasattr(c, k) and getattr(c, k) or None
    for key in keys:
        prefix_key = '%s_%s' % (prefix, key)
        value = get_value(updates, prefix_key) or get_value(updates, key)
        if value: setattr(config, key, value)
769735
def unpack(self, buff, offset=0):
        """"""
        super().unpack(buff)

        class_name = self._get_body_class()
        buff = self.body.value
        self.body = FixedTypeList(pyof_class=class_name)
        self.body.unpack(buff)
420217
def parseValue(self, value):
        """"""
        if self.isVector():
            return list(map(self._pythonType, value.split(',')))
        if self.typ == 'boolean':
            return _parseBool(value)
        return self._pythonType(value)
955070
def to_python(self, value):
        
        if isinstance(value, dict):
            return value

        if self.blank and not value:
            return None

        if isinstance(value, string_types):
            try:
                return json.loads(value)
            except Exception as e:
                raise ValidationError(str(e))

        return value
448047
def from_db_value(self, value, expression, connection, context):
        
        # log.debug("from_db_value: {}, {}", value, type(value))
        if value is None:
            return value
        if value == '':
            return None
        return iso_string_to_python_datetime(value)
1130163
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value:
        """"""
        def convert(val):
            if isinstance(val, list):
                res = ArrayValue([convert(x) for x in val])
            elif isinstance(val, dict):
                res = ObjectValue({x: convert(val[x]) for x in val})
            else:
                res = val
            return res
        return convert(rval)