mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added more type hints
This commit is contained in:
parent
e06ead55d0
commit
2c5c8337cc
1 changed files with 5 additions and 5 deletions
|
|
@ -68,15 +68,14 @@ def get_uprn_from_historic_epc(
|
|||
top: Optional[ScoredHistoricEpc] = result.top()
|
||||
if top is None:
|
||||
return None
|
||||
|
||||
return (uprn, top.record.address, top.lexiscore)
|
||||
return uprn, top.record.address, top.lexiscore
|
||||
|
||||
|
||||
def get_uprn_with_epc_df(
|
||||
user_inputed_address: str,
|
||||
epc_df: pd.DataFrame,
|
||||
verbose: bool = False,
|
||||
):
|
||||
) -> Optional[str | tuple[str, str, float]]:
|
||||
"""
|
||||
Return uprn (str) using a pre-fetched EPC dataframe.
|
||||
This avoids calling the API multiple times for the same postcode.
|
||||
|
|
@ -137,7 +136,7 @@ def get_uprn(
|
|||
"""
|
||||
df = get_epc_data_with_postcode(postcode=postcode)
|
||||
|
||||
result = get_uprn_with_epc_df(
|
||||
result: Optional[] = get_uprn_with_epc_df(
|
||||
user_inputed_address=user_inputed_address,
|
||||
epc_df=df,
|
||||
verbose=True,
|
||||
|
|
@ -445,7 +444,7 @@ def handler(event, context, local=False):
|
|||
continue
|
||||
|
||||
# Get UPRN using the pre-fetched EPC data with all return options
|
||||
result = get_uprn_with_epc_df(
|
||||
result: Optional[tuple[str, str, float]] = get_uprn_with_epc_df(
|
||||
user_inputed_address=address2uprn_user_input,
|
||||
epc_df=epc_df,
|
||||
verbose=True,
|
||||
|
|
@ -562,3 +561,4 @@ def handler(event, context, local=False):
|
|||
# Don't add results to return messages as its too verbose
|
||||
# capture the exepection as e, into s3, to find the logs go to s3
|
||||
# Upload results to s3 as well as csv
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue