pep8 fixes

This commit is contained in:
Georgi Valkov 2012-12-06 16:56:46 +02:00
parent b4fe4ffc0d
commit 7f4503b9e2
3 changed files with 29 additions and 29 deletions

View File

@ -80,7 +80,7 @@ def autocomplete():
if current.startswith('-') or current.startswith('--'):
opts = [i.option_list for i in parser.option_groups]
opts.append(parser.option_list)
opts = (o for it in opts for o in it)
opts = (o for it in opts for o in it)
subcommands += [i.get_opt_string() for i in opts
if i.help != optparse.SUPPRESS_HELP]
@ -96,7 +96,7 @@ def parseopts(args):
command_summaries = get_summaries()
description = ['Commands:']
description.extend([' %-20s %s' % (i, j) for i,j in command_summaries])
description.extend([' %-20s %s' % (i, j) for i, j in command_summaries])
# We have to add the name of the default OptionGroup here for now.
description.append('\nOptions:')
@ -115,7 +115,8 @@ def parseopts(args):
sys.exit()
if not args:
msg = 'You must give a command (use "pip --help" to see a list of commands)'
msg = ('You must give a command '
'(use "pip --help" to see a list of commands)')
raise CommandError(msg)
command = args[0].lower()
@ -125,9 +126,9 @@ def parseopts(args):
msg = ['unknown command "%s"' % command]
if guess:
msg.append('maybe you meant "%s"' % guess)
msg.append('maybe you meant "%s"' % guess)
raise CommandError(' - '.join(msg)) # TODO:
raise CommandError(' - '.join(msg)) # TODO:
return command, options, args, parser
@ -146,7 +147,7 @@ def main(initial_args=None):
sys.stderr.write(os.linesep)
sys.exit(1)
command = commands[cmd_name](parser) #see baseparser.Command
command = commands[cmd_name](parser) # see baseparser.Command
return command.main(args[1:], options)

View File

@ -3,29 +3,29 @@ Package containing all pip commands
"""
from pip.commands.bundle import BundleCommand
from pip.commands.bundle import BundleCommand
from pip.commands.completion import CompletionCommand
from pip.commands.freeze import FreezeCommand
from pip.commands.help import HelpCommand
from pip.commands.search import SearchCommand
from pip.commands.show import ShowCommand
from pip.commands.install import InstallCommand
from pip.commands.uninstall import UninstallCommand
from pip.commands.unzip import UnzipCommand
from pip.commands.zip import ZipCommand
from pip.commands.freeze import FreezeCommand
from pip.commands.help import HelpCommand
from pip.commands.search import SearchCommand
from pip.commands.show import ShowCommand
from pip.commands.install import InstallCommand
from pip.commands.uninstall import UninstallCommand
from pip.commands.unzip import UnzipCommand
from pip.commands.zip import ZipCommand
commands = {
BundleCommand.name : BundleCommand,
CompletionCommand.name : CompletionCommand,
FreezeCommand.name : FreezeCommand,
HelpCommand.name : HelpCommand,
SearchCommand.name : SearchCommand,
ShowCommand.name : ShowCommand,
InstallCommand.name : InstallCommand,
UninstallCommand.name : UninstallCommand,
UnzipCommand.name : UnzipCommand,
ZipCommand.name : ZipCommand,
BundleCommand.name: BundleCommand,
CompletionCommand.name: CompletionCommand,
FreezeCommand.name: FreezeCommand,
HelpCommand.name: HelpCommand,
SearchCommand.name: SearchCommand,
ShowCommand.name: ShowCommand,
InstallCommand.name: InstallCommand,
UninstallCommand.name: UninstallCommand,
UnzipCommand.name: UnzipCommand,
ZipCommand.name: ZipCommand,
}
@ -37,7 +37,7 @@ def get_summaries(ignore_hidden=True):
if ignore_hidden and command_class.hidden:
continue
items.append( (name, command_class.summary) )
items.append((name, command_class.summary))
return sorted(items)
@ -54,4 +54,3 @@ def get_similar_commands(name):
guess = False
return guess

View File

@ -12,14 +12,14 @@ class HelpCommand(Command):
try:
# 'pip help' with no args is handled by pip.__init__.parseopt()
cmd_name = args[0] # the command we need help for
cmd_name = args[0] # the command we need help for
except:
return SUCCESS
if cmd_name not in commands:
raise CommandError('unknown command "%s"' % cmd_name)
command = commands[cmd_name](self.main_parser) # instantiate
command = commands[cmd_name](self.main_parser) # instantiate
command.parser.print_help()
return SUCCESS