Mercurial > p > roundup > code
comparison roundup/configuration.py @ 5395:23b8e6067f7c
Python 3 preparation: update calls to dict methods.
Tool-assisted patch. Changes of iterkeys / itervalues / iteritems to
keys / values / items are fully automated, but may make things less
efficient in Python 2. Automated tools want to add list() around many
calls to keys / values / items, but I thought most such list()
additions were unnecessary because it seemed the result of keys /
values / items was just iterated over while the set of dict keys
remained unchanged, rather than used in a way requiring an actual
list, or used while the set of keys in the dict could change. It's
quite possible I missed some cases where list() was really needed, or
left in some unnecessary list() calls.
In cases where list() was only needed because the resulting list was
then sorted in-place, I changed the code to use calls to sorted().
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 23:04:42 +0000 |
| parents | fc97f1f4a7e3 |
| children | 56c9bcdea47f |
comparison
equal
deleted
inserted
replaced
| 5394:c26d88ec071e | 5395:23b8e6067f7c |
|---|---|
| 1536 """ | 1536 """ |
| 1537 | 1537 |
| 1538 def _adjust_options(self, config): | 1538 def _adjust_options(self, config): |
| 1539 # config defaults appear in all sections. | 1539 # config defaults appear in all sections. |
| 1540 # we'll need to filter them out. | 1540 # we'll need to filter them out. |
| 1541 defaults = config.defaults().keys() | 1541 defaults = list(config.defaults().keys()) |
| 1542 # see what options are already defined and add missing ones | 1542 # see what options are already defined and add missing ones |
| 1543 preset = [(option.section, option.setting) for option in self.items()] | 1543 preset = [(option.section, option.setting) for option in self.items()] |
| 1544 for section in config.sections(): | 1544 for section in config.sections(): |
| 1545 for name in config.options(section): | 1545 for name in config.options(section): |
| 1546 if ((section, name) not in preset) \ | 1546 if ((section, name) not in preset) \ |
