Skip to content

Commit 1309c00

Browse files
committed
remove address parsing
1 parent 219e95f commit 1309c00

2 files changed

Lines changed: 5 additions & 27 deletions

File tree

geosupport/__init__.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from functools import partial
22
import sys
3-
import usaddress
4-
from usaddress import RepeatedLabelError, OrderedDict
53
from .work_area_layouts import format_input, parse_output, GeosupportError
64

75
FUNCTION_ALT_NAMES = {
@@ -93,29 +91,6 @@ def _call_geolib(self, flags, wa1, wa2):
9391

9492
return parse_output(flags, wa1, wa2)
9593

96-
@staticmethod
97-
def _parse_sfs(ad):
98-
"""
99-
Parses a single address input using the usaddress library. A work in progress.
100-
:param ad: usaddress parsed address
101-
:return: results
102-
"""
103-
try:
104-
if ad[0]:
105-
house_number = ad[0].get('AddressNumber', None)
106-
street_name = ad[0].get('StreetName', None)
107-
if 'StreetNamePreDirectional' in ad[0]:
108-
street_name = ad[0]['StreetNamePreDirectional'] + ' ' + street_name
109-
if 'StreetNamePreType' in ad[0]:
110-
street_name = ad[0]['StreetNamePreType'] + ' ' + street_name
111-
if 'StreetNamePostType' in ad[0]:
112-
street_name = street_name + ' ' + ad[0]['StreetNamePostType']
113-
zip_code = ad[0].get('ZipCode', None)
114-
city = ad[0].get('PlaceName', None)
115-
return {'houseNumber': house_number, 'streetName': street_name, 'zipCode': zip_code, 'city': city}
116-
except AttributeError as e:
117-
print(e)
118-
11994
def __getattr__(self, name):
12095
if name in FUNCTIONS:
12196
return partial(self.call, function=FUNCTIONS[name])
@@ -133,5 +108,8 @@ def call(self, kwargs_dict={}, **kwargs):
133108
result = self._call_geolib(flags, wa1, wa2)
134109
return_code = result['Geosupport Return Code (GRC)']
135110
if not return_code.isdigit() or int(return_code) > 1:
136-
raise GeosupportError(result['Message'] + ' ' + result['Message 2'], result)
111+
raise GeosupportError(
112+
result['Message'] + ' ' + result['Message 2'],
113+
result
114+
)
137115
return result

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
'Programming Language :: Python :: 3.6',
4747
],
4848
test_suite="tests",
49-
install_requires=['usaddress']
49+
install_requires=[]
5050
)

0 commit comments

Comments
 (0)