Creates dict object from dict2 object

        Args:
            val (:obj:`dict2`): Value to create from

        Returns:
            Equivalent dict object.
491932
def to_dict(self, val=UNSET):
        
        if val is UNSET:
            val = self

        if isinstance(val, dict2) or isinstance(val, dict):
            res = dict()
            for k, v in val.items():
                res[k] = self.to_dict(v)
            return res
        elif isinstance(val, list):
            res = []
            for item in val:
                res.append(self.to_dict(item))
            return res
        else:
            return val
255804
def fmt_dict_vals(dict_vals, shorten=True):
    
    items = dict_vals.items()
    if not items:
        return [fmt_val(None, shorten=shorten)]
    return ["%s=%s" % (k, fmt_val(v, shorten=shorten)) for k,v in items]
122686
def val(self, name):
        
        v = getattr(self, name)
        if hasattr(v, 'retrieve_value'):
            v = v.retrieve_value(self.__dict__)
        return v
616710
def from_dict(cls, data, model):
        
        model_provided = model is not None
        result = {}
        for name, new_value in data.items():
            kwargs = {
                'name': name,
                'new_value': new_value,
            }
            if model_provided:
                kwargs['params'] = model.get_field_params(name)
            result[name] = cls(**kwargs)
        return result
1303869
def dict2obj(d):
    
    if isinstance(d, (list, tuple)):
        d = [dict2obj(x) for x in d]
    if not isinstance(d, dict):
        return d
    class ObjectFromDict(object):
        pass
    o = ObjectFromDict() #an object created from a dict
    for k in d:
        o.__dict__[k] = dict2obj(d[k])
    return o
519838
def dict_to_binary(val)
      saved_object_count = @written_object_count
      @written_object_count += 1

      #@object_refs += val.value.keys.size * 2

      keys_and_values = val.value.keys.map { |k| CFString.new(k).to_binary(self) }
      keys_and_values.concat(val.value.values.map { |v| v.to_binary(self) })

      bdata = Binary.type_bytes(0b1101,val.value.size) <<
        Binary.pack_int_array_with_size(object_ref_size(@object_refs), keys_and_values)

      @object_table[saved_object_count] = bdata
      return saved_object_count
    end
1011484
def from_dict(self, d):
        
        self.length = d.get("length", 0)
        self.instanceHigh = d.get("instanceHigh", 0)
        self.instanceMid = d.get("instanceMid", 0)
        self.instanceLow = d.get("instanceLow", 0)

        material = d.get("material", {'Data1':0, 'Data2':0, 'Data3':0, 'Data4': [0 for i in range(8)]})

        self.Data1 = material.get('Data1', 0)
        self.Data2 = material.get('Data2', 0)
        self.Data3 = material.get('Data3', 0)

        self.Data4 = material.get("Data4", [0 for i in range(8)])
        self.SMPTELabel = d.get("SMPTELabel", [0 for i in range(12)])
735838
def create_from(value):
        
        """
        def convert(val):
            if isinstance(val, tuple):
                return tuple(convert(v) for v in val)
            elif isinstance(val, list):
                return [convert(v) for v in val]
            elif isinstance(val, (dict, ElasticDict)):
                return ElasticDict({k: convert(v) for k, v in val.iteritems()})
            else:
                return val

        return convert(value)
297347
def from_dict(self, values):
        
        for k in values.keys():
            setattr(self, k, values[k])
307952
def from_dict(cls, obj_dict):
        

        # convert the output into a proper form
        obj_dict['output'] = helper.rec_dict_to_numpy_dict(obj_dict["output"])

        helper.dict_to_numpy_dict(obj_dict['output'])
        if "trained_global_model" in obj_dict.keys():
            raise Exception("Found trained_global_model feature in dictionary. Use ConciseCV.load to load this file.")
        dc = Concise(**obj_dict["param"])

        # touch the hidden arguments
        dc._param = obj_dict["param"]
        if obj_dict["output"]["weights"] is None:
            dc._model_fitted = False
        else:
            dc._model_fitted = True
            dc._exec_time = obj_dict["execution_time"]

        dc.unused_param = obj_dict["unused_param"]
        dc._accuracy = obj_dict["output"]["accuracy"]
        dc._splines = obj_dict["output"]["splines"]

        weights = obj_dict["output"]["weights"]

        if weights is not None:
            # fix the dimensionality of X_feat in case it was 0 dimensional
            if weights["feature_weights"].shape == (0,):
                weights["feature_weights"].shape = (0, obj_dict["param"]["num_tasks"])
            dc._set_var_res(weights)

        return dc
1334770
def from_dict(cls, dictionary, root=False):
        

        def create_tree(value):
            if isinstance(value, dict):
                res = ConfigTree(root=root)
                for key, child_value in value.items():
                    res.put(key, create_tree(child_value))
                return res
            if isinstance(value, list):
                return [create_tree(v) for v in value]
            else:
                return value

        return create_tree(dictionary)
495792
def dict_assign(dict_, keys, vals):
    
    for key, val in zip(keys, vals):
        dict_[key] = val
990500
def new_from_json_dict(cls, data):
        
        new_data = {utils.to_snake_case(key): value
                    for key, value in data.items()}

        return cls(**new_data)
971278
def with_value(self, key, val):
        ''' 
        '''
        new_dict = dict(self._dict)
        new_dict[key] = val
        return AuthContext(new_dict)
1214732
def serialize_dict(self, value):
        

        # Check if this is a dict
        if not isinstance(value, dict):
            return value

        # Loop over all the values and serialize them
        return {
            dict_key: self.serialize_value(dict_value)
            for dict_key, dict_value in value.items()
        }
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
1107706
def from_dict(cls, arr_dict, dtype=None, fillna=False, **kwargs):
        
        # i hope order of keys == order or values
        if dtype is None:
            names = sorted(list(arr_dict.keys()))
        else:
            dtype = np.dtype(dtype)
            dt_names = [f for f in dtype.names]
            dict_names = [k for k in arr_dict.keys()]
            missing_names = set(dt_names) - set(dict_names)
            if missing_names:
                if fillna:
                    dict_names = dt_names
                    for missing_name in missing_names:
                        arr_dict[missing_name] = np.nan
                else:
                    raise KeyError(
                        'Dictionary keys and dtype fields do not match!'
                    )
            names = list(dtype.names)

        arr_dict = cls._expand_scalars(arr_dict)
        data = [arr_dict[key] for key in names]
        return cls(np.rec.fromarrays(data, names=names, dtype=dtype), **kwargs)