Executes basic flags and command plugins.

            `env`
                Runtime ``Environment`` instance.

            * Raises ``FocusError`` exception when certain conditions apply.
488771
def execute(self, env):
        

        # parse args
        parser = self._get_parser(env)
        parsed_args, cmd_args = parser.parse_known_args(env.args)

        # disable colors
        if parsed_args.no_color:
            env.io.set_colored(False)

        # run command handler passing any remaining args
        if not parsed_args.func(env, cmd_args):
            raise HelpBanner(parser.format_help())
530092
def execute(self, env, args):
        

        task_name = args.task_name
        clone_task = args.clone_task

        if not env.task.create(task_name, clone_task):
            raise errors.FocusError(u'Could not create task "{0}"'
                                    .format(task_name))

        # open in task config in editor
        if not args.skip_edit:
            task_config = env.task.get_config_path(task_name)

            if not _edit_task_config(env, task_config, confirm=True):
                raise errors.FocusError(u'Could not open task config: {0}'
                                        .format(task_config))
383862
def main():
    """"""
    # get arguments from the command line
    args = _get_args()
    # create the environment
    env = NESEnv(args.rom)
    # play the environment with the given mode
    if args.mode == 'human':
        play_human(env)
    else:
        play_random(env, args.steps)
190629
def do(cmdline, runas=None, env=None):
    '''
    
    '''
    if not cmdline:
        # This is a positional argument so this should never happen, but this
        # will handle cases where someone explicitly passes a false value for
        # cmdline.
        raise SaltInvocationError('Command must be specified')

    path = _rbenv_path(runas)
    if not env:
        env = {}

    # NOTE: Env vars (and their values) need to be str type on both Python 2
    # and 3. The code below first normalizes all path components to unicode to
    # stitch them together, and then converts the result back to a str type.
    env[str('PATH')] = salt.utils.stringutils.to_str(   # future lint: disable=blacklisted-function
        os.pathsep.join((
            salt.utils.path.join(path, 'shims'),
            salt.utils.stringutils.to_unicode(os.environ['PATH'])
        ))
    )

    try:
        cmdline = salt.utils.args.shlex_split(cmdline)
    except AttributeError:
        cmdauth = salt.utils.args.shlex_split(six.text_type(cmdline))

    result = __salt__['cmd.run_all'](
        cmdline,
        runas=runas,
        env=env,
        python_shell=False
    )

    if result['retcode'] == 0:
        rehash(runas=runas)
        return result['stdout']
    else:
        return False
788992
def env(key, default=None, required=False):
    
    try:
        value = os.environ[key]
        return ast.literal_eval(value)
    except (SyntaxError, ValueError):
        return value
    except KeyError:
        if default or not required:
            return default
        raise ImproperlyConfigured(
            "Missing required environment variable '%s'" % key)
168895
def execute(self, env, args):
        

        # extract args
        task_name = args.task_name
        force = args.force

        if env.task.active and env.task.name == task_name:
            raise errors.ActiveTask

        if not env.task.exists(task_name):
            raise errors.TaskNotFound(task_name)

        if force:
            env.task.remove(task_name)

        else:
            try:
                while True:
                    prompt = ('Are you sure you want to delete "{0}" (y/n)? '
                              .format(task_name))
                    resp = env.io.prompt(prompt, newline=False).lower()

                    if resp in ('y', 'n'):
                        if resp == 'y':
                            env.task.remove(task_name)
                        break

            except KeyboardInterrupt:
                pass
705765
async def Runtime(args, env):
    ''
    r = _Runtime(args, env)
    await r._init_cache()
    return r
146555
def execute_from_command_line(argv=None):
    
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "colab.settings")
    from django.conf import settings

    if not hasattr(settings, 'SECRET_KEY') and 'initconfig' in sys.argv:
        command = initconfig.Command()
        command.handle()
    else:
        utility = ManagementUtility(argv)
        utility.execute()
835432
def execute(self):
        
        # Preprocess options to extract --settings and --pythonpath.
        # These options could affect the commands that are available, so they
        # must be processed early.
        parser = NewOptionParser(prog=self.prog_name,
                             usage=self.usage_info,
#                             version=self.get_version(),
                             formatter = NewFormatter(),
                             add_help_option = False,
                             option_list=self.option_list)

        options, args = parser.parse_args(self.argv)
        self.options = options
        if len(args) == 0:
            self.message("You should give at least one package name.", 'error')
            return

        subcommand = args[0]

        self.handle(args[1:], self.options, self.global_options, subcommand)
1093772
def execute(self, processProtocol, command, env={},
                path=None, uid=None, gid=None, usePTY=0, childFDs=None):
        
        raise NotImplementedError()
131044
def _module_env(self, execution):
        
        env = copy.copy(os.environ)
        try:
            for mod in execution.get('modules') or []:
                Module.load(mod)
            os.environ.update(execution.get('environment') or {})
            yield
        finally:
            os.environ = env
574635
def run(self, args=(), env={}):
        

        # the following will call self._get_exec_binary
        return self._exec(self.binary, args=args, env=env)
480976
def run(self):
        
        os.environ['JARN_RUN'] = '1'
        self.python.check_valid_python()

        args = self.parse_options(self.args)
        if args:
            arg = args[0]
        else:
            arg = os.curdir
        if arg:
            arg = expanduser(arg)

        if isfile(arg):
            outfile = self.render_file(arg)
        elif isdir(arg):
            outfile = self.render_long_description(arg)
        else:
            err_exit('No such file or directory: %s' % arg)

        self.open_in_browser(outfile)
1119163
def execute(self, env, args):
        

        tasks = env.task.get_list_info()
        if not tasks:
            env.io.write("No tasks found.")

        else:
            if args.verbose:
                _print_tasks(env, tasks, mark_active=True)

            else:
                if env.task.active:
                    active_task = env.task.name
                else:
                    active_task = None

                for task, options, blocks in tasks:
                    if task == active_task:
                        env.io.success(task + ' *')
                    else:
                        if options is None and blocks is None:
                            env.io.error(task + ' ~')
                        else:
                            env.io.write(task)
848320
def execute(self):
        """"""
        if self._cli_arguments['cfn']:
            generate_sample_cfn_module(self.env_root)
        elif self._cli_arguments['sls']:
            generate_sample_sls_module(self.env_root)
        elif self._cli_arguments['sls-tsc']:
            generate_sample_sls_tsc_module(self.env_root)
        elif self._cli_arguments['stacker']:
            generate_sample_stacker_module(self.env_root)
        elif self._cli_arguments['tf']:
            generate_sample_tf_module(self.env_root)
        elif self._cli_arguments['cdk-tsc']:
            generate_sample_cdk_tsc_module(self.env_root)
        elif self._cli_arguments['cdk-py']:
            generate_sample_cdk_py_module(self.env_root)
        elif self._cli_arguments['cdk-csharp']:
            generate_sample_cdk_cs_module(self.env_root)
626498
def _run(name,
         cmd,
         exec_driver=None,
         output=None,
         stdin=None,
         python_shell=True,
         output_loglevel='debug',
         ignore_retcode=False,
         use_vt=False,
         keep_env=None):
    '''
    
    '''
    if exec_driver is None:
        exec_driver = _get_exec_driver()
    ret = __salt__['container_resource.run'](
        name,
        cmd,
        container_type=__virtualname__,
        exec_driver=exec_driver,
        output=output,
        stdin=stdin,
        python_shell=python_shell,
        output_loglevel=output_loglevel,
        ignore_retcode=ignore_retcode,
        use_vt=use_vt,
        keep_env=keep_env)

    if output in (None, 'all'):
        return ret
    else:
        return ret[output]
1359191
def apply_environ(self):
        
        if self.manager is None:
            raise RezSystemError("You must call 'set_manager' on a Python rex "
                                 "interpreter before using it.")

        self.target_environ.update(self.manager.environ)