File tree 4 files changed +9
-27
lines changed 4 files changed +9
-27
lines changed Original file line number Diff line number Diff line change 6
6
import sys
7
7
8
8
from pip ._internal .cli .main_parser import create_main_parser
9
- from pip ._internal .commands import create_command , get_summaries
9
+ from pip ._internal .commands import commands_dict , create_command
10
10
from pip ._internal .utils .misc import get_installed_distributions
11
11
12
12
@@ -23,7 +23,7 @@ def autocomplete():
23
23
except IndexError :
24
24
current = ''
25
25
26
- subcommands = [ cmd for cmd , summary in get_summaries ()]
26
+ subcommands = list ( commands_dict )
27
27
options = []
28
28
# subcommand
29
29
try :
Original file line number Diff line number Diff line change 9
9
ConfigOptionParser ,
10
10
UpdatingDefaultsHelpFormatter ,
11
11
)
12
- from pip ._internal .commands import (
13
- commands_dict ,
14
- get_similar_commands ,
15
- get_summaries ,
16
- )
12
+ from pip ._internal .commands import commands_dict , get_similar_commands
17
13
from pip ._internal .exceptions import CommandError
18
14
from pip ._internal .utils .misc import get_pip_version , get_prog
19
15
from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
@@ -51,8 +47,10 @@ def create_main_parser():
51
47
parser .main = True # type: ignore
52
48
53
49
# create command listing for description
54
- command_summaries = get_summaries ()
55
- description = ['' ] + ['%-27s %s' % (i , j ) for i , j in command_summaries ]
50
+ description = ['' ] + [
51
+ '%-27s %s' % (name , command_info .summary )
52
+ for name , command_info in commands_dict .items ()
53
+ ]
56
54
parser .description = '\n ' .join (description )
57
55
58
56
return parser
Original file line number Diff line number Diff line change 9
9
from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
10
10
11
11
if MYPY_CHECK_RUNNING :
12
- from typing import Any , Iterable , Tuple
12
+ from typing import Any
13
13
from pip ._internal .cli .base_command import Command
14
14
15
15
@@ -96,13 +96,6 @@ def create_command(name, **kwargs):
96
96
return command
97
97
98
98
99
- def get_summaries ():
100
- # type: () -> Iterable[Tuple[str, str]]
101
- """Yield command (name, summary) tuples in display order."""
102
- for name , command_info in commands_dict .items ():
103
- yield (name , command_info .summary )
104
-
105
-
106
99
def get_similar_commands (name ):
107
100
"""Command name auto-correct."""
108
101
from difflib import get_close_matches
Original file line number Diff line number Diff line change 1
1
import pytest
2
2
3
- from pip ._internal .commands import commands_dict , create_command , get_summaries
3
+ from pip ._internal .commands import commands_dict , create_command
4
4
5
5
6
6
def test_commands_dict__order ():
@@ -20,12 +20,3 @@ def test_create_command(name):
20
20
command = create_command (name )
21
21
assert command .name == name
22
22
assert command .summary == commands_dict [name ].summary
23
-
24
-
25
- def test_get_summaries ():
26
- actual = list (get_summaries ())
27
- for name , summary in actual :
28
- assert summary == commands_dict [name ].summary
29
-
30
- # Also check that the result is ordered correctly.
31
- assert [item [0 ] for item in actual ] == list (commands_dict )
You can’t perform that action at this time.
0 commit comments