diff options
author | myint <myint@macbookpro.local> | 2012-06-16 11:52:05 -0700 |
---|---|---|
committer | myint <myint@macbookpro.local> | 2012-06-16 11:52:05 -0700 |
commit | 51486779d2989a1080974ed10d9d69439ebb942a (patch) | |
tree | 89072fd954bf4215835076964fc548c5b2f6e4c5 | |
parent | 77c6f2a312f64e5322eb1dca1c40f55c891abbd2 (diff) | |
download | pep8-51486779d2989a1080974ed10d9d69439ebb942a.tar.gz |
Normalize keys in configuration file
Use the same implicit rules used by optparse.
-rwxr-xr-x | pep8.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |