From 84774c5a6387803d430952780a2796be3ec9b96e Mon Sep 17 00:00:00 2001 From: ijl Date: Wed, 25 Dec 2013 23:13:45 -0500 Subject: [PATCH] Docs and misc cleanup --- docs/index.rst | 3 ++- geopy/geocoders/arcgis.py | 15 +++++++++++++++ geopy/geocoders/placefinder.py | 4 +--- geopy/util.py | 5 ++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 5c6b011f1..2f58fb33d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -80,7 +80,8 @@ Logging geopy will log geocoding URLs with a logger name `geopy` at level `DEBUG`, and for some geocoders, these URLs will include authentication information. If this is a concern, one can disable this logging by specifying a logging -level of `NOTSET` for logger name `geopy`. +level of `NOTSET` or a level greater than `DEBUG` for logger name `geopy`. +geopy does no logging above DEBUG. Indices and search diff --git a/geopy/geocoders/arcgis.py b/geopy/geocoders/arcgis.py index cee653bb4..6e61e7184 100644 --- a/geopy/geocoders/arcgis.py +++ b/geopy/geocoders/arcgis.py @@ -98,6 +98,19 @@ def _authenticated_call_geocoder(self, url, timeout=None): return self._base_call_geocoder(request, timeout=timeout) def geocode(self, query, exactly_one=True, timeout=None): + """ + Geocode a location query. + + :param string query: The address or query you wish to geocode. + + :param bool exactly_one: Return one result or a list of results, if + available. + + :param int timeout: Time, in seconds, to wait for the geocoding service + to respond before raising a :class:`geopy.exc.GeocoderTimedOut` + exception. Set this only if you wish to override, on this call only, + the value set during the geocoder's initialization. + """ # TODO: dict as query for parameterized query # TODO: SRID params = {'text': query, 'f': 'json'} @@ -129,6 +142,8 @@ def geocode(self, query, exactly_one=True, timeout=None): def reverse(self, query, exactly_one=True, timeout=None, # pylint: disable=R0913,W0221 distance=None, wkid=DEFAULT_WKID): """ + Given a point, find an address. + :param query: The coordinates for which you wish to obtain the closest human-readable addresses. :type query: :class:`geopy.point.Point`, list or tuple of (latitude, diff --git a/geopy/geocoders/placefinder.py b/geopy/geocoders/placefinder.py index e77523673..3ef30df61 100644 --- a/geopy/geocoders/placefinder.py +++ b/geopy/geocoders/placefinder.py @@ -47,8 +47,6 @@ def __init__(self, consumer_key, consumer_secret, # pylint: disable=R0913 """ if oauth2 is None: raise ImportError('oauth2 is needed for YahooPlaceFinder') - if Request is None: - raise NotImplementedError("YahooPlaceFinder is not compatible with Py3k") super(YahooPlaceFinder, self).__init__(scheme=scheme, timeout=timeout, proxies=proxies) self.consumer_key = consumer_key self.consumer_secret = consumer_secret @@ -177,7 +175,7 @@ def geocode(self, query, min_quality=0, raw=False, reverse=False, # pylint: disa if not raw: results = [ - (YahooPlaceFinder.humanize(place), point) + (self.humanize(place), point) for (place, point) in results ] diff --git a/geopy/util.py b/geopy/util.py index f84f70b6d..48bcac28d 100644 --- a/geopy/util.py +++ b/geopy/util.py @@ -5,9 +5,9 @@ import logging from geopy.compat import py3k -try: +if not py3k: # pragma: no cover NUMBER_TYPES = (int, long, float) -except NameError: # pragma: no cover +else: # pragma: no cover NUMBER_TYPES = (int, float) # long -> int in Py3k try: from decimal import Decimal @@ -25,7 +25,6 @@ def emit(self, record): pass logger = logging.getLogger('geopy') # pylint: disable=C0103 -logger.addHandler(NullHandler()) def pairwise(seq):