Skip to content

Commit b81cc3a

Browse files
committed
Merge branch 'release/6.1.0'
2 parents 6f10e4c + 052c825 commit b81cc3a

File tree

6 files changed

+105
-28
lines changed

6 files changed

+105
-28
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
name: build
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
# TODO: Running the full matrix seems to make the US Census Geocoder
17+
# more likely to return errors; running a single one is more likely
18+
# to succeed. This is disabled temporarily. Tracking issue:
19+
# https://github.com/azavea/python-omgeo/issues/66
20+
# python-version: ["3.6", "3.7", "3.8"]
21+
python-version: ["3.8"]
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Cache dependencies
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.cache/pip
34+
key: pip-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}
35+
restore-keys: pip-
36+
37+
- name: Install packages
38+
run: pip install flake8
39+
40+
- name: Lint
41+
run: flake8
42+
43+
- name: Run tests
44+
run: python setup.py test
45+
env:
46+
BING_MAPS_API_KEY: ${{ secrets.BING_MAPS_API_KEY }}
47+
ESRI_CLIENT_ID: ${{ secrets.ESRI_CLIENT_ID }}
48+
ESRI_CLIENT_SECRET: ${{ secrets.ESRI_CLIENT_SECRET }}
49+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
50+
MAPQUEST_API_KEY: ${{ secrets.MAPQUEST_API_KEY }}
51+
PELIAS_API_KEY: ${{ secrets.PELIAS_API_KEY }}
52+

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
release:
10+
name: release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout commit and fetch tag history
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Python 3.x
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Install release dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install setuptools wheel twine
27+
28+
- name: Build and publish package
29+
env:
30+
TWINE_USERNAME: ${{ secrets.PYPI_AZAVEA_USERNAME }}
31+
TWINE_PASSWORD: ${{ secrets.PYPI_AZAVEA_PASSWORD }}
32+
run: |
33+
python setup.py sdist bdist_wheel
34+
twine upload dist/*

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ v6.0.3, 2019-10-14
222222
v6.0.4, 2019-12-19
223223
------------------
224224
* Fix template string error in AttrListIncludes and AttrListExcludes __repr__
225+
226+
v6.1.0, 2021-07-20
227+
------------------
228+
* Populate match_region using RegionAbbr rather than Region from EsriWGS. For
229+
example, when using the EsriWGS geocoder, expect 'PA' rather than
230+
'Pennsylvania' in match_region.

omgeo/services/esri.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _geocode(self, pq):
126126
# 'AddBldg',
127127
'City',
128128
'Subregion',
129-
'Region',
129+
'RegionAbbr',
130130
'Postal',
131131
'Country',
132132
# 'Ymax',
@@ -205,7 +205,7 @@ def _geocode(self, pq):
205205

206206
# Optional address component fields.
207207
for in_key, out_key in [('City', 'match_city'), ('Subregion', 'match_subregion'),
208-
('Region', 'match_region'), ('Postal', 'match_postal'),
208+
('RegionAbbr', 'match_region'), ('Postal', 'match_postal'),
209209
('Country', 'match_country')]:
210210
setattr(c, out_key, attributes.get(in_key, ''))
211211
setattr(c, 'match_streetaddr', self._street_addr_from_response(attributes))

omgeo/tests/tests.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def setUp(self):
128128
if MAPQUEST_API_KEY is not None: # MapQuest's open Nominatime API now also requires a key
129129
self.g_nom = Geocoder([['omgeo.services.Nominatim', {}]])
130130

131-
self.g_census = Geocoder([['omgeo.services.USCensus', {}]])
131+
self.g_census = Geocoder([['omgeo.services.USCensus', {'settings': {'timeout': 30}}]])
132132

133133
ESRI_WGS_LOCATOR_MAP = {'PointAddress': 'rooftop',
134134
'StreetAddress': 'interpolation',
@@ -224,6 +224,16 @@ def test_geocode_esri_wgs_auth(self):
224224
candidates = self.g_esri_wgs_auth.get_candidates(self.pq['azavea'])
225225
self.assertOneCandidate(candidates)
226226

227+
def test_esri_short_region(self):
228+
"""Ensure that Esri uses region abbreviations"""
229+
candidate = self.g_esri_wgs.get_candidates(self.pq["azavea"])[0]
230+
self.assertEqual(candidate.match_region, "PA")
231+
232+
def test_google_short_region(self):
233+
"""Ensure that Google uses region abbreviations"""
234+
candidate = self.g_google.get_candidates(self.pq["azavea"])[0]
235+
self.assertEqual(candidate.match_region, "PA")
236+
227237
@unittest.skipIf(BING_MAPS_API_KEY is None, BING_KEY_REQUIRED_MSG)
228238
def test_geocode_bing(self):
229239
"""Test Azavea's address using Bing geocoder"""

0 commit comments

Comments
 (0)