diff bio2srr.py @ 8:832f269deeb0

planemo upload for repository https://toolrepo.galaxytrakr.org/view/jpayne/bioproject_to_srr_2/556cac4fb538
author jpayne
date Sun, 05 May 2024 23:47:10 -0400
parents 2d4a2159c74b
children f9f1d0a0599a
line wrap: on
line diff
--- a/bio2srr.py	Sun May 05 23:32:17 2024 -0400
+++ b/bio2srr.py	Sun May 05 23:47:10 2024 -0400
@@ -4,8 +4,17 @@
 import sys
 import csv
 
-
-from itertools import batched
+try:
+    from itertools import batched
+except ImportError:
+    def batched(iterable, n):
+        "Batch data into tuples of length n. The last batch may be shorter."
+        # batched('ABCDEFG', 3) --> ABC DEF G
+        if n < 1:
+            raise ValueError('n must be at least one')
+        it = iter(iterable)
+        while batch := tuple(islice(it, n)):
+            yield batch
 from functools import cmp_to_key
 from time import sleep
 from xml.etree import ElementTree as xml