Creates an EnvvarProfile instance without the need for an explicit declaration of the envvar profile class.
6345
def envvar_profile(
    profile_root: str,
    profile_properties: typing.Dict[str, typing.Optional[str]] = None,
    **profile_properties_as_kwargs,
) -> EnvvarProfile:
    
    if profile_properties:
        profile_properties_as_kwargs.update(profile_properties)
    return type(f"{profile_root}Profile", (EnvvarProfile,), {
        "profile_root": profile_root.lower(),
        "profile_properties": list(profile_properties_as_kwargs.keys()),
        **{
            k: EnvvarProfileProperty(name=k, default=v, type_=str)
            for k, v in profile_properties_as_kwargs.items()
        },
    })()
1129109
@Override public void makeSensitiveBuildVariables(AbstractBuild build, Set<String> sensitiveVariables) {
        super.makeSensitiveBuildVariables(build, sensitiveVariables);
        // TODO determine if there is a meaningful way to generalize this; perhaps as a new [Run]Action recording sensitiveVariables?
        // Complicated by the fact that in principle someone could call getSensitiveBuildVariables *before* the wrapper starts and actually sets those variables,
        // though in practice the likely use cases would come later, and perhaps it is acceptable to omit the names of variables which are yet to be set.
        // Also unclear if there is any use case for calling this method after the build is done (or Jenkins is restarted);
        // most likely it is only used during the build itself.
        // Would be much cleaner if EnvVars itself recorded which keys had sensitive values.
    }
904360
def create(cls, env=None, args=None):
    
    env = {k: v for k, v in (os.environ if env is None else env).items()
           if k.startswith('PANTS_')}
    args = tuple(sys.argv if args is None else args)

    flags = set()
    short_flags = set()

    def filecontent_for(path):
      return FileContent(ensure_text(path), read_file(path, binary_mode=True))

    def capture_the_flags(*args, **kwargs):
      for arg in args:
        flags.add(arg)
        if len(arg) == 2:
          short_flags.add(arg)
        elif kwargs.get('type') == bool:
          flags.add('--no-{}'.format(arg[2:]))

    GlobalOptionsRegistrar.register_bootstrap_options(capture_the_flags)

    def is_bootstrap_option(arg):
      components = arg.split('=', 1)
      if components[0] in flags:
        return True
      for flag in short_flags:
        if arg.startswith(flag):
          return True
      return False

    # Take just the bootstrap args, so we don't choke on other global-scope args on the cmd line.
    # Stop before '--' since args after that are pass-through and may have duplicate names to our
    # bootstrap options.
    bargs = tuple(filter(is_bootstrap_option, itertools.takewhile(lambda arg: arg != '--', args)))

    config_file_paths = cls.get_config_file_paths(env=env, args=args)
    config_files_products = [filecontent_for(p) for p in config_file_paths]
    pre_bootstrap_config = Config.load_file_contents(config_files_products)

    initial_bootstrap_options = cls.parse_bootstrap_options(env, bargs, pre_bootstrap_config)
    bootstrap_option_values = initial_bootstrap_options.for_global_scope()

    # Now re-read the config, post-bootstrapping. Note the order: First whatever we bootstrapped
    # from (typically pants.ini), then config override, then rcfiles.
    full_configpaths = pre_bootstrap_config.sources()
    if bootstrap_option_values.pantsrc:
      rcfiles = [os.path.expanduser(str(rcfile)) for rcfile in bootstrap_option_values.pantsrc_files]
      existing_rcfiles = list(filter(os.path.exists, rcfiles))
      full_configpaths.extend(existing_rcfiles)

    full_config_files_products = [filecontent_for(p) for p in full_configpaths]
    post_bootstrap_config = Config.load_file_contents(
      full_config_files_products,
      seed_values=bootstrap_option_values
    )

    env_tuples = tuple(sorted(iteritems(env), key=lambda x: x[0]))
    return cls(env_tuples=env_tuples, bootstrap_args=bargs, args=args, config=post_bootstrap_config)
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
1039299
public void addEnv(final Environment.Variable env){
        if(null==envVars) {
            envVars = new ArrayList<Environment.Variable>();
        }
        envVars.add(env);
    }
429224
protected function _setProfile() {
        $projectName = basename(dirname(realpath(APPLICATION_PATH)));
        $profileName = $projectName . '_' . APPLICATION_ENV;

        $this->_profile = $profileName;
    }
229712
private void generateDefaultProfile(final DaoManager storage, final String profileSourcePath) throws SQLException, IOException{
        Profile profile = storage.getProfilesDao().getProfile(DEFAULT_PROFILE_SID);

        if (profile == null) {
            if(logger.isDebugEnabled()) {
                logger.debug("default profile does not exist, will create one from default Plan");
            }
            JsonNode jsonNode = JsonLoader.fromPath(profileSourcePath);
            profile = new Profile(DEFAULT_PROFILE_SID, jsonNode.toString(), new Date(), new Date());
            storage.getProfilesDao().addProfile(profile);
        } else {
            if(logger.isDebugEnabled()){
                logger.debug("default profile already exists, will not override it.");
            }
        }
    }
186436
public static void addEnvVarsFromContextForExec(final ExecTask execTask,
                                                    final Map<String, Map<String, String>> dataContext) {
        final Map<String, String> environment = generateEnvVarsFromContext(dataContext);

        if (null != environment) {
            for (final Map.Entry<String, String> entry : environment.entrySet()) {
                final String key = entry.getKey();
                if (null != key && null != entry.getValue()) {
                    final Environment.Variable env = new Environment.Variable();
                    env.setKey(key);
                    env.setValue(entry.getValue());
                    execTask.addEnv(env);
                }
            }
        }
    }
392403
function initProfiler(name) {
        checkInit();
        var profiler = profilerInstances[name];
        if (profiler === void 0) {
            profilerInstances[name] = profiler = new Profiler(name, "ms");
            container.appendChild(profiler.widget.element);
        }
    }
491834
private Map<String, String> createScriptEnvironment() {
        Map<String, String> env = new HashMap<>();
        env.putAll(System.getenv());
        env.putAll(configuration.getScriptEnvironmentVariables());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_NAMESPACE), configuration.getNamespace());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_DOMAIN), configuration.getKubernetesDomain());
        env.put(propertyToEnvironmentVariableName(Configuration.KUBERNETES_MASTER),
            configuration.getMasterUrl().toString());
        env.put(propertyToEnvironmentVariableName(Configuration.DOCKER_REGISTY), configuration.getDockerRegistry());
        return env;
    }
836631
public static Profile createProfile(Connection<?> connection) {
        Profile profile = new Profile();
        UserProfile providerProfile = connection.fetchUserProfile();

        String email = providerProfile.getEmail();
        if (StringUtils.isEmpty(email)) {
            throw new IllegalStateException("No email included in provider profile");
        }

        String username = providerProfile.getUsername();
        if (StringUtils.isEmpty(username)) {
            username = email;
        }

        String firstName = providerProfile.getFirstName();
        String lastName = providerProfile.getLastName();
        String displayName;

        if (StringUtils.isNotEmpty(connection.getDisplayName())) {
            displayName = connection.getDisplayName();
        } else {
            displayName = firstName + " " + lastName;
        }

        profile.setUsername(username);
        profile.setEmail(email);
        profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
        profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
        profile.setAttribute(DISPLAY_NAME_ATTRIBUTE_NAME, displayName);

        if (StringUtils.isNotEmpty(connection.getImageUrl())) {
            profile.setAttribute(AVATAR_LINK_ATTRIBUTE_NAME, connection.getImageUrl());
        }

        return profile;
    }
1213654
def read_profile_from_environment_variables():
    
    role_arn = os.environ.get('AWS_ROLE_ARN', None)
    external_id = os.environ.get('AWS_EXTERNAL_ID', None)
    return role_arn, external_id
688787
function createProfile(done) {
            if (self.closed) return done(null);

            temp.mkdir('browser-controller', function(err, dirpath) {
                if (err) return done(err);

                self.userDir = dirpath;

                done(null);
            });
        }
482498
def env_maker(environment_id, seed, serial_id, monitor=False, allow_early_resets=False, normalize_observations=False,
              normalize_returns=False, normalize_gamma=0.99):
    
    env = gym.make(environment_id)
    env.seed(seed + serial_id)

    # Monitoring the env
    if monitor:
        logdir = logger.get_dir() and os.path.join(logger.get_dir(), str(serial_id))
    else:
        logdir = None

    env = Monitor(env, logdir, allow_early_resets=allow_early_resets)

    if normalize_observations or normalize_returns:
        env = EnvNormalize(
            env,
            normalize_observations=normalize_observations,
            normalize_returns=normalize_returns,
            gamma=normalize_gamma
        )

    return env
144179
public static EnvironmentRule newInstance(String profile) {
        EnvironmentRule environmentRule = new EnvironmentRule();
        environmentRule.setProfile(profile);
        return environmentRule;
    }
1042926
protected LogContext getOrCreate(final String loggingProfile) {
        LogContext result = profileContexts.get(loggingProfile);
        if (result == null) {
            result = LogContext.create();
            final LogContext current = profileContexts.putIfAbsent(loggingProfile, result);
            if (current != null) {
                result = current;
            }
        }
        return result;
    }
1202225
def from_env(cls):
        """"""
        token = getenv(cls.TOKEN_ENV_VAR)
        if token is None:
            msg = 'missing environment variable: {!r}'.format(cls.TOKEN_ENV_VAR)
            raise ValueError(msg)
        return cls(api_token=token)