Setup the plugin's commands.
516499
def setup(self, app):
        """"""
        super(Plugin, self).setup(app)
        if isinstance(self.cfg['locales_dirs'], str):
            self.cfg['locales_dirs'] = [self.cfg['locales_dirs']]

        @app.manage.command(init=False)
        def extract_messages(   # noqa
                *dirnames, project=app.name, version=app.cfg.get('VERSION', ''), locations=True,
                charset='utf-8', domain=self.cfg.domain, locale=self.cfg.default_locale):
            """Extract messages from source code.

            :param charset: charset to use in the output
            :param domain:  set domain name for locales
            :param project: set project name in output
            :param version: set project version in output
            :param locations: add message locations
            """
            Locale.parse(locale)

            dirnames = [d for d in dirnames if os.path.isdir(d)]

            catalog = Catalog(locale=locale, project=project, version=version, charset=charset)
            for dname in dirnames:
                for filename, lineno, message, comments, context in extract_from_dir(
                        dname, method_map=self.cfg.sources_map, options_map=self.cfg.options_map):

                    lines = []
                    if locations:
                        filepath = os.path.normpath(os.path.join(dname, filename))
                        lines = [(filepath, lineno)]

                    catalog.add(message, None, lines, auto_comments=comments, context=context)

            locales_dir = self.cfg.locales_dirs[0]
            output = os.path.join(locales_dir, locale, 'LC_MESSAGES', '%s.po' % domain)

            if os.path.exists(output):
                with open(output, 'rb') as f:
                    template = read_po(f, locale=locale, charset=charset)
                    template.update(catalog)
                    catalog = template

            if not os.path.exists(os.path.dirname(output)):
                os.makedirs(os.path.dirname(output))

            logger.info('writing PO template file to %s', output)
            outfile = open(output, 'wb')

            try:
                write_po(outfile, catalog, include_previous=True,
                         sort_output=not locations, sort_by_file=locations)
            finally:
                outfile.close()

        @app.manage.command(init=False)
        def compile_messages(use_fuzzy=False, statistics=False, domain=self.cfg.domain): # noqa
            """Compile messages for locales.

            :param domain:  set domain name for locales
            """
            for locales_dir in self.cfg.locales_dirs:
                for locale in os.listdir(locales_dir):
                    po_file = os.path.join(locales_dir, locale, 'LC_MESSAGES', domain + '.po')

                    if not os.path.exists(po_file):
                        continue

                    with open(po_file, 'r') as po:
                        catalog = read_po(po, locale)

                    mo_file = os.path.join(locales_dir, locale, 'LC_MESSAGES', domain + '.mo')

                    with open(mo_file, 'wb') as mo:
                        logger.info('writing MO template file to %s', mo_file)
                        write_mo(mo, catalog, use_fuzzy=use_fuzzy)
319920
def setup_app(command, conf, vars):
    """"""
    load_environment(conf.global_conf, conf.local_conf)
    setup_schema(command, conf, vars)
    bootstrap.bootstrap(command, conf, vars)
1331642
public function setup_on_plugins_loaded() {

		// Register core text domain.
		\load_plugin_textdomain( 'hogan-core', false, HOGAN_CORE_DIR . '/languages' );

		// Register all modules when acf is ready.
		add_action( 'acf/include_fields', [ $this, 'include_modules' ] );

		// Register default field group.
		add_action( 'hogan/include_field_groups', [ $this, 'register_default_field_group' ] );

		// Register all field groups when acf is ready.
		add_action( 'acf/include_fields', [ $this, 'include_field_groups' ] );

		// Add admin stylesheets and scripts.
		add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );

		// Enqueue Scripts.
		add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_core_assets' ] );
		add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_current_post_modules_assets' ] );

	}
1191350
def setup(self):
        
        r = self.call_ext_prog(self.get_option("script"))
        if r['status'] == 0:
            tarfile = ""
            for line in r['output']:
                line = line.strip()
                tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
            if len(tarfile) == 1:
                self.add_copy_spec(tarfile[0])
800917
protected function configure()
	{
		// the short description shown while running "php bin/console list"
		if( $this->docs->getIs("description") )
		{
			$this->setDescription($this->docs["description"]);
		}

		// the full command description shown when running the command with
		// the "--help" option
		if( $this->docs->getIs("help") )
		{
			$this->setHelp($this->docs["help"]);
		}
	}
614888
public function activatePlugins(): void
    {
        foreach (array_keys($this->getPlugins()) as $plugin) {
            if (!$this->isPluginActive($plugin)) {
                $this->activatePlugin($plugin);
            }
        }
    }
1309935
private void setUp() {
		addExamples("AJAX", ExampleData.AJAX_EXAMPLES);
		addExamples("Form controls", ExampleData.FORM_CONTROLS);
		addExamples("Feedback and indicators", ExampleData.FEEDBACK_AND_INDICATORS);
		addExamples("Layout", ExampleData.LAYOUT_EXAMPLES);
		addExamples("Menus", ExampleData.MENU_EXAMPLES);
		addExamples("Links", ExampleData.LINK_EXAMPLES);
		addExamples("Popups / dialogs", ExampleData.POPUP_EXAMPLES);
		addExamples("Subordinate", ExampleData.SUBORDINATE_EXAMPLES);
		addExamples("Tabs", ExampleData.TABSET_EXAMPLES);
		addExamples("Tables", ExampleData.WTABLE_EXAMPLES);
		addExamples("Validation", ExampleData.VALIDATION_EXAMPLES);
		addExamples("Other examples (uncategorised)", ExampleData.MISC_EXAMPLES);
		addExamples("DataTable (deprecated)", ExampleData.WDATATABLE_EXAMPLES);
	}
1262955
public function setup(){
		if(($this->hasOption('autoinit') && $this->options()->autoinit) && ($this->hasOption('class') || $this->hasOption('default'))){
			$strClass = $this->hasOption('class') ? $this->options()->class : $this->options()->default;
			$this->setValue(new $strClass);
		}
	}
205343
public function setupCommand() {
		$serverPublicKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub', FILE_TEXT);
		if ($serverPublicKeyString === FALSE) {
			$this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub, exiting.');
			$this->quit(1);
		}

		$serverPublicKeyFingerprint = $this->rsaWalletService->registerPublicKeyFromString($serverPublicKeyString);
		$this->outputLine('Registered sso demo server public key');

		$clientPrivateKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key', FILE_TEXT);
		if ($clientPrivateKeyString === FALSE) {
			$this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key, exiting.');
			$this->quit(2);
		}

		$clientPublicKeyFingerprint = $this->rsaWalletService->registerKeyPairFromPrivateKeyString($clientPrivateKeyString);
		$this->outputLine('Registered demo client key pair');

		$globalSettings = $this->yamlSource->load(FLOW_PATH_CONFIGURATION . '/Settings');
		$globalSettings['Flowpack']['SingleSignOn']['Client']['client']['publicKeyFingerprint'] = $clientPublicKeyFingerprint;
		$globalSettings['Flowpack']['SingleSignOn']['Client']['server']['DemoServer']['publicKeyFingerprint'] = $serverPublicKeyFingerprint;
		$this->yamlSource->save(FLOW_PATH_CONFIGURATION . '/Settings', $globalSettings);
		$this->outputLine('Updated settings');
	}
834634
def _setup_install_commands_from_kwargs(kwargs, keys=tuple()):
        """"""
        cmd_list = []
        if kwargs.get('override_channels', False) and 'channel' not in kwargs:
            raise TypeError('conda search: override_channels requires channel')

        if 'env' in kwargs:
            cmd_list.extend(['--name', kwargs.pop('env')])
        if 'prefix' in kwargs:
            cmd_list.extend(['--prefix', kwargs.pop('prefix')])
        if 'channel' in kwargs:
            channel = kwargs.pop('channel')
            if isinstance(channel, str):
                cmd_list.extend(['--channel', channel])
            else:
                cmd_list.append('--channel')
                cmd_list.extend(channel)

        for key in keys:
            if key in kwargs and kwargs[key]:
                cmd_list.append('--' + key.replace('_', '-'))

        return cmd_list
1175384
def configure(self, options):
        
        self.client.api.configure_plugin(self.name, options)
        self.reload()
434225
def setup(self):
        
        [c.start() for c in self.controllers]
        [c.wait_to_start() for c in self.controllers]
472116
protected function initialiseCommands()
    {
        $modules = $this->kernel->getModules();

        foreach ($modules as $module) {
            if ( ! $module instanceof ConsoleModuleInterface) {
                continue;
            }

            $module->registerCommands($this);
        }
    }
196757
def init(plugindirs=[]):
    """"""

    # initialize the builtin plugins
    from .translators import yang,yin,dsdl
    yang.pyang_plugin_init()
    yin.pyang_plugin_init()
    dsdl.pyang_plugin_init()

    # initialize installed plugins
    for ep in pkg_resources.iter_entry_points(group='pyang.plugin'):
        plugin_init = ep.load()
        plugin_init()

    # search for plugins in std directories (plugins directory first)
    basedir = os.path.split(sys.modules['pyang'].__file__)[0]
    plugindirs.insert(0, basedir + "/transforms")
    plugindirs.insert(0, basedir + "/plugins")

    # add paths from env
    pluginpath = os.getenv('PYANG_PLUGINPATH')
    if pluginpath is not None:
        plugindirs.extend(pluginpath.split(os.pathsep))

    syspath = sys.path
    for plugindir in plugindirs:
        sys.path = [plugindir] + syspath
        try:
            fnames = os.listdir(plugindir)
        except OSError:
            continue
        modnames = []
        for fname in fnames:
            if (fname.startswith(".#") or
                fname.startswith("__init__.py") or
                fname.endswith("_flymake.py") or
                fname.endswith("_flymake.pyc")):
                pass
            elif fname.endswith(".py"):
                modname = fname[:-3]
                if modname not in modnames:
                    modnames.append(modname)
            elif fname.endswith(".pyc"):
                modname = fname[:-4]
                if modname not in modnames:
                    modnames.append(modname)
        for modname in modnames:
            pluginmod = __import__(modname)
            try:
                pluginmod.pyang_plugin_init()
            except AttributeError as s:
                print(pluginmod.__dict__)
                raise AttributeError(pluginmod.__file__ + ': ' + str(s))
        sys.path = syspath
1093370
def configure(self, args):
        
        for plug in self._plugins:
            plug_name = self.plugin_name(plug)
            plug.enabled = getattr(args, "plugin_%s" % plug_name, False)
            if plug.enabled and getattr(plug, "configure", None):
                if callable(getattr(plug, "configure", None)):
                    plug.configure(args)
        LOG.debug("Available plugins: %s", self._plugins)
        self.plugins = [plugin for plugin in self._plugins if getattr(plugin, "enabled", False)]
        LOG.debug("Enabled plugins: %s", self.plugins)
90290
def register_commands(self):
        
        for command in self._entry_points[self.COMMANDS_ENTRY_POINT].values():
            command.load()
1311581
def setup(self):
        ""
        try:
            self.TERM = self.request.term
        except:
            pass
        self.setterm(self.TERM)
        self.sock = self.request._sock
        for k in self.DOACK.keys():
            self.sendcommand(self.DOACK[k], k)
        for k in self.WILLACK.keys():
            self.sendcommand(self.WILLACK[k], k)