It is recommended to use setup_manager_context() to generate your setup_manager.
355807
def run_exercises(setup_manager: SetupManager, exercises: Iterable[Exercise], seed: int) -> Iterator[Result]:
    
    game_interface = setup_manager.game_interface
    names = [exercise.get_name() for exercise in exercises]
    with training_status_renderer_context(names, game_interface.renderer) as ren:
        for i, exercise in enumerate(exercises):
            def update_row(status: str, status_color_func):
                nonlocal i
                nonlocal exercise
                ren.update(i, Row(exercise.get_name(), status, status_color_func))

            update_row('config', ren.renderman.white)
            # Only reload the match if the config has changed.
            new_match_config = exercise.get_match_config()
            if new_match_config != setup_manager.match_config:
                update_row('match', ren.renderman.white)
                _setup_match(new_match_config, setup_manager)
                update_row('bots', ren.renderman.white)
                _wait_until_bots_ready(setup_manager, new_match_config)

            update_row('wait', ren.renderman.white)
            _wait_until_good_ticks(game_interface)

            update_row('setup', ren.renderman.white)
            error_result = _setup_exercise(game_interface, exercise, seed)
            if error_result is not None:
                update_row('setup', ren.renderman.red)
                yield error_result
                continue

            update_row('reload', ren.renderman.white)
            setup_manager.reload_all_agents(quiet=True)

            # Wait for the set_game_state() to propagate before we start running ex.on_tick()
            # TODO: wait until the game looks similar.
            update_row('sleep', ren.renderman.white)
            time.sleep(0.03)

            update_row('>>>>', ren.renderman.white)
            result = _grade_exercise(game_interface, exercise, seed)

            if isinstance(result.grade, Pass):
                update_row('PASS', ren.renderman.green)
            else:
                update_row('FAIL', ren.renderman.red)

            yield result
886956
def setup(cfg):
    

    # copy the necessary configuration values over
    this_module = sys.modules[__name__]
    for name, value in cfg.items():
        if hasattr(this_module, name):
            setattr(this_module, name, value)
619439
protected function prepareProcessContext()
    {
        $this->context = app($this->processContextClass, [ $this->data, $this->settings ]);

        $this->context->command = $this->command;
    }
617631
def _setup(self, name=None):
        
        envvar = self.__dict__['env_var']
        if envvar:
            settings_file = os.environ.get(envvar)
        else:
            settings_file = self.__dict__['file_path']

        if not settings_file:
            msg = ("Requested settings, but none can be obtained for the envvar."
                   "Since no config filepath can be obtained, a default config "
                   "will be used.")
            logger.error(msg)
            raise OSError(msg)

        self._wrapped = Settings(settings_file)
121888
private function setup()
    {
        $manager = $this->getConnection()->getSchemaManager();
        if ($this->tablesExist === true || $manager->tablesExist([$this->options['db_table']]) === true) {
            $this->tablesExist = true;

            return;
        }

        $schema = new Schema();
        $table = $schema->createTable($this->options['db_table']);

        $table->addColumn($this->options['db_column_feature'], 'string', ['length' => 255]);
        $table->addColumn($this->options['db_column_state'], 'boolean');

        $table->setPrimaryKey([$this->options['db_column_feature']]);

        $platform = $this->getConnection()->getDatabasePlatform();
        $queries = $schema->toSql($platform);

        foreach ($queries as $query) {
            $this->getConnection()->executeQuery($query);
        }

        $this->tablesExist = true;
    }
29789
final protected function doCommandImportSetUp()
    {
        $this->writeln('Executing <info>setup</info> tasks', true);

        // $this->updateSchema();
        $this->importManager->setUp();

        $this->writeln('Startup tasks complete.', true, true);
    }
269486
def _configure_manager(self):
        
        self._manager = ContainerManager(self, resource_class=Container,
                response_key="", uri_base="")
1131731
def manage(settingspath, root_dir, argv):
    
    # add settings.json to environment variables
    os.environ[ENV_VAR_SETTINGS] = settingspath
    # add root_dir
    os.environ[ENV_VAR_ROOT_DIR] = root_dir
    # get datasets list
    with open(settingspath) as settings_file:
        settings = json.load(settings_file)
    # manage args
    datasets_list = generate_datasets_list(settings, argv)
    if "make-data-file" == argv[1]:
        make_data_file(datasets_list, argv)
    elif "parse-data" == argv[1]:
        parse_data(datasets_list, argv)
    elif "do-operations" == argv[1]:
        do_operations(datasets_list, argv)
    else:
        print_help()
594398
def _preloading_env(self):
        
        ctx = self.env.globals
        try:
            ctx['random_model'] = lambda *a, **kw: None
            ctx['random_models'] = lambda *a, **kw: None
            yield self.env
        finally:
            ctx['random_model'] = jinja2.contextfunction(random_model)
            ctx['random_models'] = jinja2.contextfunction(random_models)
992054
@Override
    public void setupModule(SetupContext context) {
        FindSerializers serializers = new FindSerializers(jsonContext);
        locator.inject(serializers);
        locator.postConstruct(serializers);
        context.addSerializers(serializers);

        FindDeserializers deserializers = new FindDeserializers(jsonContext);
        locator.inject(deserializers);
        locator.postConstruct(deserializers);
        context.addDeserializers(deserializers);
    }
698620
def produce(self, *args, **kwargs):
        

        new_plugins = []
        for p in self._plugins:
            r = p(*args, **kwargs)
            new_plugins.append(r)
        return PluginManager(new_plugins)
1038165
def _create_context_manager(self, mode):
        "  "
        class mode_context_manager(object):
            def __enter__(*a):
                self.send_packet({'cmd': 'mode', 'data': mode})

            def __exit__(*a):
                self.send_packet({'cmd': 'mode', 'data': 'restore'})

        return mode_context_manager()
39982
def setup(self, **kwargs):
        

        for key in kwargs:
            if key not in self.config.keys():
                raise error.GrabMisuseError('Unknown option: %s' % key)

        if 'url' in kwargs:
            if self.config.get('url'):
                kwargs['url'] = self.make_url_absolute(kwargs['url'])
        self.config.update(kwargs)
1123086
def generate(env):
    """"""
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
        SCons.Tool.Tool(t)(env)
1117109
def setup_handler(context):
    

    if context.readDataFile("bika.lims_various.txt") is None:
        return

    logger.info(" [BEGIN]")

    portal = context.getSite()

    # Run Installers
    remove_default_content(portal)
    hide_navbar_items(portal)
    reindex_content_structure(portal)
    setup_groups(portal)
    setup_catalog_mappings(portal)
    setup_core_catalogs(portal)

    # Setting up all LIMS catalogs defined in catalog folder
    setup_catalogs(portal, getCatalogDefinitions())

    # Run after all catalogs have been setup
    setup_auditlog_catalog(portal)

    logger.info(" [DONE]")
1104612
def hooks_factory(identifier, configuration, context):
    
    manager = HookManager(identifier, configuration)
    manager.load_hooks(context)

    return manager
526728
function install()
    {
        $this->createConfigurationDirectory();
        $this->createDriversDirectory();
        $this->createSitesDirectory();
        $this->createExtensionsDirectory();
        $this->createLogDirectory();
        $this->createCertificatesDirectory();
        $this->writeBaseConfiguration();

        $this->files->chown($this->path(), user());
    }