Revision 13392
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/util.py | ||
---|---|---|
187 | 187 |
def rename_key(dict_, orig, new): dict_[new] = dict_.pop(orig) |
188 | 188 |
|
189 | 189 |
def dict_subset(dict_, keys): |
190 |
try: from collections import OrderedDict |
|
191 |
except ImportError: subset = dict() |
|
192 |
else: subset = OrderedDict() |
|
190 |
from collections import OrderedDict |
|
191 |
subset = OrderedDict() |
|
193 | 192 |
for key in keys: |
194 | 193 |
try: subset[key] = dict_[key] |
195 | 194 |
except KeyError: pass |
Also available in: Unified diff
fix: lib/util.py: dict_subset(): raise an error if collections.OrderedDict isn't available, because some callers may depend on this. note that using dict instead of OrderedDict may be the cause of the joining on the wrong columns bug (issue #902).