change value

        Args:
            path (str): the new environment path
556115
def changeTo(self, path):
        '''
        '''
        dictionary = DictSingle(Pair('PATH', StringSingle(path)))
        self.value = [dictionary]
376982
def _insert_vars(self, path: str, data: dict) -> str:
        
        data = data.copy()
        while True:
            match = re.search(self.VAR_REPLACE_REGEX, path)
            if not match:
                return path
            replace_from = match.group(0)
            replace_with = str(data.get(match.group(1)))
            path = path.replace(replace_from, replace_with)
1094627
def add_path(self, path):
        # type: (_BaseSourcePaths, str) -> None
        
        if isinstance(path, pathlib.Path):
            self._paths.append(path)
        else:
            self._paths.append(pathlib.Path(path))
411227
def change_python_path(pythonpath):
    '''
    '''

    split = pythonpath.split('|')
    sys.path = []
    for path in split:
        path = path.strip()
        if len(path) > 0:
            sys.path.append(path)
878108
def environment_variable(key, value):
    

    if key not in os.environ:
        previous = None
    else:
        previous = os.environ[key]

    os.environ[key] = value

    yield

    if previous is None:
        del os.environ[key]
    else:
        os.environ[key] = previous
646581
def set_value_for_keypath(obj, path, new_value, preserve_child = False):
    
    parts = path.split('.')
    last_part = len(parts) - 1
    dst = obj
    for i, part in enumerate(parts):
        match = re.match(list_index_re, part)
        if match is not None:
            dst = _extract(dst, match.group(1))
            if not isinstance(dst, list) and not isinstance(dst, tuple):
                raise TypeError('expected list/tuple')
            index = int(match.group(2))
            if i == last_part:
                dst[index] = new_value
            else:
                dst = dst[index]
        else:
            if i != last_part:
                dst = _extract(dst, part)
            else:
                if isinstance(dst, dict):
                    dst[part] = new_value
                else:
                    if not preserve_child:
                        setattr(dst, part, new_value)
                    else:
                        try:
                            v = getattr(dst, part)
                        except AttributeError:
                            setattr(dst, part, new_value)
1196321
def set_env_value(obj, attribute, value):
    
    varname = get_env_key(obj, attribute)
    os.environ[varname] = value
    return varname
848501
def move(self, path, raise_if_exists=False):
        
        self.rename(path, raise_if_exists=raise_if_exists)
359199
def set_key(key: str, value: typing.List[str], persists: bool = True):
    

    if key.endswith('_path') or key.endswith('_paths'):
        for index in range(len(value)):
            value[index] = environ.paths.clean(value[index])

    if len(value) == 1:
        value = value[0]

    environ.configs.put(**{key: value}, persists=persists)
    environ.configs.save()
    environ.log('[SET]: "{}" to "{}"'.format(key, value))
460186
def rename_dont_move(self, path, dest):
        
        self.move(path, dest, raise_if_exists=True)
1352088
def set_env(envName, envValue):
    
    os.environ[envName] = os.environ[envName] + ':' + envValue
203347
def set_mypy_path(mypy_path):
    """"""
    original = os.environ.get(mypy_path_env_var)
    if original is None:
        new_mypy_path = mypy_path
    elif not original.startswith(mypy_path):
        new_mypy_path = mypy_path + os.pathsep + original
    else:
        new_mypy_path = None
    if new_mypy_path is not None:
        logger.log(mypy_path_env_var + ":", new_mypy_path)
        os.environ[mypy_path_env_var] = new_mypy_path
1145163
def set_path(self, data, path, value):
        
        self.say('set_path:value:' + str(value) +
                 ' at:' + str(path) + ' in:' + str(data))

        if isinstance(path, str):
            path = path.split('.')
        if len(path) > 1:
            self.set_path(data.setdefault(path[0], {}), path[1:], value)
        else:
            data[path[0]] = value
        return data
1068120
def replace(path, value, **kwargs):
    
    return _gen_4spec(LCB_SDCMD_REPLACE, path, value,
                      create_path=False, **kwargs)
1229455
def fixPath(path):
  
  path = os.path.abspath(os.path.expanduser(path))
  if path.startswith("\\"):
    return "C:" + path

  return path
331914
def Update(self, env, args=None):
        

        values = {}

        # first set the defaults:
        for option in self.options:
            if not option.default is None:
                values[option.key] = option.default

        # next set the value specified in the options file
        for filename in self.files:
            if os.path.exists(filename):
                dir = os.path.split(os.path.abspath(filename))[0]
                if dir:
                    sys.path.insert(0, dir)
                try:
                    values['__name__'] = filename
                    with open(filename, 'r') as f:
                        contents = f.read()
                    exec(contents, {}, values)
                finally:
                    if dir:
                        del sys.path[0]
                    del values['__name__']

        # set the values specified on the command line
        if args is None:
            args = self.args

        for arg, value in args.items():
            added = False
            for option in self.options:
                if arg in list(option.aliases) + [ option.key ]:
                    values[option.key] = value
                    added = True
            if not added:
                self.unknown[arg] = value

        # put the variables in the environment:
        # (don't copy over variables that are not declared as options)
        for option in self.options:
            try:
                env[option.key] = values[option.key]
            except KeyError:
                pass

        # Call the convert functions:
        for option in self.options:
            if option.converter and option.key in values:
                value = env.subst('${%s}'%option.key)
                try:
                    try:
                        env[option.key] = option.converter(value)
                    except TypeError:
                        env[option.key] = option.converter(value, env)
                except ValueError as x:
                    raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))


        # Finally validate the values:
        for option in self.options:
            if option.validator and option.key in values:
                option.validator(option.key, env.subst('${%s}'%option.key), env)
1267696
def update(self, path):
        
        self._reset()
        self.path = path
        self._refresh_synced()
        if self.is_synced:
            self._refresh_path()
            self._refresh_signed()
            self._refresh_nvr()