From 72881ad3154b3bf66db115267fffc347162fd6fe Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 27 Jan 2017 19:20:41 -0500 Subject: [PATCH] [fix] conditional + var name --- scripts/geodata/openaddresses/formatter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/geodata/openaddresses/formatter.py b/scripts/geodata/openaddresses/formatter.py index 29d57c1f..857a7fd4 100644 --- a/scripts/geodata/openaddresses/formatter.py +++ b/scripts/geodata/openaddresses/formatter.py @@ -389,14 +389,14 @@ class OpenAddressesFormatter(object): if postcode: components[AddressFormatter.POSTCODE] = postcode elif AddressFormatter.POSTCODE in components: - component.pop(AddressFormatter.POSTCODE) + components.pop(AddressFormatter.POSTCODE) unit = components.get(AddressFormatter.UNIT, None) - street_not_required = country == Countries.JAPAN or country in Countries.FORMER_SOVIET_UNION_COUNTRIES + street_required = country != Countries.JAPAN and country not in Countries.FORMER_SOVIET_UNION_COUNTRIES # If there's a postcode, we can still use just the city/state/postcode, otherwise discard - if ((not street or street_not_required) and not house_number) or (street and house_number and (street.lower() == house_number.lower())) or (unit and street and street.lower() == unit.lower()): + if (not street and street_required and not house_number) or (street and house_number and (street.lower() == house_number.lower())) or (unit and street and street.lower() == unit.lower()): if not postcode: continue components = self.components.drop_address(components)