From a24b82e67daf190c8c0cdc04985591522d413e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 11 Dec 2023 23:32:28 +0100 Subject: [PATCH] add 'util.repeat()' --- gallery_dl/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 53502ef0..751c3986 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -55,6 +55,13 @@ def advance(iterable, num): return iterator +def repeat(times): + """Return an iterator that returns None""" + if times < 0: + return itertools.repeat(None) + return itertools.repeat(None, times) + + def unique(iterable): """Yield unique elements from 'iterable' while preserving order""" seen = set()