Skip to content

Commit

Permalink
Merge pull request #10 from andrewfulton9/master
Browse files Browse the repository at this point in the history
fixed type checking in find method so longitute is checked as opposed to latitude being checked twice
  • Loading branch information
MacHu-GWU authored Dec 27, 2017
2 parents 73c0553 + 093dbf6 commit d7f8624
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions uszipcode/searchengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def export_to_csv(self, res, abspath):
def _find_state(self, state, best_match=True):
"""Fuzzy search correct state.
:param best_match: bool, when True, only one state will return.
:param best_match: bool, when True, only one state will return.
otherwise, will return all matching states.
"""
result = list()
Expand Down Expand Up @@ -422,13 +422,13 @@ def _find_city(self, city, state=None, best_match=True):
:param city: city name.
:param state: search city in specified state.
:param best_match: bool, when True, only one city will return.
:param best_match: bool, when True, only one city will return.
otherwise, will return all matching cities.
**中文文档**
如果给定了state, 则只在state里的城市中寻找, 否则, 在全国所有的城市中
寻找。
寻找。
"""
# find out what is the city that user looking for
if state:
Expand Down Expand Up @@ -462,7 +462,7 @@ def by_zipcode(self, zipcode, standard_only=True):
"""Search zipcode information.
:param zipcode: integer or string zipcode, no zero pad needed
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
**中文文档**
Expand Down Expand Up @@ -491,10 +491,10 @@ def by_coordinate(self, lat, lng, radius=50.0, ascending=True, standard_only=Tru
:param lat: center latitude
:param lng: center lngitude
:param radius: for the inside implementation only, search zipcode
:param radius: for the inside implementation only, search zipcode
within #radius units of lat, lng
:param ascending: bool, if True, sort by distance from closest
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param returns: returns at most how many results
Expand All @@ -520,7 +520,7 @@ def by_city_and_state(self, city, state,
:param city: city name.
:param state: 2 letter short name or long name.
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -547,7 +547,7 @@ def by_city(self, city,
My engine use fuzzy match and guess what is the city you want.
:param city: city name.
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -574,7 +574,7 @@ def by_state(self, state,
fuzzy match and guess what is the state you want.
:param state: 2 letter short name or long name.
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -598,7 +598,7 @@ def by_prefix(self, prefix,
"""Search zipcode information by first N numbers.
:param prefix: first N zipcode number
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -623,7 +623,7 @@ def by_pattern(self, pattern,
"""Search zipcode by wildcard.
:param prefix: first N zipcode number
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -648,7 +648,7 @@ def by_population(self, lower=-1, upper=2**30,
:param lower: minimal population
:param upper: maximum population
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand Down Expand Up @@ -676,7 +676,7 @@ def by_density(self, lower=-1, upper=2**30,
:param lower: minimal population
:param upper: maximum population
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -702,7 +702,7 @@ def by_landarea(self, lower=-1, upper=2**30,
:param lower: minimal landarea in sqrt miles
:param upper: maximum landarea in sqrt miles
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -728,7 +728,7 @@ def by_waterarea(self, lower=-1, upper=2**30,
:param lower: minimal waterarea in sqrt miles
:param upper: maximum waterarea in sqrt miles
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -754,7 +754,7 @@ def by_totalwages(self, lower=-1, upper=2**30,
:param lower: minimal total annual wages
:param upper: maximum total annual wages
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand Down Expand Up @@ -782,7 +782,7 @@ def by_wealthy(self, lower=-1, upper=2**30,
:param lower: minimal AAW
:param upper: maximum AAW
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand All @@ -808,7 +808,7 @@ def by_house(self, lower=-1, upper=2**30,
:param lower: minimal house of units
:param upper: maximum house of units
:param standard_only: bool, default True, only returns standard
:param standard_only: bool, default True, only returns standard
type zipcode
:param sort_by: str or list of str, default ``"Zipcode"``
:param ascending: bool or list of bool, default True
Expand Down Expand Up @@ -848,7 +848,7 @@ def find(self,

#--- by_coordinate ---
if isinstance(lat, (integer_types, float)) and \
isinstance(lat, (integer_types, float)) and \
isinstance(lng, (integer_types, float)) and \
isinstance(radius, (integer_types, float)):
flag_by_coordinate = True
if radius <= 0:
Expand Down

0 comments on commit d7f8624

Please sign in to comment.