summaryrefslogtreecommitdiff
path: root/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py')
-rw-r--r--venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py
deleted file mode 100644
index d44e6f1..0000000
--- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/__init__.py
+++ /dev/null
@@ -1,79 +0,0 @@
1"""
2Package containing all pip commands
3"""
4from __future__ import absolute_import
5
6from pip._internal.commands.completion import CompletionCommand
7from pip._internal.commands.configuration import ConfigurationCommand
8from pip._internal.commands.download import DownloadCommand
9from pip._internal.commands.freeze import FreezeCommand
10from pip._internal.commands.hash import HashCommand
11from pip._internal.commands.help import HelpCommand
12from pip._internal.commands.list import ListCommand
13from pip._internal.commands.check import CheckCommand
14from pip._internal.commands.search import SearchCommand
15from pip._internal.commands.show import ShowCommand
16from pip._internal.commands.install import InstallCommand
17from pip._internal.commands.uninstall import UninstallCommand
18from pip._internal.commands.wheel import WheelCommand
19
20from pip._internal.utils.typing import MYPY_CHECK_RUNNING
21
22if MYPY_CHECK_RUNNING:
23 from typing import List, Type
24 from pip._internal.basecommand import Command
25
26commands_order = [
27 InstallCommand,
28 DownloadCommand,
29 UninstallCommand,
30 FreezeCommand,
31 ListCommand,
32 ShowCommand,
33 CheckCommand,
34 ConfigurationCommand,
35 SearchCommand,
36 WheelCommand,
37 HashCommand,
38 CompletionCommand,
39 HelpCommand,
40] # type: List[Type[Command]]
41
42commands_dict = {c.name: c for c in commands_order}
43
44
45def get_summaries(ordered=True):
46 """Yields sorted (command name, command summary) tuples."""
47
48 if ordered:
49 cmditems = _sort_commands(commands_dict, commands_order)
50 else:
51 cmditems = commands_dict.items()
52
53 for name, command_class in cmditems:
54 yield (name, command_class.summary)
55
56
57def get_similar_commands(name):
58 """Command name auto-correct."""
59 from difflib import get_close_matches
60
61 name = name.lower()
62
63 close_commands = get_close_matches(name, commands_dict.keys())
64
65 if close_commands:
66 return close_commands[0]
67 else:
68 return False
69
70
71def _sort_commands(cmddict, order):
72 def keyfn(key):
73 try:
74 return order.index(key[1])
75 except ValueError:
76 # unordered items should come last
77 return 0xff
78
79 return sorted(cmddict.items(), key=keyfn)