Fix missing config arg in deep_detect

This commit is contained in:
Lucas Verney 2018-01-05 19:01:08 +01:00
parent f55b6a940b
commit a6b193ae87
3 changed files with 8 additions and 4 deletions

View File

@ -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"]

View File

@ -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,

View File

@ -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).