From 42b43f8d46fe0c25703de914a687127726ece35e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 15 Jan 2024 17:49:14 +0300 Subject: Extract common functional tools to separate package. --- quality_control/parsing.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'quality_control') 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 -- cgit v1.2.3