diff --git a/pyzipcode/__init__.py b/pyzipcode/__init__.py index da3b76b..70ed1f7 100644 --- a/pyzipcode/__init__.py +++ b/pyzipcode/__init__.py @@ -1,4 +1,4 @@ -from settings import db_location +from .settings import db_location try: import sqlite3 except ImportError: @@ -24,7 +24,7 @@ def query(self, sql, args): # then just give up... try: conn = sqlite3.connect(db_location) - except sqlite3.OperationalError, x: + except sqlite3.OperationalError as x: retry_count += 1 time.sleep(0.001) diff --git a/pyzipcode/import.py b/pyzipcode/import.py index f41eb24..4dd79ff 100644 --- a/pyzipcode/import.py +++ b/pyzipcode/import.py @@ -3,7 +3,7 @@ import os import csv try: - from settings import db_location + from .settings import db_location except: from pyzipcode.settings import db_location @@ -17,7 +17,7 @@ c.execute("CREATE INDEX state_index ON ZipCodes(state);") reader = csv.reader(open('zipcode.csv', "rb")) -reader.next() # prime it +next(reader) # prime it for row in reader: zip, city, state, lat, longt, timezone, dst = row diff --git a/pyzipcode/tests.py b/pyzipcode/tests.py index bc50831..8f41865 100644 --- a/pyzipcode/tests.py +++ b/pyzipcode/tests.py @@ -10,9 +10,9 @@ def setUp(self): def test_retrieves_zip_code_information(self): zip = self.db['54115'] - self.assertEquals(zip.zip, '54115') - self.assertEquals(zip.city, "De Pere") - self.assertEquals(zip.state, "WI") + self.assertEqual(zip.zip, '54115') + self.assertEqual(zip.city, "De Pere") + self.assertEqual(zip.state, "WI") def test_correct_longitude_value(self): zip = self.db[54115] @@ -24,11 +24,11 @@ def test_correct_latitude_value(self): def test_correct_timezone(self): zip = self.db[54115] - self.assertEquals(zip.timezone, -6) + self.assertEqual(zip.timezone, -6) def test_correct_dst(self): zip = self.db[54115] - self.assertEquals(zip.dst, 1) + self.assertEqual(zip.dst, 1) def test_radius(self): zips = self.db.get_zipcodes_around_radius('54115', 30) @@ -36,7 +36,7 @@ def test_radius(self): def test_find_zip_by_city(self): zip = self.db.find_zip(city="De Pere")[0] - self.assertEquals('54115', zip.zip) + self.assertEqual('54115', zip.zip) def test_find_zip_by_city_with_multiple_zips(self): zips = self.db.find_zip(city="Green Bay") diff --git a/setup.py b/setup.py index 9373d40..8d177ca 100644 --- a/setup.py +++ b/setup.py @@ -3,13 +3,6 @@ version = '0.4' -try: - import sqlite3 -except ImportError: - requires = ['pysqlite'] -else: - requires = [] - setup(name='pyzipcode', version=version, description="query zip codes and location data", @@ -24,7 +17,6 @@ package_data={'pyzipcode': ['zipcodes.db']}, include_package_data=True, zip_safe=False, - install_requires=requires, entry_points=""" # -*- Entry points: -*- """,