Skip to content

Commit

Permalink
Merge pull request #7 from bjlange/fix-import-errors
Browse files Browse the repository at this point in the history
Fix import errors
  • Loading branch information
bjlange authored Nov 8, 2019
2 parents 8793841 + 5830ddd commit b308207
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 28 deletions.
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,21 @@ coverage.xml
docs/_build/

# PyBuilder
target/
target/

### macOS ignores ###
# General
.DS_Store
.AppleDouble
.LSOverride

### VisualStudioCode ignores ###
.vscode/*
.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5"

# command to install dependencies
Expand All @@ -14,7 +10,7 @@ virtualenv:
system_site_packages: true

before_install:
- sudo apt-get install libgeos-dev libgdal1-dev
- sudo apt-get install libgdal1-dev

# command to run tests
script: nosetests
8 changes: 4 additions & 4 deletions neighborhoodize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# imports
import sys

import city_of_chicago
import nyc
import zillow
from . import city_of_chicago
from . import nyc
from . import zillow

from common import NeighborhoodMap, Neighborhood
from .common import NeighborhoodMap, Neighborhood


def main():
Expand Down
4 changes: 2 additions & 2 deletions neighborhoodize/city_of_chicago.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import kml_parsers
import constants
from . import kml_parsers
from . import constants

NEIGHBORHOODS = ("City of Chicago Neighborhoods",
os.path.join(constants.DATA_DIR, "city_of_chicago",
Expand Down
3 changes: 2 additions & 1 deletion neighborhoodize/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def get_neighborhoods(self, lat, lng):
if hood.polygon.contains(point)]
return hoods

def __init__(self, (map_name, filepath, parser_fn)):
def __init__(self, arg_tuple):
map_name, filepath, parser_fn = arg_tuple
self.name = map_name
self.neighborhoods = parser_fn(filepath)

Expand Down
2 changes: 1 addition & 1 deletion neighborhoodize/kml_parsers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import common
from . import common
import pygeoif
import shapely
from bs4 import BeautifulSoup
Expand Down
4 changes: 2 additions & 2 deletions neighborhoodize/nyc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import kml_parsers
import constants
from . import kml_parsers
from . import constants

NEIGHBORHOOD_TABULATION_AREAS = ("NYC Neighborhood Tabulation Areas",
os.path.join(constants.DATA_DIR, "nyc",
Expand Down
4 changes: 2 additions & 2 deletions neighborhoodize/zillow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import fiona
import shapely

import common
import constants
from . import common
from . import constants


def read_zillow_shapefile(filename):
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
nose
fiona
Shapely==1.5.7
beautifulsoup4==4.3.2
beautifulsoup4==4.8.1
fastkml==0.9
pygeoif==0.4.1
python-dateutil==2.4.2
six==1.9.0
wsgiref==0.1.2
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from distutils.core import setup

setup(name="Neighborhoodize",
version='0.9.5',
version='0.9.6',
description='Utility for translating lat, long coordinates into '
'neighborhoods in various cities',
author='Brian Lange',
author_email='brian.lange@datascopeanalytics.com',
author_email='thebrianlange@gmail.com',
url='https://github.com/bjlange/neighborhoodize',
download_url='https://github.com/bjlange/neighborhoodize/releases/tag/0.9.5',
download_url='https://github.com/bjlange/neighborhoodize/releases/tag/0.9.6',
packages=['neighborhoodize', ],
install_requires=[
"Shapely >= 1.5.7",
"beautifulsoup4 >= 4.3.2",
"beautifulsoup4 >= 4.4.0",
"fastkml >= 0.9",
"fiona >= 1.6.2"
],
Expand Down
8 changes: 4 additions & 4 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ def test_chicago_city():
params = neighborhoodize.city_of_chicago.NEIGHBORHOODS
chicago_map = neighborhoodize.NeighborhoodMap(params)

for (lat, lng), answer in known_chicago_pairs.iteritems():
for (lat, lng), answer in known_chicago_pairs.items():
assert chicago_map.get_neighborhoods(lat, lng) == answer

def test_nyc_city():
params = neighborhoodize.nyc.NEIGHBORHOOD_TABULATION_AREAS
nyc_map = neighborhoodize.NeighborhoodMap(params)

for (lat, lng), answer in known_city_nyc_pairs.iteritems():
for (lat, lng), answer in known_city_nyc_pairs.items():
assert nyc_map.get_neighborhoods(lat, lng) == answer

def test_chicago_zillow():
params = neighborhoodize.zillow.ILLINOIS
chicago_map = neighborhoodize.NeighborhoodMap(params)

for (lat, lng), answer in known_chicago_pairs.iteritems():
for (lat, lng), answer in known_chicago_pairs.items():
assert chicago_map.get_neighborhoods(lat, lng) == answer


def test_nyc_zillow():
params = neighborhoodize.zillow.NEW_YORK
nyc_map = neighborhoodize.NeighborhoodMap(params)

for (lat, lng), answer in known_zillow_nyc_pairs.iteritems():
for (lat, lng), answer in known_zillow_nyc_pairs.items():
assert nyc_map.get_neighborhoods(lat, lng) == answer

0 comments on commit b308207

Please sign in to comment.