From 2c5c8337cc907e419277c0ef8e95f6eedb8c99ab Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Tue, 12 May 2026 10:01:25 +0000 Subject: [PATCH] added more type hints --- backend/address2UPRN/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/address2UPRN/main.py b/backend/address2UPRN/main.py index 642733a7..8832e157 100644 --- a/backend/address2UPRN/main.py +++ b/backend/address2UPRN/main.py @@ -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 +