Browse Source

Fix PendingDeprecationWarning in libbmc.tools.batch

Phyks (Lucas Verney) 3 years ago
parent
commit
0b59b46c25
2 changed files with 5 additions and 2 deletions
  1. 1
    1
      libbmc/__init__.py
  2. 4
    1
      libbmc/tools.py

+ 1
- 1
libbmc/__init__.py View File

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

+ 4
- 1
libbmc/tools.py View File

@@ -108,7 +108,10 @@ def batch(iterable, size):
108 108
     item = iter(iterable)
109 109
     while True:
110 110
         batch_iterator = islice(item, size)
111
-        yield chain([next(batch_iterator)], batch_iterator)
111
+        try:
112
+            yield chain([next(batch_iterator)], batch_iterator)
113
+        except StopIteration:
114
+            return
112 115
 
113 116
 
114 117
 def remove_urls(text):