Query Asterisk Manager Interface to initialize internal list of 
        supported channel types.
        
        CLI Command - core show applications
9094
def _initChannelTypesList(self):
        
        if self.checkVersion('1.4'):
            cmd = "core show channeltypes"
        else:
            cmd = "show channeltypes"
        cmdresp = self.executeCommand(cmd)
        self._chantypes = set()
        for line in cmdresp.splitlines()[2:]:
            mobj = re.match('\s*(\S+)\s+.*\s+(yes|no)\s+', line)
            if mobj:
                self._chantypes.add(mobj.group(1).lower())
752513
def get_command_line_parameters_parser():
    

    parser = optparse.OptionParser(formatter=optparse.IndentedHelpFormatter(indent_increment=2,
                                                                            max_help_position=8,
                                                                            width=128,
                                                                            short_first=1),
                                   add_help_option=None)

    parser.add_option("-h",
                      "--help",
                      action="help",
                      help="'Display this help message and exit.'")
    parser.add_option("-a",
                      "--about",
                      action="store_true",
                      default=False,
                      dest="about",
                      help="'Display Application about message.'")
    parser.add_option("-v",
                      "--verbose",
                      action="store",
                      type="int",
                      dest="verbosity_level",
                      help="'Application verbosity levels: 0 = Critical | 1 = Error | 2 = Warning | 3 = Info | 4 = Debug.'")
    parser.add_option("-f",
                      "--logging_formatter",
                      action="store",
                      type="string",
                      dest="logging_formatter",
                      help="'Application logging formatter: '{0}'.'".format(
                          ", ".join(sorted(RuntimeGlobals.logging_formatters))))
    parser.add_option("-u",
                      "--user_application_data_directory",
                      action="store",
                      type="string",
                      dest="user_application_data_directory",
                      help="'User Application data directory'.")
    parser.add_option("-s",
                      "--hide_splash_screen",
                      action="store_true",
                      default=False,
                      dest="hide_splash_screen",
                      help="'Hide splashscreen'.")
    parser.add_option("-w",
                      "--deactivate_worker_threads",
                      action="store_true",
                      default=False,
                      dest="deactivate_worker_threads",
                      help="'Deactivate worker threads'.")
    parser.add_option("-x",
                      "--startup_script",
                      action="store",
                      type="string",
                      dest="startup_script",
                      help="'Execute given startup script'.")
    parser.add_option("-t",
                      "--trace_modules",
                      action="store",
                      default="{}",
                      type="string",
                      dest="trace_modules",
                      help="'Trace given modules'.")
    return parser
1219037
public <T> List<T> querySingleRowTypedResults(String sql, String[] args) {
		return db.querySingleRowTypedResults(sql, args);
	}
236025
def init_cli(self):
        
        if self.init_cli_cmds is None:
            self.init_cli_cmds = self.set_default_init_cli_cmds()

        for cli_cmd in self.init_cli_cmds:
            if isinstance(cli_cmd, list) and len(cli_cmd) >= 2:
                asynchronous = cli_cmd[1]
                if len(cli_cmd) > 2:
                    wait = cli_cmd[2]
                else:
                    wait = True
                self.execute_command(cli_cmd[0], wait=wait, asynchronous=asynchronous)
            else:
                self.execute_command(cli_cmd)
680663
def init_manager(app, db, **kwargs):
    
    manager.app = app
    manager.db = db
    manager.context = kwargs
    manager.add_command('db', MigrateCommand)
    manager.add_command('clean', Clean())
    manager.add_command('showurls', ShowUrls())
    manager.add_command('shell', Shell(make_context=shell_context))
    manager.add_command('plainshell', Shell(make_context=shell_context,
        use_ipython=False, use_bpython=False))
    return manager
1053333
def getChannelStats(self, chantypes=('dahdi', 'zap', 'sip', 'iax2', 'local')):
        
        if self.checkVersion('1.4'):
            cmd = "core show channels"
        else:
            cmd = "show channels"
        cmdresp = self.executeCommand(cmd)
        info_dict ={}
        for chanstr in chantypes:
            chan = chanstr.lower()
            if chan in ('zap', 'dahdi'):
                info_dict['dahdi'] = 0
                info_dict['mix'] = 0
            else:
                info_dict[chan] = 0
        for k in ('active_calls', 'active_channels', 'calls_processed'):
            info_dict[k] = 0
        regexstr = ('(%s)\/(\w+)' % '|'.join(chantypes))    
        for line in cmdresp.splitlines():
            mobj = re.match(regexstr, 
                            line, re.IGNORECASE)
            if mobj:
                chan_type = mobj.group(1).lower()
                chan_id = mobj.group(2).lower()
                if chan_type == 'dahdi' or chan_type == 'zap':
                    if chan_id == 'pseudo':
                        info_dict['mix'] += 1
                    else:
                        info_dict['dahdi'] += 1
                else:
                    info_dict[chan_type] += 1
                continue

            mobj = re.match('(\d+)\s+(active channel|active call|calls processed)', 
                            line, re.IGNORECASE)
            if mobj:
                if mobj.group(2) == 'active channel':
                    info_dict['active_channels'] = int(mobj.group(1))
                elif mobj.group(2) == 'active call':
                    info_dict['active_calls'] = int(mobj.group(1))
                elif mobj.group(2) == 'calls processed':
                    info_dict['calls_processed'] = int(mobj.group(1))
                continue

        return info_dict
115597
def command_line_interfaces(self):
        
        interfaces = []
        for _, module in self.modules.items():
            for entry in dir(module):
                if entry.endswith('CommandLine'):
                    interfaces.append((module, entry))
        return interfaces
907782
def _get_initialized_channels_for_service(self, org_id, service_id):
        ''''''
        channels_dict = self._get_initialized_channels_dict_for_service(org_id, service_id)
        return list(channels_dict.values())
817578
def per_callback_query_chat_id(types='all'):
    
    def f(msg):
        if (flavor(msg) == 'callback_query' and 'message' in msg
            and (types == 'all' or msg['message']['chat']['type'] in types)):
            return msg['message']['chat']['id']
        else:
            return None
    return f
840444
def get_commands_aliases_and_macros_for_completion(self) -> List[str]:
        """"""
        visible_commands = set(self.get_visible_commands())
        alias_names = set(self.get_alias_names())
        macro_names = set(self.get_macro_names())
        return list(visible_commands | alias_names | macro_names)
787587
def list
      Cli::Environments::EvaluateOnly.new(options).evaluate
      DslDescriber.new.list
    end
746455
def enter_cli_mode(self):
        """"""
        delay_factor = self.select_delay_factor(delay_factor=0)
        count = 0
        cur_prompt = ""
        while count < 50:
            self.write_channel(self.RETURN)
            time.sleep(0.1 * delay_factor)
            cur_prompt = self.read_channel()
            if re.search(r"root@", cur_prompt) or re.search(r"^%$", cur_prompt.strip()):
                self.write_channel("cli" + self.RETURN)
                time.sleep(0.3 * delay_factor)
                self.clear_buffer()
                break
            elif ">" in cur_prompt or "#" in cur_prompt:
                break
            count += 1
389443
def _dispatch(self, cmd, args):
        
        if cmd in self.clis:
            extern_cmd, args = args[0], args[1:]
            self.clis[cmd]._dispatch(extern_cmd, args)
        else:
            if cmd in self.cmds:
                callback, parser = self.cmds[cmd]
                try:
                    p_args = parser.parse_args(args)
                except SystemExit:
                    return
                callback(**dict(filter(lambda p:p[1] != None, p_args._get_kwargs())))
            else:
                self._invalid_cmd(command=cmd)
1355184
private Map<String, Class<? extends Command<? extends CLIContext>>> loadCommands() throws CLIInitException{
		Map<String, Class<? extends Command<? extends CLIContext>>> commands =
			new HashMap<String, Class<? extends Command<? extends CLIContext>>>();
		
		Discoverer discoverer = new ClasspathDiscoverer();
		CLIAnnotationDiscovereryListener discoveryListener = new CLIAnnotationDiscovereryListener(new String[] {CLICommand.class.getName()});
		discoverer.addAnnotationListener(discoveryListener);
		discoverer.discover(true, true, true, true, true);
		
		loadCommands(commands, discoveryListener.getDiscoveredClasses());
		
		if (commands.isEmpty()) {
			throw new CLIInitException("No commands could be loaded.");
		}
		
		return commands;
	}
686130
def cli(ctx, env):
    """"""
    env.out("Welcome to the SoftLayer shell.")
    env.out("")

    formatter = formatting.HelpFormatter()
    commands = []
    shell_commands = []
    for name in cli_core.cli.list_commands(ctx):
        command = cli_core.cli.get_command(ctx, name)
        if command.short_help is None:
            command.short_help = command.help
        details = (name, command.short_help)
        if name in dict(routes.ALL_ROUTES):
            shell_commands.append(details)
        else:
            commands.append(details)

    with formatter.section('Shell Commands'):
        formatter.write_dl(shell_commands)

    with formatter.section('Commands'):
        formatter.write_dl(commands)

    for line in formatter.buffer:
        env.out(line, newline=False)
715572
def list_interfaces(style=None):
    '''
    
    '''
    ret = {}
    tmp = None
    iface = None
    out = __salt__['cmd.run']('iwconfig')
    for line in out.splitlines():
        if not line:
            continue
        if 'no wireless extensions' in line:
            continue
        comps = line.strip().split('  ')
        if not line.startswith(' '):
            if tmp is not None:
                ret[iface] = tmp.copy()
            iface = comps.pop(0)
            tmp = {'extra': []}
        for item in comps:
            if ':' in item:
                parts = item.split(':')
                key = parts[0].strip()
                value = parts[1].strip()
                if key == 'ESSID':
                    value = value.lstrip('"').rstrip('"')
                tmp[key] = value
            elif '=' in item:
                parts = item.split('=')
                tmp[parts[0].strip()] = parts[1].strip()
            else:
                tmp['extra'].append(item)

    ret[iface] = tmp.copy()

    if style == 'list':
        return ret.keys()

    return ret
194406
def channel_names(fn, usecols=None):
    """"""

    with open(fn, 'rb') as fo:
        names = dbfreader(fo).next()

    return usecols and [names[i] for i in usecols] or names