diff options
author | Frederick Muriuki Muriithi | 2024-01-15 17:49:14 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-15 17:49:14 +0300 |
commit | 42b43f8d46fe0c25703de914a687127726ece35e (patch) | |
tree | f30490a689be720969a1a57cd3bd92e9abf68739 /quality_control | |
parent | ef6da7313f96390b9fecb126f9b7e9beb1afe034 (diff) | |
download | gn-uploader-42b43f8d46fe0c25703de914a687127726ece35e.tar.gz |
Extract common functional tools to separate package.
Diffstat (limited to 'quality_control')
-rw-r--r-- | quality_control/parsing.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/quality_control/parsing.py b/quality_control/parsing.py index 5fc5f62..5b21716 100644 --- a/quality_control/parsing.py +++ b/quality_control/parsing.py @@ -12,6 +12,8 @@ from quality_control.errors import ( from quality_control.headers import ( invalid_header, invalid_headings, duplicate_headings) +from functional_tools import take + class FileType(Enum): """Enumerate the expected file types""" AVERAGE = 1 @@ -121,15 +123,3 @@ def collect_errors( if update_progress: update_progress(line_number, line) - -def take(iterable: Iterable, num: int) -> list: - """Take at most `num` items from `iterable`.""" - iterator = iter(iterable) - items = [] - try: - for i in range(0, num): # pylint: disable=[unused-variable] - items.append(next(iterator)) - - return items - except StopIteration: - return items |