diff --git a/flatisfy/__main__.py b/flatisfy/__main__.py index e5532a3..1ce71f8 100644 --- a/flatisfy/__main__.py +++ b/flatisfy/__main__.py @@ -113,7 +113,8 @@ def main(): # Set logger if args.vv: logging.getLogger("").setLevel(logging.DEBUG) - logging.getLogger("sqlalchemy.engine").setLevel(logging.DEBUG) + logging.getLogger("titlecase").setLevel(logging.INFO) + logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO) elif args.verbose: logging.getLogger("").setLevel(logging.INFO) # sqlalchemy INFO level is way too loud, just stick with WARNING diff --git a/flatisfy/data_files/__init__.py b/flatisfy/data_files/__init__.py index 455f40e..cb0ccf4 100644 --- a/flatisfy/data_files/__init__.py +++ b/flatisfy/data_files/__init__.py @@ -174,7 +174,7 @@ def _preprocess_laposte(): ) ) except KeyError: - LOGGER.info("Missing data for postal code %s, skipping it.", fields["code_postal"]) + LOGGER.debug("Missing data for postal code %s, skipping it.", fields["code_postal"]) return postal_codes_data diff --git a/flatisfy/filters/__init__.py b/flatisfy/filters/__init__.py index 2216d04..b92e893 100644 --- a/flatisfy/filters/__init__.py +++ b/flatisfy/filters/__init__.py @@ -43,7 +43,7 @@ def refine_with_housing_criteria(flats_list, constraint): flat["id"], ", ".join(constraint["postal_codes"]), ) - is_ok[i] = is_ok[i] and False + is_ok[i] = False # Check insee code insee_code = flat["flatisfy"].get("insee_code", None) if insee_code and "insee_codes" in constraint and insee_code not in constraint["insee_codes"]: @@ -53,7 +53,7 @@ def refine_with_housing_criteria(flats_list, constraint): flat["id"], ", ".join(constraint["insee_codes"]), ) - is_ok[i] = is_ok[i] and False + is_ok[i] = False # Check time_to for place_name, time in flat["flatisfy"].get("time_to", {}).items(): diff --git a/flatisfy/filters/metadata.py b/flatisfy/filters/metadata.py index 57a2baa..64cfd16 100644 --- a/flatisfy/filters/metadata.py +++ b/flatisfy/filters/metadata.py @@ -76,10 +76,10 @@ def fuzzy_match(query, choices, limit=3, threshold=75): Example:: - >>> match("Paris 14ème", ["Ris", "ris", "Paris 14"], limit=1) + >>> fuzzy_match("Paris 14ème", ["Ris", "ris", "Paris 14"], limit=1) [("Paris 14", 100) - >>> match( \ + >>> fuzzy_match( \ "Saint-Jacques, Denfert-Rochereau (Colonel Rol-Tanguy), " \ "Mouton-Duvernet", \ ["saint-jacques", "denfert rochereau", "duvernet", "toto"], \ @@ -212,7 +212,7 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000): assert postal_code in [x.postal_code for x in opendata["postal_codes"]] LOGGER.debug( - "Found postal code in location field for flat %s: %s.", + "Found postal code directly in location field for flat %s: %s.", flat["id"], postal_code, ) @@ -274,6 +274,14 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000): if position: flat["flatisfy"]["position"] = position + LOGGER.debug( + "found postal_code=%s insee_code=%s position=%s for flat %s (%s).", + postal_code, + insee_code, + position, + flat["id"], + location, + ) return flats_list