本文整理匯總了Python中pip._internal.cli.base_command.Command方法的典型用法代碼示例。如果您正苦於以下問題:Python base_command.Command方法的具體用法?Python base_command.Command怎麽用?Python base_command.Command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pip._internal.cli.base_command
的用法示例。
在下文中一共展示了base_command.Command方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_similar_commands
# 需要導入模塊: from pip._internal.cli import base_command [as 別名]
# 或者: from pip._internal.cli.base_command import Command [as 別名]
def get_similar_commands(name):
"""Command name auto-correct."""
from difflib import get_close_matches
name = name.lower()
close_commands = get_close_matches(name, commands_dict.keys())
if close_commands:
return close_commands[0]
else:
return False
示例2: create_command
# 需要導入模塊: from pip._internal.cli import base_command [as 別名]
# 或者: from pip._internal.cli.base_command import Command [as 別名]
def create_command(name, **kwargs):
# type: (str, **Any) -> Command
"""
Create an instance of the Command class with the given name.
"""
module_path, class_name, summary = commands_dict[name]
module = importlib.import_module(module_path)
command_class = getattr(module, class_name)
command = command_class(name=name, summary=summary, **kwargs)
return command