Browse Source

Fix missing config arg in deep_detect

utf8exc
Lucas Verney 5 years ago
parent
commit
a6b193ae87
  1. 3
      flatisfy/cmds.py
  2. 5
      flatisfy/filters/__init__.py
  3. 4
      flatisfy/filters/duplicates.py

3
flatisfy/cmds.py

@ -81,7 +81,8 @@ def filter_flats_list(config, constraint_name, flats_list, fetch_details=True): @@ -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"]

5
flatisfy/filters/__init__.py

@ -233,7 +233,7 @@ def second_pass(flats_list, constraint, config): @@ -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): @@ -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,

4
flatisfy/filters/duplicates.py

@ -48,6 +48,7 @@ def homogeneize_phone_number(number): @@ -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): @@ -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).

Loading…
Cancel
Save