From 0b59b46c2543b28ca95b618ab4c09f308a420b8a Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Wed, 17 Feb 2016 19:41:17 +0100 Subject: [PATCH] Fix PendingDeprecationWarning in libbmc.tools.batch --- libbmc/__init__.py | 2 +- libbmc/tools.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libbmc/__init__.py b/libbmc/__init__.py index f97fb99..d8253c1 100644 --- a/libbmc/__init__.py +++ b/libbmc/__init__.py @@ -8,4 +8,4 @@ with scientific papers. # Global list of valid paper identifier types. See README.md. __valid_identifiers__ = [] -__version__ = "0.2" +__version__ = "0.2.1" diff --git a/libbmc/tools.py b/libbmc/tools.py index f35b654..e557150 100644 --- a/libbmc/tools.py +++ b/libbmc/tools.py @@ -108,7 +108,10 @@ def batch(iterable, size): item = iter(iterable) while True: 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):