-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from OP-TED/feature/TED-1173
check availability in Cellar with a batch of URIes
- Loading branch information
Showing
4 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from itertools import chain, islice | ||
from typing import Iterable | ||
|
||
|
||
def chunks(iterable: Iterable, chunk_size: int): | ||
""" | ||
This function split in chunks a iterable structure based on chunk_size parameter. | ||
:param iterable: | ||
:param chunk_size: | ||
:return: | ||
""" | ||
iterator = iter(iterable) | ||
for first in iterator: | ||
yield chain([first], islice(iterator, chunk_size - 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters