Returns commands available to execute
        :return: list of (name, doc) tuples
495096
def get_commands(self):
        
        commands = []
        for name, value in inspect.getmembers(self):
            if not inspect.isgeneratorfunction(value):
                continue
            if name.startswith('_') or name == 'run':
                continue
            doc = inspect.getdoc(value)
            commands.append((name, doc))
        return commands
798799
def find_commands(management_dir):
    
    command_dir = os.path.join(management_dir, 'commands')
    try:
        return [f[:-3] for f in os.listdir(command_dir)
                if not f.startswith('_') and f.endswith('.py')]
    except OSError:
        return []
901934
def commands(self):
        
        # Retrieve all commands via split function or splitting on ';'
        print('\tRetrieving commands from', self.sql_script)
        print('\tUsing command splitter algorithm {0}'.format(self.split_algo))

        with Timer('\tRetrieved commands in'):
            # Split commands
            # sqlparse packages split function combined with sql_split function
            if self.split_algo is 'sql_parse':
                commands = SplitCommands(self.sql_script).sql_parse

            # Split on every ';' (unreliable)
            elif self.split_algo is 'simple_split':
                commands = SplitCommands(self.sql_script).simple_split()

            # sqlparse package without additional splitting
            elif self.split_algo is 'sql_parse_nosplit':
                commands = SplitCommands(self.sql_script).sql_parse_nosplit

            # Parse every char of the SQL commands and determine breakpoints
            elif self.split_algo is 'sql_split':
                commands = SplitCommands(self.sql_script).sql_split(disable_tqdm=False)
            else:
                commands = SplitCommands(self.sql_script).sql_split(disable_tqdm=False)

            # remove dbo. prefixes from table names
            cleaned_commands = [com.replace("dbo.", '') for com in commands]
        return cleaned_commands
508130
def _get_command(self):
        """"""
        targets = ' '.join(self.targets)
        cmd_str = self._linter.command_with_options + ' ' + targets
        cmd_shlex = shlex.split(cmd_str)
        return list(cmd_shlex)
731336
def get_input_list(self):
        
        inputs = [' '] * len(self.command['input'])
        for key in self.command['input']:
            inputs[self.command['input'][key]['order']] = {"key":key, "name":self.command['input'][key]['name']}
        return inputs
32931
def get_command(self, ctx, cmd_name):
        
        rv = click.Group.get_command(self, ctx, cmd_name)
        if rv is not None:
            return rv
        matches = [x for x in self.list_commands(ctx)
                   if x.startswith(cmd_name)]
        if not matches:
            return None
        elif len(matches) == 1:
            return click.Group.get_command(self, ctx, matches[0])
        ctx.fail('Command ambiguous, could be: %s' %
                 ', '.join(sorted(matches)))
587038
def walk_commands(self):
        """"""
        for command in tuple(self.all_commands.values()):
            yield command
            if isinstance(command, GroupMixin):
                yield from command.walk_commands()
873848
def _manage_commands():
    
    for name, (command, *aliases) in COMMANDS.items():
        COMMAND_MAPPER[name] = command
        for alias in aliases:
            COMMAND_MAPPER[alias] = command
        COMMAND_ALIASES[name] = aliases
1249382
def __complete_cmds(self, text):
        """"""
        return [ name for name in self._cmd_map_visible.keys() if name.startswith(text) ]
321211
def commands(self, event):
        
        commands = sorted(self.commands_dict().keys())
        return "Available commands: %s" % " ".join(commands)
1310476
def get_valid_commands():
    
    modules = [m.basename().split('.')[0] for m in Path(__file__).dirname().files('*.py')]
    commands = []
    for modname in modules:
        if modname == 'main':
            continue
        mod = importlib.import_module('i18n.%s' % modname)
        if hasattr(mod, 'main'):
            commands.append(modname)
    return commands
513832
def all(self, command, params=None):
        
        dr = self.query(command, params)
        return dr['rows']
362240
def _get_select_commands(self, source, tables):
        
        # Create dictionary of select queries
        row_queries = {tbl: self.select_all(tbl, execute=False) for tbl in
                       tqdm(tables, total=len(tables), desc='Getting {0} select queries'.format(source))}

        # Convert command strings into lists of commands
        for tbl, command in row_queries.items():
            if isinstance(command, str):
                row_queries[tbl] = [command]

        # Pack commands into list of tuples
        return [(tbl, cmd) for tbl, cmds in row_queries.items() for cmd in cmds]
1151007
def _commands(ctx):
    """"""
    ctx = ctx.parent
    ctx.show_hidden_subcommands = False
    main = ctx.command

    for subcommand in main.list_commands(ctx):
        cmd = main.get_command(ctx, subcommand)
        if cmd is None:
            continue
        help = cmd.short_help or ""
        click.echo("{}:{}".format(subcommand, help))
1331895
def get_commands(mod):
    
    import inspect
    import types

    commands = {}

    def check(c):
        return (inspect.isclass(c) and
            issubclass(c, Command) and c is not Command and not issubclass(c, CommandManager))

    for name in dir(mod):
        c = getattr(mod, name)
        if check(c):
            commands[c.name] = c

    return commands
1308358
def get_cmd_tuple_list(self):
    

    # pattern to find DAGman macros
    pat = re.compile(r'\$\((.+)\)')
    argpat = re.compile(r'\d+')

    # first parse the options and replace macros with values
    options = self.job().get_opts()
    macros = self.get_opts()

    cmd_list = []

    for k in options:
      val = options[k]
      m = pat.match(val)
      if m:
        key = m.group(1)
        value = macros[key]

        cmd_list.append(("--%s" % k, str(value)))
      else:
        cmd_list.append(("--%s" % k, str(val)))

    # second parse the short options and replace macros with values
    options = self.job().get_short_opts()

    for k in options:
      val = options[k]
      m = pat.match(val)
      if m:
        key = m.group(1)
        value = macros[key]

        cmd_list.append(("-%s" % k, str(value)))
      else:
        cmd_list.append(("-%s" % k, str(val)))

    # lastly parse the arguments and replace macros with values
    args = self.job().get_args()
    macros = self.get_args()

    for a in args:
      m = pat.match(a)
      if m:
        arg_index = int(argpat.findall(a)[0])
        try:
          cmd_list.append(("%s" % macros[arg_index], ""))
        except IndexError:
          cmd_list.append("")
      else:
        cmd_list.append(("%s" % a, ""))

    return cmd_list
62545
def select(self, cmd, *args, **kwargs):
        
        self.cursor.execute(cmd, *args, **kwargs)
        return self.cursor.fetchall()