swh.lister.gitlab.tasks: Fix range computations
This commit is contained in:
parent
a69e576c85
commit
81fd5f9c5d
3 changed files with 33 additions and 9 deletions
|
@ -12,3 +12,14 @@ def get(d, keys):
|
|||
if v is not None:
|
||||
return v
|
||||
return None
|
||||
|
||||
|
||||
def split_range(total_pages, nb_pages):
|
||||
prev_index = None
|
||||
for index in range(0, total_pages, nb_pages):
|
||||
if index is not None and prev_index is not None:
|
||||
yield prev_index, index
|
||||
prev_index = index
|
||||
|
||||
if index != total_pages:
|
||||
yield index, total_pages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue