summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyint <myint@macbookpro.local>2012-06-16 11:52:05 -0700
committermyint <myint@macbookpro.local>2012-06-16 11:52:05 -0700
commit51486779d2989a1080974ed10d9d69439ebb942a (patch)
tree89072fd954bf4215835076964fc548c5b2f6e4c5
parent77c6f2a312f64e5322eb1dca1c40f55c891abbd2 (diff)
downloadpep8-51486779d2989a1080974ed10d9d69439ebb942a.tar.gz
Normalize keys in configuration file
Use the same implicit rules used by optparse.
-rwxr-xr-xpep8.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pep8.py b/pep8.py
index 58deffe..00b2d9b 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1742,7 +1742,8 @@ def read_config(options, args, arglist, parser):
# Second, parse the configuration
for opt in config.options('pep8'):
- opt_type = option_list.get(opt)
+ normalized_opt = opt.replace('-', '_')
+ opt_type = option_list.get(normalized_opt)
if not opt_type:
print('Unknown option: %s' % opt)
elif opt_type in ('int', 'count'):
@@ -1752,7 +1753,7 @@ def read_config(options, args, arglist, parser):
else:
assert opt_type in ('store_true', 'store_false')
value = config.getboolean('pep8', opt)
- setattr(options, opt, value)
+ setattr(options, normalized_opt, value)
# Third, overwrite with the command-line options
options, _ = parser.parse_args(arglist, values=options)