Write out the new config option value
@param  {String}       the name of the option to be changed
@param  {String}       the new value of the option to be changed
424694
protected static function writeUpdateConfigOption($optionName,$optionValue) {
		
		// parse the YAML options
		try {
			$options = Yaml::parse(file_get_contents(self::$userConfigPath));
		} catch (ParseException $e) {
			Console::writeError("Config parse error in <path>".self::$userConfigPath."</path>: ".$e->getMessage());
		}
		
		// set this option for the current running of the app
		self::setOption($optionName, $optionValue);
		
		// modify the yaml file results
		$arrayFinder = new ArrayFinder($options);
		$arrayFinder->set($optionName, $optionValue);
		$options = $arrayFinder->get();
		
		// dump the YAML
		$configOutput = Yaml::dump($options, 3);
		
		// write out the new config file
		file_put_contents(self::$userConfigPath,$configOutput);
		
	}
770578
function setSelectedOption(optionValue) {
    const newOptionSelected = this.state.options.filter(option => option.value.toString() === optionValue)[0];
    const newOptionSelectedValue = newOptionSelected && newOptionSelected.value;
    let options = this.clearListboxSelections(this.state.options);

    options = options.map(option => {
        if (option.value === newOptionSelectedValue) {
            option.selected = true;
            this.setState('selected', option);
            this.update();
        }
        return option;
    });

    this.setState('options', options);
}
64114
function (config) {
			
			var position, choice;
			
			// Get choice's position
			position = this.getChoicePosition(config);
			
			if (position === -1) {
				throw new Error("SelectField : invalid or missing position, label or value in removeChoice");
			}
			
			// Choice to remove
			choice = this.choicesList[position];
			
			// Clear if removing selected choice
			if (this.getValue() === choice.value) {
				this.clear();
			}
			
			// Remove choice in list at position
			this.choicesList.splice(position, 1); // remove 1 element at position
			
			// Remove node from DOM
			this.removeChoiceNode(choice.node);
			
		}
284510
private void applyChanges(PrintWriter out, Reconfigurable reconf,
                            HttpServletRequest req)
    throws IOException, ReconfigurationException {
    Configuration oldConf = reconf.getConf();
    Configuration newConf = new Configuration();

    if (reconf instanceof ReconfigurableBase)
      ((ReconfigurableBase) reconf).preProcessConfiguration(newConf); 
    
    Enumeration<String> params = getParams(req);

    synchronized(oldConf) {
      while (params.hasMoreElements()) {
        String rawParam = params.nextElement();
        String param = StringEscapeUtils.unescapeHtml(rawParam);
        String value =
          StringEscapeUtils.unescapeHtml(req.getParameter(rawParam));
        if (reconf instanceof ReconfigurableBase)
          param = ((ReconfigurableBase) reconf).preProcessKey(param);
        
        if (value != null) {
          if (value.equals(newConf.getRaw(param)) || value.equals("default") ||
              value.equals("null") || value.equals("")) {
            if ((value.equals("default") || value.equals("null") ||
                 value.equals("")) &&
                oldConf.getRaw(param) != null) {
              out.println("<p>Changed \"" +
                          StringEscapeUtils.escapeHtml(param) + "\" from \"" +
                          StringEscapeUtils.escapeHtml(oldConf.getRaw(param)) +
                          "\" to default</p>");
              reconf.reconfigureProperty(param, null);
            } else if (!value.equals("default") && !value.equals("null") &&
                       !value.equals("") &&
                       (oldConf.getRaw(param) == null ||
                        !oldConf.getRaw(param).equals(value))) {
              // change from default or value to different value
              if (oldConf.getRaw(param) == null) {
                out.println("<p>Changed \"" +
                            StringEscapeUtils.escapeHtml(param) +
                            "\" from default to \"" +
                            StringEscapeUtils.escapeHtml(value) + "\"</p>");
              } else {
                out.println("<p>Changed \"" +
                            StringEscapeUtils.escapeHtml(param) + "\" from \"" +
                            StringEscapeUtils.escapeHtml(oldConf.
                                                         getRaw(param)) +
                            "\" to \"" +
                            StringEscapeUtils.escapeHtml(value) + "\"</p>");
              }
              reconf.reconfigureProperty(param, value);
            } else {
              LOG.info("property " + param + " unchanged");
            }
          } else {
            // parameter value != newConf value
            out.println("<p>\"" + StringEscapeUtils.escapeHtml(param) +
                        "\" not changed because value has changed from \"" +
                        StringEscapeUtils.escapeHtml(value) + "\" to \"" +
                        StringEscapeUtils.escapeHtml(newConf.getRaw(param)) +
                        "\" since approval</p>");
          }
        }
      }
    }
  }
752557
function writeValue(value, fieldSchema) {
        // onBeforeValueSet allows you to cancel the operation.
        // It doesn't work like transform and others that allow you to modify the value because all typecast has already happened.
        // For use-cases where you need to modify the value, you can set a new value in the handler and return false.
        if (this[_privateKey]._options.onBeforeValueSet) {
            if (this[_privateKey]._options.onBeforeValueSet.call(this, value, fieldSchema.name) === false) {
                return;
            }
        }

        // Alias simply copies the value without actually writing it to alias index.
        // Because the value isn't actually set on the alias index, onValueSet isn't fired.
        if (fieldSchema.type === 'alias') {
            this[fieldSchema.index] = value;
            return;
        }

        // Write the value to the inner object.
        this[_privateKey]._obj[fieldSchema.name] = value;

        // onValueSet notifies you after a value has been written.
        if (this[_privateKey]._options.onValueSet) {
            this[_privateKey]._options.onValueSet.call(this, value, fieldSchema.name);
        }
    }
1114135
function setOption(options, name, value) {
            if (typeof options[name] === 'undefined')
                options[name] = value;
            else {
                if (!Array.isArray(options[name]))
                    options[name] = [ options[name] ];
                options[name].push(value);
            }
        }
1012699
def write_newick(rootnode, 
	features=None, 
	format=1, 
	format_root_node=True,
    is_leaf_fn=None, 
    dist_formatter=None,
    support_formatter=None,
    name_formatter=None):
    
    newick = []
    leaf = is_leaf_fn if is_leaf_fn else lambda n: not bool(n.children)
    for postorder, node in rootnode.iter_prepostorder(is_leaf_fn=is_leaf_fn):
        if postorder:
            newick.append(")")
            if node.up is not None or format_root_node:
                newick.append(format_node(node, "internal", format,
                                          dist_formatter=dist_formatter,
                                          support_formatter=support_formatter,
                                          name_formatter=name_formatter))
                newick.append(_get_features_string(node, features))
        else:
            if node is not rootnode and node != node.up.children[0]:
                newick.append(",")

            if leaf(node):
                safe_name = re.sub("["+_ILEGAL_NEWICK_CHARS+"]", "_", \
                               str(getattr(node, "name")))
                newick.append(format_node(node, "leaf", format,
                              dist_formatter=dist_formatter,
                              support_formatter=support_formatter,
                              name_formatter=name_formatter))
                newick.append(_get_features_string(node, features))
            else:
                newick.append("(")

    newick.append(";")
    return ''.join(newick)
726698
function () {
                var newValue = this._cfg.keyValue;
                this._cfg.value = newValue;
                this.setProperty("value", newValue);
                // setProperty on value might destroy the widget
                if (this._cfg) {
                    this._setState();
                    this._updateDomForState();
                    if (this._cfg.onchange) {
                        this.evalCallback(this._cfg.onchange);
                    }
                }
            }
186485
function CString(value, written, cond) {
  this.value   = value   || '';
  this.written = written || false;
  this.cond    = cond    || false;
}
1072112
def config_present(name, value):
    '''
    

    '''
    name = name.lower()
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    # load confiration
    config = _load_config()

    # handle bool and None value
    if isinstance(value, (bool)):
        value = 'true' if value else 'false'
    if not value:
        value = ""

    if name in config:
        if six.text_type(config[name]) == six.text_type(value):
            # we're good
            ret['result'] = True
            ret['comment'] = 'property {0} already has value "{1}"'.format(name, value)
        else:
            # update property
            ret['result'] = True
            ret['comment'] = 'updated property {0} with value "{1}"'.format(name, value)
            ret['changes'][name] = value
            config[name] = value
    else:
        # add property
        ret['result'] = True
        ret['comment'] = 'added property {0} with value "{1}"'.format(name, value)
        ret['changes'][name] = value
        config[name] = value

    # apply change if needed
    if not __opts__['test'] and ret['changes']:
        ret['result'] = _write_config(config)

    return ret
1355957
public function config_write($name, $value) {
        global $DB, $USER, $CFG;

        if ($this->nosave) {
            return true;
        }

        // make sure it is a real change
        $oldvalue = get_config($this->plugin, $name);
        $oldvalue = ($oldvalue === false) ? null : $oldvalue; // normalise
        $value = is_null($value) ? null : (string)$value;

        if ($oldvalue === $value) {
            return true;
        }

        // store change
        set_config($name, $value, $this->plugin);

        // Some admin settings affect course modinfo
        if ($this->affectsmodinfo) {
            // Clear course cache for all courses
            rebuild_course_cache(0, true);
        }

        $this->add_to_config_log($name, $oldvalue, $value);

        return true; // BC only
    }
1005354
function writeValue(rh, value, to) {
            if (typeof to === "undefined") { to = ''; }
            shared.utils.dassert(shared.utils.isObject(rh));
            var type = shared.utils.treatAs(value);
            switch(type) {
                case 'null':
                    to += 'null';
                    break;
                case 'undefined':
                    to += 'undefined';
                    break;
                case 'number':
                case 'Number':
                case 'boolean':
                case 'Boolean':
                    to += value.toString();
                    break;
                case 'string':
                case 'String':
                    to += JSON.stringify(value);
                    break;
                case 'Date':
                    to += JSON.stringify(value.toString());
                    break;
                case 'Object':
                case 'Array':
                    to += '<' + rh.valueId(value) + '>';
                    break;
                case 'function':
                case 'RegExp':
                case 'Error':
                    to += 'null';
                    break;
                default:
                    shared.utils.defaultLogger().fatal('Unexpected type: %s', type);
                    break;
            }
            return to;
        }
527755
function setSelectedOption(optionValue) {
    const optionFind = (option) => option.value.toString() === optionValue.toString();
    const newOptionSelected = find(this.state.options, optionFind);
    const newOptionSelectedValue = newOptionSelected && newOptionSelected.value;
    let options = this.state.options;

    options = options.map((option, i) => {
        if (option.value === newOptionSelectedValue) {
            option.selected = true;
            this.setState('selectedIndex', i);
            this.setState('value', option.value);
        } else {
            option.selected = false;
        }
        return option;
    });
    this.setState('options', options);
    this.update();
}
350779
function (name, newValue) {
		if (arguments.length > 1) {
			this.setValue(name, newValue);
		}
		else {
			var attrs = name;
			this.setMap(attrs);
		}
	}
385157
function(config) {
        var self = this;

        return new Promise(function(resolve, reject) {
            if (self._options.output) {
                fs.writeFileAsync(self._options.output, config)
                    .then(function() {
                        resolve(config);
                    });
            } else {
                resolve(config);
            }
        });
    }
1094198
public synchronized void setOption(String key, String value)
	{
		if (key == null || value == null) {
			return;
		}
		config.put(key, value);
	}
905891
private boolean addConfig(String section, String option, String value) {
        if (section.equals("")) {
            section = DEFAULT_SECTION;
        }

        if (!data.containsKey(section)) {
            data.put(section, new HashMap<>());
        }

        boolean ok = data.get(section).containsKey(option);
        data.get(section).put(option, value);
        return !ok;
    }