Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions openaddr/conform.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,17 +885,17 @@ def row_fxn_regexp(sc, row, key, fxn):
replace = fxn.get('replace', False)
if replace:
match = re.sub(pattern, convert_regexp_replace(replace), row[fxn["field"]])
row["oa:{}".format(key)] = match;
row["oa:{}".format(key)] = match
else:
match = pattern.search(row[fxn["field"]])
row["oa:{}".format(key)] = ''.join(match.groups()) if match else '';
row["oa:{}".format(key)] = ''.join(match.groups()) if match else ''
return row

def row_fxn_prefixed_number(sc, row, key, fxn):
"Extract '123' from '123 Maple St'"

match = prefixed_number_pattern.search(row[fxn["field"]])
row["oa:{}".format(key)] = ''.join(match.groups()) if match else '';
row["oa:{}".format(key)] = ''.join(match.groups()) if match else ''

return row

Expand All @@ -909,15 +909,15 @@ def row_fxn_postfixed_street(sc, row, key, fxn):
else:
match = postfixed_street_pattern.search(row[fxn["field"]])

row["oa:{}".format(key)] = ''.join(match.groups()) if match else '';
row["oa:{}".format(key)] = ''.join(match.groups()) if match else ''

return row

def row_fxn_postfixed_unit(sc, row, key, fxn):
"Extract 'Suite 300' from '123 Maple St Suite 300'"

match = postfixed_unit_pattern.search(row[fxn["field"]])
row["oa:{}".format(key)] = ''.join(match.groups()) if match else '';
row["oa:{}".format(key)] = ''.join(match.groups()) if match else ''

return row

Expand Down
2 changes: 1 addition & 1 deletion openaddr/process_one.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import absolute_import, division, print_function
import logging;
import logging

_L = logging.getLogger('openaddr.process_one')

Expand Down
6 changes: 3 additions & 3 deletions openaddr/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,9 +1048,9 @@ def test_single_wy_park(self):
self.assertEqual(rows[0]['properties']['number'], u'162')
self.assertEqual(rows[0]['properties']['hash'], u'0488f0771f0ff30f')
self.assertEqual(rows[0]['properties']['city'], u'')
self.assertEqual(rows[0]['geometry']['type'], 'Point');
self.assertAlmostEqual(rows[0]['geometry']['coordinates'][0], -108.7563613);
self.assertAlmostEqual(rows[0]['geometry']['coordinates'][1], 44.7538737);
self.assertEqual(rows[0]['geometry']['type'], 'Point')
self.assertAlmostEqual(rows[0]['geometry']['coordinates'][0], -108.7563613)
self.assertAlmostEqual(rows[0]['geometry']['coordinates'][1], 44.7538737)
self.assertEqual(rows[0]['properties']['street'], u'N CLARK ST')
self.assertEqual(rows[0]['properties']['postcode'], u'')
self.assertEqual(rows[0]['properties']['unit'], u'')
Expand Down
2 changes: 1 addition & 1 deletion openaddr/tests/conform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@ def test_srs(self):
r = self._convert(c, d)
self.assertEqual(r[0], u'n,s,{GEOM_FIELDNAME}'.format(**globals()))

r = r[1].split(',');
r = r[1].split(',')
self.assertEquals(r[0], '3203')
self.assertEquals(r[1], 'SE WOODSTOCK BLVD')

Expand Down