Choose the next command to execute, and its parameters, based on the current
            state.
514376
def decide(self):
        

        next_command_name = random.choice(self.COMMAND_MAP[self.state['last_command']])
        param = ''
        if next_command_name == 'cd':
            try:
                param = random.choice(self.state['dir_list'])
            except IndexError:
                next_command_name = 'ls'

        elif next_command_name == 'uname':
            opts = 'asnrvmpio'
            start = random.randint(0, len(opts) - 2)
            end = random.randint(start + 1, len(opts) - 1)
            param = '-{}'.format(opts[start:end])
        elif next_command_name == 'ls':
            if random.randint(0, 1):
                param = '-l'
        elif next_command_name == 'cat':
            try:
                param = random.choice(self.state['file_list'])
            except IndexError:
                param = ''.join(random.choice(string.lowercase) for x in range(3))
        elif next_command_name == 'echo':
            param = random.choice([
                '$http_proxy',
                '$https_proxy',
                '$ftp_proxy',
                '$BROWSER',
                '$EDITOR',
                '$SHELL',
                '$PAGER'
            ])
        elif next_command_name == 'sudo':
            param = random.choice([
                'pm-hibernate',
                'shutdown -h',
                'vim /etc/httpd.conf',
                'vim /etc/resolve.conf',
                'service network restart',
                '/etc/init.d/network-manager restart',
            ])
        return next_command_name, param
1262461
def handle(self, *args, **options):

        
        if not options['force']:
            counter = 0
            for key in options:
                if options[key]:
                    counter += 1

            # If no options are set, do a normal patch
            if counter == 1:
                options['patch'] = True

            # more then one options are not enabled per default
            if counter >= 3:
                # TODO: Raise Error!
                exit('It is not recommended to use more then one parameter. Use -f to force your command.')
        ###########################################################################################

        if options['major']:
            Version.set_major()

        if options['minor']:
            Version.set_minor()

        if options['patch']:
            Version.set_patch()

        if options['dev']:
            Version.set_patch(Version.DEV)

        if options['alpha']:
            Version.set_patch(Version.ALPHA)

        if options['beta']:
            Version.set_patch(Version.BETA)

        if options['rc']:
            Version.set_patch(Version.RC)

        """
        Automatic commands.
        Depends on User Settings.
        """
        if APISettings.PATCH_AUTO_COMMIT:
            Git.add()
            Git.commit()

        if APISettings.PATCH_AUTO_TAG:
            Git.tag()
            if APISettings.PATCH_AUTO_TAG_PUSH:
                Git.push_tags()
1235258
def update_state
      current_state.dup.tap do |s|
        src = eval_parameter :src
        s[src] = next_state s[src]
      end
    end
1331428
def run_command(self, cmd, history=True, new_prompt=True):
        """"""
        if not cmd:
            cmd = ''
        else:
            if history:
                self.add_to_history(cmd)
        if not self.multithreaded:
            if 'input' not in cmd:
                self.interpreter.stdin_write.write(
                                                to_binary_string(cmd + '\n'))
                self.interpreter.run_line()
                self.refresh.emit()
            else:
                self.write(_('In order to use commands like "raw_input" '
                             'or "input" run Spyder with the multithread '
                             'option (--multithread) from a system terminal'),
                           error=True)
        else:
            self.interpreter.stdin_write.write(to_binary_string(cmd + '\n'))
1343374
def switch(self):
        
        self._status = (self._status + 1) % len(self.states)
        self.status(self._status)
804153
def cmd(self, args=None, interact=True):
        """"""
        if args is None:
            parsed_args = arguments.parse_args()
        else:
            parsed_args = arguments.parse_args(args)
        self.exit_code = 0
        with self.handling_exceptions():
            self.use_args(parsed_args, interact, original_args=args)
        self.exit_on_error()
1318519
def handle_one_command(self):
        """"""

        while True:
            yield from self.write_prompt()
            codeobj = yield from self.read_command()

            if codeobj is not None:
                yield from self.run_command(codeobj)
956049
def execute(self):
        
        self.autocomplete()
        if len(self.argv):
            cmd = self.argv[0]
            cmd_argv = self.get_argv_for_command()
            self.run_command(cmd, cmd_argv)
        else:
            self.show_help()
700030
def __execute_cmd(name, cmd):
    '''
    
    '''
    return __salt__['cmd.run_all'](
        '{0} {1}'.format(salt.utils.path.which(name), cmd)
    )
1079793
def sense(self):
        
        cmd_name = random.choice(self.senses)
        command = getattr(self, cmd_name)
        self.state['last_command'] = cmd_name
        command()
81634
def call_command(self, cmdname, **kw):
        """"""
        for dirname in INSTALL_DIRECTORY_ATTRS:
            kw.setdefault(dirname, self.bdist_dir)
        kw.setdefault('skip_build', self.skip_build)
        kw.setdefault('dry_run', self.dry_run)
        cmd = self.reinitialize_command(cmdname, **kw)
        self.run_command(cmdname)
        return cmd
215358
def run_command(command):
    
    try:
        check_ouput = getattr(
            subprocess, 'check_output', subprocess.check_call)
        result = check_ouput(command, stderr=subprocess.STDOUT, shell=True)
        if check_ouput.__name__ == 'check_output':
            return 0, result
        else:
            return result, None
    except subprocess.CalledProcessError as e:
        return e.returncode, getattr(e, 'output', None)
995595
def execute_command(command=None):
    """"""
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stdin = process.communicate()
    process.wait()
    return (stdout, stdin), process.returncode
20602
def exec_cmd(self, command, **kwargs):
        """"""
        self._is_allowed_command(command)
        self._check_command_parameters(**kwargs)
        return self._exec_cmd(command, **kwargs)
14300
def postcmd(self):
        """"""
        value = self.choice.get()
        try:
            index = self.paramInfo.choice.index(value)
            self.entry.menu.activate(index)
        except ValueError:
            # initial null value may not be in list
            pass
265385
def handle(self, data):
        
        if self.handler:
            state = self.handler(data)
            if state is None:
                return self.next_state
            return state
        return self.next_state
1041251
async def set_state(self, parameter):
        """"""
        command_send = CommandSend(pyvlx=self.pyvlx, node_id=self.node_id, parameter=parameter)
        await command_send.do_api_call()
        if not command_send.success:
            raise PyVLXException("Unable to send command")
        self.parameter = parameter
        await self.after_update()