Helper for *_no_command rules.
541474
def replace_command(command, broken, matched):
    """"""
    new_cmds = get_close_matches(broken, matched, cutoff=0.1)
    return [replace_argument(command.script, broken, new_cmd.strip())
            for new_cmd in new_cmds]
592861
def select_command(corrected_commands):
    
    try:
        selector = CommandSelector(corrected_commands)
    except NoRuleMatched:
        logs.failed('No fucks given' if get_alias() == 'fuck'
                    else 'Nothing found')
        return

    if not settings.require_confirmation:
        logs.show_corrected_command(selector.value)
        return selector.value

    logs.confirm_text(selector.value)

    for action in read_actions():
        if action == const.ACTION_SELECT:
            sys.stderr.write('\n')
            return selector.value
        elif action == const.ACTION_ABORT:
            logs.failed('\nAborted')
            return
        elif action == const.ACTION_PREVIOUS:
            selector.previous()
            logs.confirm_text(selector.value)
        elif action == const.ACTION_NEXT:
            selector.next()
            logs.confirm_text(selector.value)
654026
def _control_nonterminal(nonterm):
        # type: (Type[Nonterminal]) -> None
        
        if not inspect.isclass(nonterm) or not issubclass(nonterm, Nonterminal):
            raise NotNonterminalException(nonterm)
1078514
def handle_cmd_options():
    '''
    
    '''
    parser = OptionParser()
    parser.add_option("-s", "--silent", action="store_true", dest="silent",
                      help="print any warnings", default=False)
    (options, args) = parser.parse_args()
    return options, args
619838
def check_command(self, name, exclude_packages=None, exclude_command_class=None):
    
    return get_command_class(
        name, 
        exclude_packages=exclude_packages,
        exclude_command_class=exclude_command_class) is not None
124953
def disable_all(self, disable):
        """"""
        commands = ['ENBH 0', #disable high freq. rear output
                    'ENBL 0', #disable low freq. front bnc
                    'MODL 0'   #disable modulation
                    ]
        command_string = '\n'.join(commands)
        print_string = '\n\t' + command_string.replace('\n', '\n\t')
        logging.info(print_string)
        if disable:
            self.instr.write(command_string)
530517
def get_none_policy_text(none_policy,   # type: int
                         verbose=False  # type: bool
                         ):
    
    if none_policy is NonePolicy.SKIP:
        return "accept None without performing validation" if verbose else 'SKIP'
    elif none_policy is NonePolicy.FAIL:
        return "fail on None without performing validation" if verbose else 'FAIL'
    elif none_policy is NonePolicy.VALIDATE:
        return "validate None as any other values" if verbose else 'VALIDATE'
    elif none_policy is NoneArgPolicy.SKIP_IF_NONABLE_ELSE_FAIL:
        return "accept None without validation if the argument is optional, otherwise fail on None" if verbose \
            else 'SKIP_IF_NONABLE_ELSE_FAIL'
    elif none_policy is NoneArgPolicy.SKIP_IF_NONABLE_ELSE_VALIDATE:
        return "accept None without validation if the argument is optional, otherwise validate None as any other " \
               "values" if verbose else 'SKIP_IF_NONABLE_ELSE_VALIDATE'
    else:
        raise ValueError('Invalid none_policy ' + str(none_policy))
117173
def command(state, args):
    """"""
    args = parser.parse_args(args[1:])
    row_id = query.files.add_priority_rule(state.db, args.regexp, args.priority)
    del state.file_picker
    print('Added rule {}'.format(row_id))
1090375
function defaultCommand() {
    if (keys.length <= 0) {
        throw new Error("Error: there is no command at all!");
    };

    for (var p in commands) {
        if (commands[p]["default"]) {
            return commands[p];
        };
    };

    if (keys["--help"]) {
        return commands["--help"];
    } else {
        return commands[keys[0]];
    };
}
442246
def cli(ctx, pattern):
    """"""
    matches = utils.grep_commands(pattern)
    if matches:
        for cmd, desc in matches:
            click.secho("$ {} :: {}".format(cmd, desc), fg='green')
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo('No commands to show. Add one by `keep new`.')
685454
def command_with_options(self):
        """"""
        if 'args' in self.config:
            return ' '.join((self.command, self.config['args']))
        return self.command
986081
def commands(cls):
        """"""
        cmds = [cmd[4:] for cmd in dir(cls) if cmd.startswith('cmd_')]
        return cmds
687953
def cmd(send, _, args):
    
    guarded = args['handler'].guarded
    if not guarded:
        send("Nobody is guarded.")
    else:
        send(", ".join(guarded))
1357110
def inall_cmd(argv):
    """"""
    envs = lsenvs()
    errors = False
    for env in envs:
        print("\n%s:" % env)
        try:
            inve(env, *argv)
        except CalledProcessError as e:
            errors = True
            err(e)
    sys.exit(errors)
764000
def command(self, rule, **options):
        
        options.setdefault("direct", False)
        options.setdefault("override", True)
        options.setdefault("inject", False)
        options.setdefault("flags", 0)
        if not options["direct"]:
            rule = self.regexy(rule)
        regex = re.compile(rule, flags=options["flags"])
        self.handlers.setdefault(regex, [])
        def handler(f):
            if f == noop:
                f.options = {}
            else:
                f.options = options
            if options["override"]:
                self.handlers[regex] = [f]
            else:
                self.handlers[regex].append(f)
            f.no_args = self.no_args(f)
            return f
        return handler
1328281
def _cmd(self, command, data=None, params=None, api_version=1):
    
    return self._post("commands/" + command, ApiCommand,
        data=data, params=params, api_version=api_version)
1118532
def detect_command(cmdlist):
    ''''''

    for platform, command, args in cmdlist:
        if platform is None or sys.platform == platform:
            path = shutil.which(command)
            if path:
                return ' '.join([path, args])

    return ''