diff --git a/source/conf.py b/source/conf.py index 925cf48e7d..eba692f292 100644 --- a/source/conf.py +++ b/source/conf.py @@ -13,6 +13,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import uszipcode import sys import os import shlex @@ -67,9 +68,9 @@ # built documents. # # The short X.Y version. -version = '0.0.7' +version = uszipcode.__version__ # The full version, including alpha/beta/rc tags. -release = '0.0.7' +release = uszipcode.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/uszipcode/__init__.py b/uszipcode/__init__.py index e3369c8d9f..cc593f9e61 100644 --- a/uszipcode/__init__.py +++ b/uszipcode/__init__.py @@ -3,6 +3,6 @@ from .searchengine import ZipcodeSearchEngine -__version__ = "0.0.8" +__version__ = "0.0.9" __short_description__ = ("USA zipcode programmable database, includes " "up-to-date census and geometry information.") \ No newline at end of file diff --git a/uszipcode/searchengine.py b/uszipcode/searchengine.py index 93ccb7990c..d25c6cf39b 100644 --- a/uszipcode/searchengine.py +++ b/uszipcode/searchengine.py @@ -11,6 +11,7 @@ import math import json + class Zipcode(object): """Zipcode class. Attributes includes: @@ -79,6 +80,7 @@ def __bool__(self): _DEFAULT_LIMIT = 5 + class ZipcodeSearchEngine(object): """A fast, powerful index optimized zipcode object search engine class. @@ -183,8 +185,8 @@ def by_coordinate(self, lat, lng, radius=20, standard_only=True, # define lat lng boundary dist_btwn_lat_deg = 69.172 dist_btwn_lon_deg = math.cos(lat) * 69.172 - lat_degr_rad = radius * 1.0/dist_btwn_lat_deg - lon_degr_rad = radius * 1.0/dist_btwn_lon_deg + lat_degr_rad = abs(radius * 1.0/dist_btwn_lat_deg) + lon_degr_rad = abs(radius * 1.0/dist_btwn_lon_deg) lat_lower = lat - lat_degr_rad lat_upper = lat + lat_degr_rad diff --git a/uszipcode/zzz_manual_install.py b/uszipcode/zzz_manual_install.py index 70385676ea..c2b210ddf0 100644 --- a/uszipcode/zzz_manual_install.py +++ b/uszipcode/zzz_manual_install.py @@ -118,12 +118,16 @@ """ from __future__ import print_function, unicode_literals -import hashlib, site, shutil, os +import hashlib +import site +import shutil +import os _ROOT = os.getcwd() _PACKAGE_NAME = os.path.basename(_ROOT) _DST = os.path.join(site.getsitepackages()[1], _PACKAGE_NAME) - + + def md5_of_file(abspath): """Md5 value of a file. """ @@ -137,6 +141,7 @@ def md5_of_file(abspath): m.update(data) return m.hexdigest() + def check_need_install(): """Check if installed package are exactly the same to this one. """ @@ -153,7 +158,8 @@ def check_need_install(): else: return True return need_install_flag - + + def install(): """Manual install main script. """ @@ -164,18 +170,18 @@ def install(): print("\tpackage is up-to-date, no need to install.") return print("Difference been found, start installing ...") - + # remove __pycache__ folder and *.pyc file - print("Remove *.pyc file ...") + print("Remove *.pyc file ...") pyc_folder_list = list() for root, _, basename_list in os.walk(_ROOT): if os.path.basename(root) == "__pycache__": pyc_folder_list.append(root) - + for folder in pyc_folder_list: shutil.rmtree(folder) print("\tall *.pyc file has been removed.") - + # install this package to all python version print("Uninstall %s from %s ..." % (_PACKAGE_NAME, _DST)) try: @@ -183,10 +189,10 @@ def install(): print("\tSuccessfully uninstall %s" % _PACKAGE_NAME) except Exception as e: print("\t%s" % e) - + print("Install %s to %s ..." % (_PACKAGE_NAME, _DST)) - shutil.copytree(_ROOT, _DST) + shutil.copytree(_ROOT, _DST) print("\tComplete!") - + if __name__ == "__main__": install() \ No newline at end of file