0002-utils-add-helper-function-to-lowercase-the-keys-of-a.patch
src/authentic2/utils.py | ||
---|---|---|
444 | 444 |
def batch(iterable, size): |
445 | 445 |
'''Batch an iterable as an iterable of iterables of at most size element |
446 | 446 |
long. |
447 | 447 |
''' |
448 | 448 |
sourceiter = iter(iterable) |
449 | 449 |
while True: |
450 | 450 |
batchiter = islice(sourceiter, size) |
451 | 451 |
yield chain([batchiter.next()], batchiter) |
452 | ||
453 |
def lower_keys(d): |
|
454 |
'''Convert all keys in dictionary d to lowercase''' |
|
455 |
return dict((key.lower(), value) for key, value in d.iteritems()) |
|
452 |
- |