From a6b193ae87f9b2cba0ffab2e087da0efe1400617 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 5 Jan 2018 19:01:08 +0100 Subject: [PATCH] Fix missing config arg in deep_detect --- flatisfy/cmds.py | 3 ++- flatisfy/filters/__init__.py | 5 +++-- flatisfy/filters/duplicates.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/flatisfy/cmds.py b/flatisfy/cmds.py index 08a9c5e..6564024 100644 --- a/flatisfy/cmds.py +++ b/flatisfy/cmds.py @@ -81,7 +81,8 @@ def filter_flats_list(config, constraint_name, flats_list, fetch_details=True): # Do a third pass to deduplicate better if config["passes"] > 2: third_pass_result = flatisfy.filters.third_pass( - second_pass_result["new"] + second_pass_result["new"], + config ) else: third_pass_result["new"] = second_pass_result["new"] diff --git a/flatisfy/filters/__init__.py b/flatisfy/filters/__init__.py index c4ffd33..15a15ce 100644 --- a/flatisfy/filters/__init__.py +++ b/flatisfy/filters/__init__.py @@ -233,7 +233,7 @@ def second_pass(flats_list, constraint, config): } @tools.timeit -def third_pass(flats_list): +def third_pass(flats_list, config): """ Third filtering pass. @@ -241,12 +241,13 @@ def third_pass(flats_list): flats. :param flats_list: A list of flats dict to filter. + :param config: A config dict. :return: A dict mapping flat status and list of flat objects. """ LOGGER.info("Running third filtering pass.") # Deduplicate the list using every available data - flats_list, duplicate_flats = duplicates.deep_detect(flats_list) + flats_list, duplicate_flats = duplicates.deep_detect(flats_list, config) return { "new": flats_list, diff --git a/flatisfy/filters/duplicates.py b/flatisfy/filters/duplicates.py index 3016fc7..ae23066 100644 --- a/flatisfy/filters/duplicates.py +++ b/flatisfy/filters/duplicates.py @@ -48,6 +48,7 @@ def homogeneize_phone_number(number): return number + def find_number_common_photos(photo_cache, flat1_photos, flat2_photos): """ Compute the number of common photos between the two lists of photos for the @@ -167,11 +168,12 @@ def detect(flats_list, key="id", merge=True, should_intersect=False): return unique_flats_list, duplicate_flats -def deep_detect(flats_list): +def deep_detect(flats_list, config): """ Deeper detection of duplicates based on any available data. :param flats_list: A list of flats dicts. + :param config: A config dict. :return: A tuple of the deduplicated list of flat dicts and the list of all the flats objects that should be removed and considered as duplicates (they were already merged).