Fix PendingDeprecationWarning in libbmc.tools.batch

This commit is contained in:
Lucas Verney 2016-02-17 19:41:17 +01:00
parent 89b9c1ed44
commit 0b59b46c25
2 changed files with 5 additions and 2 deletions

View File

@ -8,4 +8,4 @@ with scientific papers.
# Global list of valid paper identifier types. See README.md. # Global list of valid paper identifier types. See README.md.
__valid_identifiers__ = [] __valid_identifiers__ = []
__version__ = "0.2" __version__ = "0.2.1"

View File

@ -108,7 +108,10 @@ def batch(iterable, size):
item = iter(iterable) item = iter(iterable)
while True: while True:
batch_iterator = islice(item, size) batch_iterator = islice(item, size)
yield chain([next(batch_iterator)], batch_iterator) try:
yield chain([next(batch_iterator)], batch_iterator)
except StopIteration:
return
def remove_urls(text): def remove_urls(text):