Add parsed values to model.
15834
public function getValuesParsedAttribute()
    {
        if ($this->attributes['data'] == '')
            return null;

        $data = unserialize($this->attributes['data']);

        if (!isset($data['values']))
            return null;
        else {
            $values = preg_split("/\\r\\n|\\r|\\n/", $data['values']);
            $ret = [];

            foreach ($values as $item) {
                if (strpos($item, '=>')) {
                    $item = str_replace(' => ', '=>', $item);
                    list($key, $value) = explode('=>', $item);

                    $ret[$key] = $value;
                } else {
                    $ret[$item] = $item;
                }
            }

            return $ret;
        }
    }
999957
def add_values(self, values):
        ''''''
        if self.child.is_alive():
            self.parent_pipe.send(values)
651530
void addValues(ObjectName pOName, Set<String> pReadAttributes, Set<String> pWriteAttributes, Set<String> pOperations) {
        readAttributes.put(pOName,pReadAttributes);
        writeAttributes.put(pOName,pWriteAttributes);
        operations.put(pOName,pOperations);
        if (pOName.isPattern()) {
            addPattern(pOName);
        }
    }
1004646
def append(self, mode, metric, step, value):
    """"""
    if mode not in self._values:
      self._values[mode] = collections.defaultdict(list)
    self._values[mode][metric].append((step, value))
585882
def update_models(self, model, name, info):
        

        if info.method_name in ["add_input_data_port", "remove_input_data_port", "input_data_ports"]:
            (model_list, data_list, model_name, model_class, model_key) = self.get_model_info("input_data_port")
        elif info.method_name in ["add_output_data_port", "remove_output_data_port", "output_data_ports"]:
            (model_list, data_list, model_name, model_class, model_key) = self.get_model_info("output_data_port")
        elif info.method_name in ["add_income", "remove_income", "income"]:
            (model_list, data_list, model_name, model_class, model_key) = self.get_model_info("income")
        elif info.method_name in ["add_outcome", "remove_outcome", "outcomes"]:
            (model_list, data_list, model_name, model_class, model_key) = self.get_model_info("outcome")
        else:
            return

        if "add" in info.method_name:
            self.add_missing_model(model_list, data_list, model_name, model_class, model_key)
        elif "remove" in info.method_name:
            destroy = info.kwargs.get('destroy', True)
            self.remove_specific_model(model_list, info.result, model_key, destroy)
        elif info.method_name in ["input_data_ports", "output_data_ports", "income", "outcomes"]:
            self.re_initiate_model_list(model_list, data_list, model_name, model_class, model_key)
369088
def _add_attrs(self):
        ''''''
        for attr in self.template_attrs:
            attr_value = self._get_template_attr(attr)

            if not attr_value:
                continue

            attr, attr_value = self._transform_key_value(
                attr,
                attr_value,
                self.attr_map
            )
            self.templ_dict[attr] = attr_value
837035
def add_inputs_to_object(obj, values):
    
    for item in obj.inputs:
        if hasattr(obj, item):
            # print(item)
            setattr(obj, item, values[item])
1236440
def extend(self, values):
        """"""
        self.database.run_script(
            'array_extend',
            keys=[self.key],
            args=values)
112116
def _set_seo_models(self, value):
        """"""
        seo_models = []
        for model_name in value:
            if "." in model_name:
                app_label, model_name = model_name.split(".", 1)
                model = apps.get_model(app_label, model_name)
                if model:
                    seo_models.append(model)
            else:
                app = apps.get_app_config(model_name)
                if app:
                    seo_models.extend(app.get_models())

        self.seo_models = seo_models
75761
def save_params(model_name: str):
    """"""
    with open(model_name + '.params', 'w') as f:
        json.dump(pr.__dict__, f)
528485
def _load_outcome_models(self):
        
        self.outcomes = []
        for outcome in self.state.outcomes.values():
            self._add_model(self.outcomes, outcome, OutcomeModel)
62427
def save_to_db(model_text_id, parsed_values):
        """"""
        Model = apps.get_model(model_text_id)

        # normalise values and separate to m2m, simple
        simple_fields = {}
        many2many_fields = {}
        for field, value in parsed_values.items():
            if (Model._meta.get_field(
                    field).get_internal_type() == 'ManyToManyField'):
                many2many_fields[field] = value
            elif (Model._meta.get_field(
                    field).get_internal_type() == 'DateTimeField'):
                simple_fields[field] = time_parser.parse(value)

            else:
                simple_fields[field] = value

        # ToDo: add unique identify parameter to field
        # ToDo: allow unique identify m2m field
        model, created = Model.objects.get_or_create(**simple_fields)

        for field, value in many2many_fields.items():
            setattr(model, field, value)
        model.save()

        return model
684207
def put(self, _name, **values):
        
        try:
            sql = self.sqles[_name]
            data = sql['data']
            if sql['positional']:
                d = [values[k] for k, v in sql['fields'].items()]
            else:
                d = {v:values[k] for k, v in sql['fields'].items()}
            data.append(d)
            if self.size and len(data) >= self.size:
                do_(sql['raw_sql'], args=data)
                sql['data'] = []
        except:
            if self.transcation:
                Rollback(self.engine)
            raise
290085
def append_data(self, attribute, values):
        """"""
        found = False
        if type(values) != list:
            values = [values]
        for col in self.Table:
            if attribute in col:
                dict_values = [u"{0}".format(value) for value in values]
                col[attribute] += dict_values
                found = True
        if not found:
            raise KeyError(attribute)
90698
def add_model(self, model):
        
        if model.identity not in self._models.keys():
            self._models[model.identity] = model
        else:
            raise ValueError("{} has already been defined".format(model.identity))
1297512
def add(self, key, value):
        
        if key.endswith('_'):
            key = key[:-1]
        if key in self.attributes:
            self.attributes[key] = self.attributes[key] + ' ' + value
        else:
            self.attributes[key] = value
832335
def _add_attribute_values(self, value, att_mappings, indices):
        
        for i in indices:
            att_mappings[i].append(value)