From 2fcb0bd1499bd2267591ab9c6ad2ae9df0f89a17 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Thu, 7 Apr 2022 17:28:25 +0200 Subject: [PATCH] refactoring --- test/unit_tests/image_stitcher_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit_tests/image_stitcher_test.py b/test/unit_tests/image_stitcher_test.py index f363d8d..01f8b41 100644 --- a/test/unit_tests/image_stitcher_test.py +++ b/test/unit_tests/image_stitcher_test.py @@ -8,7 +8,7 @@ import fpdf import numpy as np import pytest from PIL import Image -from funcy import merge, second, compose, rpartial, juxt +from funcy import merge, second, compose, rpartial, juxt, rest, first from image_prediction.estimator.preprocessor.utils import image_to_normalized_tensor from image_prediction.image_extractor.extractor import ImageMetadataPair @@ -127,8 +127,8 @@ class Stitcher: def merge_group(group): - def f(pairs): - current_pair = pairs.pop(0) + + def merge_with(current_pair, pairs): to_remove = [] @@ -142,7 +142,7 @@ def merge_group(group): pairs = list(group) while True: - new_pairs = f(deepcopy(pairs)) + new_pairs = merge_with(*juxt(first, rest)(pairs)) if len(new_pairs) == len(pairs): break pairs = new_pairs