Skip to content

Commit 0371ddb

Browse files
committed
Style and consistency fixes as suggested by reviewers
1 parent 3534ac5 commit 0371ddb

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pip/baseparser.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class PipPrettyHelpFormatter(optparse.IndentedHelpFormatter):
13-
""" A prettier/less verbose help formatter for optparse """
13+
"""A prettier/less verbose help formatter for optparse."""
1414

1515
def __init__(self, *args, **kw):
1616
kw['max_help_position'] = 23
@@ -19,23 +19,27 @@ def __init__(self, *args, **kw):
1919
# do as argparse does
2020
try:
2121
kw['width'] = int(os.environ['COLUMNS']) - 2
22-
#except (KeyError, ValueError):
2322
except:
2423
kw['width'] = 78
2524

2625
optparse.IndentedHelpFormatter.__init__(self, *args, **kw)
2726

2827
def format_option_strings(self, option):
29-
#return self._format_option_strings(option, ' %s', ' ')
3028
return self._format_option_strings(option, ' <%s>', ', ')
3129

3230
def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
33-
""" ('-f', '--format') -> -f%(optsep)s--format mvarfmt % metavar"""
31+
"""
32+
Return a comma-separated list of option strings and metavars.
33+
34+
:param option: tuple of (short opt, long opt), e.g: ('-f', '--format')
35+
:param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
36+
:param optsep: separator
37+
"""
3438

3539
opts = []
3640

3741
if option._short_opts: opts.append(option._short_opts[0])
38-
if option._long_opts: opts.append(option._long_opts[0])
42+
if option._long_opts: opts.append(option._long_opts[0])
3943
if len(opts) > 1: opts.insert(1, optsep)
4044

4145
if option.takes_value():
@@ -58,15 +62,15 @@ def format_usage(self, usage):
5862

5963
return msg
6064

61-
# leave full control over description to us
6265
def format_description(self, description):
66+
# leave full control over description to us
6367
if description:
6468
return description
6569
else:
6670
return ''
6771

68-
# leave full control over epilog to us
6972
def format_epilog(self, epilog):
73+
# leave full control over epilog to us
7074
if epilog:
7175
return epilog
7276
else:

0 commit comments

Comments
 (0)