1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

add 'util.repeat()'

This commit is contained in:
Mike Fährmann 2023-12-11 23:32:28 +01:00
parent 92fbf09643
commit a24b82e67d
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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()