當前位置: 首頁>>代碼示例>>Python>>正文


Python commands.get_summaries方法代碼示例

本文整理匯總了Python中pip.commands.get_summaries方法的典型用法代碼示例。如果您正苦於以下問題:Python commands.get_summaries方法的具體用法?Python commands.get_summaries怎麽用?Python commands.get_summaries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip.commands的用法示例。


在下文中一共展示了commands.get_summaries方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_main_parser

# 需要導入模塊: from pip import commands [as 別名]
# 或者: from pip.commands import get_summaries [as 別名]
def create_main_parser():
    parser_kw = {
        'usage': '\n%prog <command> [options]',
        'add_help_option': False,
        'formatter': UpdatingDefaultsHelpFormatter(),
        'name': 'global',
        'prog': get_prog(),
    }

    parser = ConfigOptionParser(**parser_kw)
    parser.disable_interspersed_args()

    pip_pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    parser.version = 'pip %s from %s (python %s)' % (
        __version__, pip_pkg_dir, sys.version[:3])

    # add the general options
    gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)
    parser.add_option_group(gen_opts)

    parser.main = True  # so the help formatter knows

    # create command listing for description
    command_summaries = get_summaries()
    description = [''] + ['%-27s %s' % (i, j) for i, j in command_summaries]
    parser.description = '\n'.join(description)

    return parser 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:30,代碼來源:__init__.py

示例2: create_main_parser

# 需要導入模塊: from pip import commands [as 別名]
# 或者: from pip.commands import get_summaries [as 別名]
def create_main_parser():
    parser_kw = {
        'usage': '\n%prog <command> [options]',
        'add_help_option': False,
        'formatter': UpdatingDefaultsHelpFormatter(),
        'name': 'global',
        'prog': get_prog(),
    }

    parser = ConfigOptionParser(**parser_kw)
    parser.disable_interspersed_args()

    pip_pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    parser.version = 'pip %s from %s (python %s)' % (
        __version__,  pip_pkg_dir, sys.version[:3])

    # add the general options
    gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)
    parser.add_option_group(gen_opts)

    parser.main = True # so the help formatter knows

    # create command listing for description
    command_summaries = get_summaries()
    description = [''] + ['%-27s %s' % (i, j) for i, j in command_summaries]
    parser.description = '\n'.join(description)

    return parser 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:30,代碼來源:__init__.py

示例3: get_summaries

# 需要導入模塊: from pip import commands [as 別名]
# 或者: from pip.commands import get_summaries [as 別名]
def get_summaries():
        return ((k, v.summary) for k, v in commands_dict.items()) 
開發者ID:asottile,項目名稱:pip-custom-platform,代碼行數:4,代碼來源:_main.py

示例4: get_main

# 需要導入模塊: from pip import commands [as 別名]
# 或者: from pip.commands import get_summaries [as 別名]
def get_main(pip_main):
    def main(argv=None):
        argv = argv if argv is not None else sys.argv[1:]

        def _add_platform_param(parser):
            parser.add_argument(
                '--platform', help=(
                    'Custom platform name.  The default is auto-detected -- '
                    'Use `pip-custom-platform show-platform-name` to show.'
                ),
            )

        parser = argparse.ArgumentParser(
            prog='pip-custom-platform',
            description=(
                'pip+wheel wrapper which allows you to choose a custom '
                'platform name for building, downloading, and installing '
                'wheels.\n\n'
                'Any unparsed command arguments will be passed on to pip\n'
            ),
        )
        subparsers = parser.add_subparsers(dest='command')
        subparsers.required = True

        for cmd, summary in get_summaries():
            subparser = subparsers.add_parser(cmd, help=summary)
            if cmd in ('install', 'download', 'wheel'):
                _add_platform_param(subparser)
            if cmd == 'wheel':
                subparser.add_argument(
                    '-w', '--wheel-dir', default='./wheelhouse',
                    help='Build wheels into this directory',
                )

        platform_name = subparsers.add_parser(
            'show-platform-name', help='Show the default platform name',
        )
        _add_platform_param(platform_name)

        args, rest = parser.parse_known_args(argv)
        if args.command == 'wheel':
            return _wheel(args.wheel_dir, pip_main, rest)
        elif args.command == 'show-platform-name':
            return _show_platform_name()
        else:
            return pip_main([args.command] + rest)
    return main 
開發者ID:asottile,項目名稱:pip-custom-platform,代碼行數:49,代碼來源:_main.py


注:本文中的pip.commands.get_summaries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。