

def __instantiate_from_dict(self, data):
    '\n        Will populate the model from a dictionary passed as a constructor.\n        '
    if (type(data) == dict):
        for key in data.keys():
            if self.has_key(key):
                val = data[key]
                if isinstance(val, dict):
                    model_instance = self.__class__.__dict__[key].to(val)
                    self.__field_map[key].value = model_instance
                    self.__dict__[key] = self.__field_map[key].value
                    self[key] = self.__field_map[val].value
                else:
                    self.__field_map[key].value = data[key]
                    self.__dict__[key] = self.__field_map[key].value
                    self[key] = self.__field_map[key].value
            else:
                logging.warning(("Ignoring '%s' from input, couldn't find matching model Field entry" % key))
    else:
        raise ValueError('Input data to model must be a dictionary')

dataset/ETHPy150Open lonelycode/Mojo/Mojo/ObjectMapper/ModelPrototype.py Model.__instantiate_from_dict/VarMisuse@116/167 `key`->`val`