File tree Expand file tree Collapse file tree 4 files changed +9
-27
lines changed Expand file tree Collapse file tree 4 files changed +9
-27
lines changed Original file line number Diff line number Diff line change 66import sys
77
88from 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
1010from pip ._internal .utils .misc import get_installed_distributions
1111
1212
@@ -23,7 +23,7 @@ def autocomplete():
2323 except IndexError :
2424 current = ''
2525
26- subcommands = [ cmd for cmd , summary in get_summaries ()]
26+ subcommands = list ( commands_dict )
2727 options = []
2828 # subcommand
2929 try :
Original file line number Diff line number Diff line change 99 ConfigOptionParser ,
1010 UpdatingDefaultsHelpFormatter ,
1111)
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
1713from pip ._internal .exceptions import CommandError
1814from pip ._internal .utils .misc import get_pip_version , get_prog
1915from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
@@ -51,8 +47,10 @@ def create_main_parser():
5147 parser .main = True # type: ignore
5248
5349 # 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+ ]
5654 parser .description = '\n ' .join (description )
5755
5856 return parser
Original file line number Diff line number Diff line change 99from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
1010
1111if MYPY_CHECK_RUNNING :
12- from typing import Any , Iterable , Tuple
12+ from typing import Any
1313 from pip ._internal .cli .base_command import Command
1414
1515
@@ -96,13 +96,6 @@ def create_command(name, **kwargs):
9696 return command
9797
9898
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-
10699def get_similar_commands (name ):
107100 """Command name auto-correct."""
108101 from difflib import get_close_matches
Original file line number Diff line number Diff line change 11import pytest
22
3- from pip ._internal .commands import commands_dict , create_command , get_summaries
3+ from pip ._internal .commands import commands_dict , create_command
44
55
66def test_commands_dict__order ():
@@ -20,12 +20,3 @@ def test_create_command(name):
2020 command = create_command (name )
2121 assert command .name == name
2222 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