Set specified value to yaml path.
        Example:
        patch('application/components/child/configuration/__locator.application-id','777')
        Will change child app ID to 777
165779
def patch_env(env, path, value):
        
        def pathGet(dictionary, path):
            for item in path.split("/"):
                dictionary = dictionary[item]
            return dictionary

        def pathSet(dictionary, path, value):
            path = path.split("/")
            key = path[-1]
            dictionary = pathGet(dictionary, "/".join(path[:-1]))
            dictionary[key] = value

        pathSet(env, path, value)
        return True
653439
def set(self, key, value):
        """"""
        cmd = [
            "heroku",
            "config:set",
            "{}={}".format(key, quote(str(value))),
            "--app",
            self.name,
        ]
        if self._is_sensitive_key(key):
            self._run_quiet(cmd)
        else:
            self._run(cmd)
582514
def update_config(updated_project):
    '''
    

    '''

    home = os.path.expanduser('~')
    if os.path.isfile(os.path.join(home, '.transfer', 'config.yaml')):
        with open(os.path.join(home, '.transfer', 'config.yaml'), 'r') as fp:
            projects = yaml.load(fp.read())
        replace_index = -1
        for i, project in enumerate(projects):
            if project['name'] == updated_project['name']:
                replace_index = i

        if replace_index > -1:
            projects[replace_index] = updated_project
            store_config(projects)
        else:
            print('Not saving configuration')
            print(colored('Project: ' + updated_project['name'] + ' was not found in configured projects!', 'red'))

    else:
        print('Transfer is not configured.')
        print('Please run:')
        print('')
        print(colored('    transfer --configure', 'cyan'))
        return
396999
def from_yaml(cls, path):
        """"""
        import yaml

        with path.open(mode='r') as fp:
            source = yaml.safe_load(fp) or {}
            self = cls.from_jsonld(
                source,
                __reference__=path,
                __source__=deepcopy(source),
            )

        return self
4182
def setup_logging(default_path='logging.yaml', env_key='LOG_CFG'):
    
    path = default_path
    value = os.getenv(env_key, None)
    if value:
        path = value
    if os.path.exists(path):
        with open(path, 'rt') as f:
            configs = yaml.safe_load(f.read())
        logging.config.dictConfig(configs)
    else:
        logging.config.dictConfig(config)
15876
def set_api_from_config_path(self) -> None:
        """"""
        config = ConfigParser(allow_no_value=False)
        # TODO: Remove this after this issue https://github.com/python/mypy/issues/2427 is closed
        config.optionxform = str  # type:ignore
        config.read(self.config_path, "utf-8")
        if config.has_option("defaults", "dynamic_loading"):
            dynamic_loading = config.get("defaults", "dynamic_loading")
        else:
            dynamic_loading = "infura"
        self._set_rpc(dynamic_loading)
556115
def changeTo(self, path):
        '''
        '''
        dictionary = DictSingle(Pair('PATH', StringSingle(path)))
        self.value = [dictionary]
100010
def update_from_file(yaml_dict, filepaths):
    '''
    
    '''
    # load YAML settings with only fields in yaml_dict
    yaml_dict.update(registry.load(filepaths, list(yaml_dict)))
935482
def update(target, path, value):
    
    names = path.split(".")
    names_length = len(names)
    node = target
    for index in range(names_length):
        name = names[index]
        if index == names_length - 1:
            last = True
        else:
            last = False
        if isinstance(node, dict):
            if last:
                node[name] = value
                return
            else:
                if not name in node:
                    node[name] = {}
                node = node[name]
        elif isinstance(node, list):
            name = int(name)
            listpad(node, name+1)
            if last:
                node[name] = value
                return
            else:
                node[name] = {}
                node = node[name]
        else:
            if last:
                setattr(node, name, value)
            else:
                setattr(node, name, {})
                node = getattr(node, name)
223059
def _apply_new_data_port_default_value(self, path, new_default_value_str):
        
        try:
            data_port_id = self.list_store[path][self.ID_STORAGE_ID]
            if isinstance(self.model.state, LibraryState):
                # this always has to be true, as the runtime value column can only be edited
                # if the use_runtime_value flag is True
                if self.list_store[path][self.USE_RUNTIME_VALUE_STORAGE_ID]:
                    self.set_data_port_runtime_value(data_port_id, new_default_value_str)
            else:
                if str(self.state_data_port_dict[data_port_id].default_value) != new_default_value_str:
                    self.state_data_port_dict[data_port_id].default_value = new_default_value_str
        except (TypeError, AttributeError) as e:
            logger.exception("Error while changing default value")
504693
def set(self, path, value):
        """"""
        _log.debug(
            "ZK: Setting {path} to {value}".format(path=path, value=value)
        )
        return self.zk.set(path, value)
1085125
def set_attr(obj, path, value):
    
    try:
        return _set_attr(obj, split_field(path), value)
    except Exception as e:
        Log = get_logger()
        if PATH_NOT_FOUND in e:
            Log.warning(PATH_NOT_FOUND + ": {{path}}", path=path, cause=e)
        else:
            Log.error("Problem setting value", cause=e)
1368280
def parse_yaml(self, y):
        '''

        '''
        self.component_id = y['componentId']
        self.instance_name = y['instanceName']
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
1355016
def get_yaml_config(config_path):
    
    config_path = os.path.expanduser(config_path)
    if not os.path.isfile(config_path):
        raise IpaUtilsException(
            'Config file not found: %s' % config_path
        )

    with open(config_path, 'r') as f:
        config = yaml.safe_load(f)
    return config
729844
def write(settings_path, settings_data, **kwargs):
    """"""
    for key, value in settings_data.items():
        dotenv_cli.set_key(str(settings_path), key.upper(), str(value))
1050368
def set_key(dotenv_path, key_to_set, value_to_set, quote_mode="always"):
    
    value_to_set = value_to_set.strip("'").strip('"')
    if not os.path.exists(dotenv_path):
        warnings.warn("can't write to %s - it doesn't exist." % dotenv_path)
        return None, key_to_set, value_to_set

    if " " in value_to_set:
        quote_mode = "always"

    line_template = '{}="{}"\n' if quote_mode == "always" else '{}={}\n'
    line_out = line_template.format(key_to_set, value_to_set)

    with rewrite(dotenv_path) as (source, dest):
        replaced = False
        for mapping in parse_stream(source):
            if mapping.key == key_to_set:
                dest.write(line_out)
                replaced = True
            else:
                dest.write(mapping.original)
        if not replaced:
            dest.write(line_out)

    return True, key_to_set, value_to_set
840742
function (path, value) {
    if (typeof path == 'string') {
      path = path.split('.');
    } else if (!Array.isArray(path)) {
      return;
    }

    var propName = path.shift();
    var prop = Model.allProperties[propName] || opts.extra[propName];
    var currKey, currObj;

    if (!prop) {
      return;
    }
    if (path.length == 0) {
      instance[propName] = value;
      return;
    }
    currObj = instance[propName];

    while(currObj && path.length > 0 ) {
      currKey = path.shift();

      if (path.length > 0) {
        currObj = currObj[currKey];
      } else if (currObj[currKey] !== value) {
        currObj[currKey] = value;
        opts.changes.push(propName);
      }
    }
  }