Skip to content

Commit be2f550

Browse files
authored
Merge pull request #63 from maxmind/andy/travis-runs-snyk
Travis runs snyk
2 parents a685c71 + 5444a67 commit be2f550

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ before_install:
3232
- sudo ldconfig
3333
- cd ..
3434
- pip install -e git+https://github.com/maxmind/MaxMind-DB-Reader-python#egg=maxminddb
35+
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi"
3536
install:
3637
- pip install -r requirements.txt
3738
- pip install requests_mock pylint coveralls yapf
38-
- "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install ipaddr; fi"
39+
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then snyk test --org=maxmind; fi"
3940
script:
4041
- coverage run --source=geoip2 setup.py test
4142
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then ./.travis-pylint.sh; fi"
4243
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then ./.travis-yapf.sh; fi"
4344
after_success:
4445
- coveralls
46+
- "if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' && $TRAVIS_PYTHON_VERSION == '3.7' ]]; then snyk monitor --org=maxmind --project=maxmind/GeoIP2-python; fi"
4547
notifications:
4648
email:
4749
on_failure: always
@@ -51,3 +53,7 @@ notifications:
5153
slack:
5254
rooms:
5355
secure: "FZLn7HZnM6GOtIU7+W6tY6zd2y0K4C1ZgIOAiGscWvJydn+Xr63GCT21EPPe9QCulQHz88CWALMD7ZrDdsh6nV0gx0IeE+wq4w7NZYjLokvxs+UMYwuwl57MMrqd7e4byZDC4BLvTQTCvpOHOd8dCHwDXmuBcuyE8zB+Wkndn0I=\n"
56+
57+
env:
58+
global:
59+
secure: "YUqALSGB89cWyKNiBKIZDxdWPl3xjYjkWx2OP1i53W5qcaKgOWco2jv+2iXTPAk3c5x3Py3J7B1SdiNcRWmjfKqrnE47fZYkiP8rk0c/pVMRw0zURpmtRzSReDF0Sh/1ZTODi2rsU52Ei1f++BTEB5m409RMnTEvQtH7XT2sVDk="

geoip2/records.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def __init__(self, locales=None, **kwargs):
5050
def name(self):
5151
"""Dict with locale codes as keys and localized name as value."""
5252
# pylint:disable=E1101
53-
return next((self.names.get(x) for x in self._locales
54-
if x in self.names), None)
53+
return next((self.names.get(x)
54+
for x in self._locales if x in self.names), None)
5555

5656

5757
class City(PlaceRecord):

tests/models_test.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,23 @@ def test_insights_full(self):
5656
'code': '55401',
5757
'confidence': 33,
5858
},
59-
'subdivisions': [{
60-
'confidence': 88,
61-
'geoname_id': 574635,
62-
'iso_code': 'MN',
63-
'names': {
64-
'en': 'Minnesota'
59+
'subdivisions': [
60+
{
61+
'confidence': 88,
62+
'geoname_id': 574635,
63+
'iso_code': 'MN',
64+
'names': {
65+
'en': 'Minnesota'
66+
},
6567
},
66-
}, {
67-
'geoname_id': 123,
68-
'iso_code': 'HP',
69-
'names': {
70-
'en': 'Hennepin'
68+
{
69+
'geoname_id': 123,
70+
'iso_code': 'HP',
71+
'names': {
72+
'en': 'Hennepin'
73+
},
7174
},
72-
}],
75+
],
7376
'registered_country': {
7477
'geoname_id': 2,
7578
'iso_code': 'CA',

0 commit comments

Comments
 (0)