summaryrefslogtreecommitdiffstats
path: root/module/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/Utils.py')
-rw-r--r--module/Utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/Utils.py b/module/Utils.py
index c965e33c4..9ad7c2737 100644
--- a/module/Utils.py
+++ b/module/Utils.py
@@ -8,6 +8,7 @@ import time
import re
from os.path import join
from string import maketrans
+from itertools import islice
from htmlentitydefs import name2codepoint
def chmod(*args):
@@ -168,6 +169,13 @@ def lock(func):
return new
+def chunks(iterable, size):
+ it = iter(iterable)
+ item = list(islice(it, size))
+ while item:
+ yield item
+ item = list(islice(it, size))
+
def fixup(m):
text = m.group(0)