From 7434f2676de05451a5f7f45839970eb55fb917d4 Mon Sep 17 00:00:00 2001 From: shamsu07 Date: Tue, 13 Jun 2023 19:25:21 +0530 Subject: [PATCH 1/2] made changes to handle nonetypes --- surplus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/surplus.py b/surplus.py index d56bdb6..da9d8f5 100644 --- a/surplus.py +++ b/surplus.py @@ -206,7 +206,7 @@ def surplus( # location["address"].get("railway"), ( location["address"].get("building") - if ( + if (location["address"].get("building") and location["address"].get("building") != location["address"].get("house_number") ) @@ -222,7 +222,7 @@ def surplus( ", " + location["address"].get("suburb", "") # dont repeat if suburb is mentioned in the road itself # 'Toa Payoh' in 'Lorong 1A Toa Payoh' - if location["address"].get("suburb", "") + if location["address"].get("suburb", "") and location["address"].get("suburb", "") not in location["address"].get("road") else "" ) From 593286702af9a7abb14184c8487459e9a9edf97c Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Wed, 14 Jun 2023 14:27:23 +0000 Subject: [PATCH 2/2] code: format --- surplus.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/surplus.py b/surplus.py index da9d8f5..3d95219 100644 --- a/surplus.py +++ b/surplus.py @@ -206,7 +206,7 @@ def surplus( # location["address"].get("railway"), ( location["address"].get("building") - if (location["address"].get("building") and + if ( location["address"].get("building") != location["address"].get("house_number") ) @@ -222,8 +222,8 @@ def surplus( ", " + location["address"].get("suburb", "") # dont repeat if suburb is mentioned in the road itself # 'Toa Payoh' in 'Lorong 1A Toa Payoh' - if location["address"].get("suburb", "") and location["address"].get("suburb", "") - not in location["address"].get("road") + if location["address"].get("suburb", "") + not in location["address"].get("road", "") else "" ) ).strip(),