diff options
author | 2011-12-15 23:18:21 +0100 | |
---|---|---|
committer | 2011-12-15 23:18:21 +0100 | |
commit | 5499be89203a18ca61a21cfc7266cf0f4ebe6547 (patch) | |
tree | 55f3d207573920be3a6970dbc099d058f417c05f /module/Utils.py | |
parent | Added tag v0.4.9 for changeset 1babca12c25f (diff) | |
download | pyload-5499be89203a18ca61a21cfc7266cf0f4ebe6547.tar.xz |
refractoring
Diffstat (limited to 'module/Utils.py')
-rw-r--r-- | module/Utils.py | 8 |
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) |