refactoring
This commit is contained in:
parent
3e882dc247
commit
2fcb0bd149
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user