merges the values from the .env file and the environment variables (they overwrite the previous one)
420501
private static function mergeEnvVariables($value, $previous = '')
    {
        $out = [];
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $affect = self::mergeEnvVariables($v, ($previous == '') ? $k : $previous . '.' . $k);
                $out[$k] = $affect;
            }
        } else {
            $valueFromEnv = getenv($previous);
            if ($valueFromEnv===false) {
                return $value;
            } else {
                return $valueFromEnv;
            }
        }
        return $out;
    }
102856
def make_value_from_env(self, param, value_type, function):
        
        value = os.getenv(param)
        if value is None:
            self.notify_user("Environment variable `%s` undefined" % param)
        return self.value_convert(value, value_type)
884789
def dotenv_values(dotenv_path):
    
    values = OrderedDict(parse_dotenv(dotenv_path))
    values = resolve_nested_variables(values)
    return values
660125
function (file, enc, cb) {
        var yaml_files = options.src;

        if (typeof yaml_files === 'string') {
            yaml_files = [yaml_files];
        }

        var yaml_data = {};

        // Read all files in order, and override if later files contain same values.
        for (var i = 0; i < yaml_files.length; i++) {
            yaml_data = Object.assign(yaml_data, readYamlFile(yaml_files[i]));
        }

        var current_data = file[options.property];
        var new_data = null;

        // Merge with possible previous data.
        if (options.override) {
            new_data = Object.assign(current_data, yaml_data);
        } else {
            new_data = Object.assign(yaml_data, current_data);
        }

        file[options.property] = new_data;

        cb(null, file);
    }
618810
def save_existing_iam_env_vars(self):
        """"""
        for i in ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',
                  'AWS_SESSION_TOKEN']:
            if i in self.env_vars:
                self.env_vars['OLD_' + i] = self.env_vars[i]
371564
def merge_config_files(fnames):
    
    def _load_yaml(fname):
        with open(fname) as in_handle:
            config = yaml.safe_load(in_handle)
        return config
    out = _load_yaml(fnames[0])
    for fname in fnames[1:]:
        cur = _load_yaml(fname)
        for k, v in cur.items():
            if k in out and isinstance(out[k], dict):
                out[k].update(v)
            else:
                out[k] = v
    return out
1150390
def change_env(name, val):
    
    oldval = os.environ.get(name, None)
    os.environ[name] = val
    yield
    if oldval is None:
        del os.environ[name]
    else:
        os.environ[name] = oldval
899140
def create_path_env_var(new_entries, env=None, env_var='PATH', delimiter=':', prepend=False):
  """"""
  if env is None:
    env = {}

  prev_path = env.get(env_var, None)
  if prev_path is None:
    path_dirs = list()
  else:
    path_dirs = list(prev_path.split(delimiter))

  new_entries_list = list(new_entries)

  if prepend:
    path_dirs = new_entries_list + path_dirs
  else:
    path_dirs += new_entries_list

  return delimiter.join(path_dirs)
542651
def merge(self):
        """"""
        temp_dir = self.temp_dir
        app_dir = self.application.directory
        for root, dirs, files in os.walk(temp_dir):
            for directory in dirs:
                directory = os.path.join(root, directory)
                directory = directory.replace(temp_dir, app_dir, 1)
                try:
                    os.mkdir(directory)
                except OSError:
                    pass
            for file in files:
                source = os.path.join(root, file)
                target = source.replace(temp_dir, app_dir, 1)
                relative_target = target.replace(app_dir, '.')
                action = 'r'
                if (
                    os.path.exists(target)
                    and not filecmp.cmp(source, target, shallow=False)
                    and os.stat(target).st_size > 0
                ):
                    # target exists, is not empty, and does not
                    # match source
                    if target.endswith('__init__.py'):
                        # default merge __init__.py files
                        # if non-empty, these should only
                        # contain imports from submoduiles
                        action = 'm'
                    elif target.endswith('base.py'):
                        # default skip base.py files
                        # these should be extended by the developer
                        action = 's'
                    else:
                        default = 'm'
                        action = click.prompt(
                            style.prompt(
                                '%s already exists, '
                                '[r]eplace, [s]kip, or [m]erge?' % (
                                    relative_target
                                ),
                            ),
                            default=style.default(default)
                        ) if self.interactive else default
                        action = click.unstyle(action).lower()
                        if action not in {'r', 'm', 's'}:
                            action = default

                if action == 's':
                    self.stdout.write(
                        '? %s' % style.white(relative_target),
                        fg='yellow'
                    )
                    continue
                if action == 'r':
                    with open(source, 'r') as source_file:
                        with open(target, 'w') as target_file:
                            target_file.write(source_file.read())
                    self.stdout.write(
                        style.green(
                            '+ %s' % style.white(relative_target)
                        )
                    )
                if action == 'm':
                    with open(target, 'r') as target_file:
                        with open(source, 'r') as source_file:
                            merged = merge(
                                target_file.read(),
                                source_file.read()
                            )
                    with open(target, 'w') as target_file:
                        target_file.write(merged)

                    self.stdout.write(
                        style.yellow('> %s' % style.white(relative_target))
                    )
691402
def normalize(self):
        
        # Add environment variables
        os.environ.update(self._environment)

        # Normalize paths and avoid duplicates
        self._paths = remove_duplicates(
            os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
            for path in self._paths
            if os.path.exists(path)
        )

        # Normalize the lists of bundles
        self._bundles = remove_duplicates(self._bundles)
366372
def update_environment_variables(self, filename):
        """"""
        self.env.update(os.environ.copy())
        self.env.update({'PIPELINE_BASH_FILE': filename})
751121
def _env_filenames(filenames, env):
    
    env_filenames = []
    for filename in filenames:
        filename_parts = filename.split('.')
        filename_parts.insert(1, env)
        env_filenames.extend([filename, '.'.join(filename_parts)])

    return env_filenames
939607
def add_env(self, key, value):
        
        boto.log.info('Adding env variable: %s=%s' % (key, value))
        if not os.path.exists("/etc/environment.orig"):
            self.run('cp /etc/environment /etc/environment.orig', notify=False, exit_on_error=False)
        fp = open('/etc/environment', 'a')
        fp.write('\n%s="%s"' % (key, value))
        fp.close()
        os.environ[key] = value
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
214488
def changes
      changes = {'new' => {}, 'obsolete' => {}, 'updated' => {}}

      if @environment.nil?
        new_environments.each do |env|
          changes['new'][env] = {}
        end

        old_environments.each do |env|
          changes['obsolete'][env] = {}
        end
      else
        env = @environment
        changes['new'][env] = {} if new_environments.include?(@environment)
        changes['obsolete'][env] = {} if old_environments.include?(@environment)
      end
      changes
    end
1354773
function replaceEnv(node, state, value) {
        utils.catchup(node.range[0], state);
        utils.append(JSON.stringify(value), state);
        utils.move(node.range[1], state);
    }
527445
def write_env_vars(env_vars=None):  # type: (dict) -> None
    
    env_vars = env_vars or {}
    env_vars['PYTHONPATH'] = ':'.join(sys.path)

    for name, value in env_vars.items():
        os.environ[name] = value