Add debug logs
This commit is contained in:
parent
9f328259a7
commit
7790eb0a32
@ -113,7 +113,8 @@ def main():
|
|||||||
# Set logger
|
# Set logger
|
||||||
if args.vv:
|
if args.vv:
|
||||||
logging.getLogger("").setLevel(logging.DEBUG)
|
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:
|
elif args.verbose:
|
||||||
logging.getLogger("").setLevel(logging.INFO)
|
logging.getLogger("").setLevel(logging.INFO)
|
||||||
# sqlalchemy INFO level is way too loud, just stick with WARNING
|
# sqlalchemy INFO level is way too loud, just stick with WARNING
|
||||||
|
@ -174,7 +174,7 @@ def _preprocess_laposte():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
except KeyError:
|
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
|
return postal_codes_data
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ def refine_with_housing_criteria(flats_list, constraint):
|
|||||||
flat["id"],
|
flat["id"],
|
||||||
", ".join(constraint["postal_codes"]),
|
", ".join(constraint["postal_codes"]),
|
||||||
)
|
)
|
||||||
is_ok[i] = is_ok[i] and False
|
is_ok[i] = False
|
||||||
# Check insee code
|
# Check insee code
|
||||||
insee_code = flat["flatisfy"].get("insee_code", None)
|
insee_code = flat["flatisfy"].get("insee_code", None)
|
||||||
if insee_code and "insee_codes" in constraint and insee_code not in constraint["insee_codes"]:
|
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"],
|
flat["id"],
|
||||||
", ".join(constraint["insee_codes"]),
|
", ".join(constraint["insee_codes"]),
|
||||||
)
|
)
|
||||||
is_ok[i] = is_ok[i] and False
|
is_ok[i] = False
|
||||||
|
|
||||||
# Check time_to
|
# Check time_to
|
||||||
for place_name, time in flat["flatisfy"].get("time_to", {}).items():
|
for place_name, time in flat["flatisfy"].get("time_to", {}).items():
|
||||||
|
@ -76,10 +76,10 @@ def fuzzy_match(query, choices, limit=3, threshold=75):
|
|||||||
|
|
||||||
Example::
|
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)
|
[("Paris 14", 100)
|
||||||
|
|
||||||
>>> match( \
|
>>> fuzzy_match( \
|
||||||
"Saint-Jacques, Denfert-Rochereau (Colonel Rol-Tanguy), " \
|
"Saint-Jacques, Denfert-Rochereau (Colonel Rol-Tanguy), " \
|
||||||
"Mouton-Duvernet", \
|
"Mouton-Duvernet", \
|
||||||
["saint-jacques", "denfert rochereau", "duvernet", "toto"], \
|
["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"]]
|
assert postal_code in [x.postal_code for x in opendata["postal_codes"]]
|
||||||
|
|
||||||
LOGGER.debug(
|
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"],
|
flat["id"],
|
||||||
postal_code,
|
postal_code,
|
||||||
)
|
)
|
||||||
@ -274,6 +274,14 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000):
|
|||||||
|
|
||||||
if position:
|
if position:
|
||||||
flat["flatisfy"]["position"] = 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
|
return flats_list
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user