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:
parent
92fbf09643
commit
a24b82e67d
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user