imm_dict(imm) yields a persistent dictionary of the params and values of the immutable
    object im. Note that this forces all of the values to be reified, so only use it if you want to
    force execution of all lazy values.
550108
def imm_dict(imm):
    '''
    
    '''
    immd = dict(**imm_params(imm))
    for (k,v) in six.iteritems(imm_values(imm)):
        immd[k] = v
    return immd
651907
def to_dict(self):
        
        final_res = {
            "param": self._param,
            "unused_param": self.unused_param,
            "execution_time": self._exec_time,
            "output": {"accuracy": self.get_accuracy(),
                       "weights": self.get_weights(),
                       "splines": self._splines
                       }
        }
        return final_res
1258200
def getEncodableAttributes(self, obj, **kwargs):
        
        attrs = pyamf.ClassAlias.getEncodableAttributes(self, obj, **kwargs)

        if not self.exclude_sa_key:
            # primary_key_from_instance actually changes obj.__dict__ if
            # primary key properties do not already exist in obj.__dict__
            attrs[self.KEY_ATTR] = self.mapper.primary_key_from_instance(obj)

        if not self.exclude_sa_lazy:
            lazy_attrs = []

            for attr in self.properties:
                if attr not in obj.__dict__:
                    lazy_attrs.append(attr)

            attrs[self.LAZY_ATTR] = lazy_attrs

        return attrs
450963
def to_serializable_repr(x):
    
    t = type(x)
    if isinstance(x, list):
        return list_to_serializable_repr(x)
    elif t in (set, tuple):
        return {
            "__class__": class_to_serializable_representation(t),
            "__value__": list_to_serializable_repr(x)
        }
    elif isinstance(x, dict):
        return dict_to_serializable_repr(x)
    elif isinstance(x, (FunctionType, BuiltinFunctionType)):
        return function_to_serializable_representation(x)
    elif type(x) is type:
        return class_to_serializable_representation(x)
    else:
        state_dictionary = to_serializable_repr(to_dict(x))
        state_dictionary["__class__"] = class_to_serializable_representation(
            x.__class__)
        return state_dictionary
1079099
def dict(self):
        
        return_obj = {}
        for attr in dir(self):
            if not attr.startswith('__') and attr not in self.__reserved:
                if isinstance(getattr(self, attr), list):
                    return_val = []
                    for item in getattr(self, attr):
                        if isinstance(item, DictClass):
                            return_val.append(dict(item))
                        else:
                            return_val.append(item)
                elif isinstance(getattr(self, attr), dict):
                    return_val = {}
                    for key, item in getattr(self, attr).items():
                        if isinstance(item, DictClass):
                            return_val[key] = item.dict()
                        else:
                            return_val[key] = item
                elif isinstance(getattr(self, attr), DictClass):
                    return_val = getattr(self, attr).dict()
                else:
                    return_val = getattr(self, attr)
                return_obj[attr] = return_val
        return return_obj
758020
def dict_fields(obj, parent=[]):
    
    rtn_obj = {}
    for key, value in obj.items():
        new_key = parent + [key]
        new_key = ".".join(new_key)
        if isinstance(value, list):
            if value:
                value = value[0]
        if isinstance(value, dict):
            rtn_obj.update(dict_fields(value, [new_key]))
        else:
            rtn_obj.update({new_key: value})
    return rtn_obj
1356472
def as_dict(self):
        
        result = {}
        for key in self._valid_properties:
            val = getattr(self, key)
            if isinstance(val, datetime):
                val = val.isoformat()
            # Parse custom classes
            elif val and not Model._is_builtin(val):
                val = val.as_dict()
            # Parse lists of objects
            elif isinstance(val, list):
                # We only want to call as_dict in the case where the item
                # isn't a builtin type.
                for i in range(len(val)):
                    if Model._is_builtin(val[i]):
                        continue
                    val[i] = val[i].as_dict()
            # If it's a boolean, add it regardless of the value
            elif isinstance(val, bool):
                result[key] = val

            # Add it if it's not None
            if val:
                result[key] = val
        return result
748667
def _imm_repr(self):
    '''
    
    '''
    return (type(self).__name__
            + ('(' if _imm_is_persist(self) else '*(')
            + ', '.join([k + '=' + str(v) for (k,v) in six.iteritems(imm_params(self))])
            + ')')
593463
def to_serializable_value(self):
        
        return_dict = {}
        for name, field in self.__dict__.items():
            if isinstance(field, fields.Field):
                return_dict[name] = field.to_serializable_value()
        return return_dict
859734
def _imm_dir(self):
    '''
    
    '''
    dir0 = set(dir(self.__class__))
    dir0.update(self.__dict__.keys())
    dir0.update(six.iterkeys(_imm_value_data(self)))
    return sorted(list(dir0))
1145278
def assoc(self, key, value):
        ''''''
        copydict = ImmutableDict()
        copydict.tree = self.tree.assoc(hash(key), (key, value))
        copydict._length = self._length + 1
        return copydict
1048433
def params_to_dict(params, dct):
    
    for param, val in params.items():
        if val is None:
            continue
        dct[param] = val
    return dct
888703
def dict_of(**kwargs):
    

    class DictOfKeyGenerators(ArbitraryInterface):
        """
        A closure class around the keys and generators specified above, which
        generates a dict of the keys and generators.
        """

        @classmethod
        def arbitrary(cls):
            """
            Generate a dict of the enclosed keys and generators.
            """
            return {
                key: arbitrary(generator)
                for key, generator in kwargs.iteritems()
            }

    DictOfKeyGenerators.__name__ = ''.join([
        'dict_of(', ', '.join([
            key + '=' + generator.__name__
            for key, generator in kwargs.iteritems()
        ]), ')'
    ])
    return DictOfKeyGenerators
1299349
def _model_to_dict(model, ignore):
        
        return {attr: value for attr, value in model.__dict__.items()
                if not attr.startswith('_') and attr not in ignore}
317654
def to_dict(self):
        
        return dict((parameter.name, parameter.value) for parameter in self.values())
744734
def _imm_setattr(self, name, value):
    '''
    
    '''
    if _imm_is_persist(self):
        raise TypeError('Attempt to change parameter \'%s\' of non-transient immutable' % name)
    elif _imm_is_trans(self):
        return _imm_trans_setattr(self, name, value)
    else:
        return _imm_init_setattr(self, name, value)
593404
def as_dict(self):
        
        d = {"@module": self.__class__.__module__,
             "@class": self.__class__.__name__,
             "name": self.name, "options": self.options}
        if len(self.subkeys) > 0:
            subkeys = []
            for subkey in self.subkeys:
                subkeys.append(subkey.as_dict())
            d.update({"subkeys": subkeys})
        return d