[Python-modules-commits] [geopy] 01/06: Import geopy_1.11.0+ds1.orig.tar.gz

Daniele Tricoli eriol-guest at moszumanska.debian.org
Fri Nov 6 15:34:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

eriol-guest pushed a commit to branch master
in repository geopy.

commit 9ea482b25e29611285d36c86bb79a9371fe1fd7d
Author: Daniele Tricoli <eriol at mornie.org>
Date:   Fri Nov 6 15:10:34 2015 +0100

    Import geopy_1.11.0+ds1.orig.tar.gz
---
 LICENSE                                    |   3 +-
 PKG-INFO                                   |   9 +-
 README                                     |  23 +-
 geopy.egg-info/PKG-INFO                    |   9 +-
 geopy.egg-info/SOURCES.txt                 |  18 +-
 geopy.egg-info/pbr.json                    |   1 +
 geopy.egg-info/top_level.txt               |   2 +-
 geopy/__init__.py                          |   6 +-
 geopy/__init__.pyc                         | Bin 602 -> 0 bytes
 geopy/compat.py                            |  55 ++-
 geopy/compat.pyc                           | Bin 1764 -> 0 bytes
 geopy/distance.py                          |  28 +-
 geopy/distance.pyc                         | Bin 16468 -> 0 bytes
 geopy/exc.pyc                              | Bin 4006 -> 0 bytes
 geopy/format.pyc                           | Bin 4453 -> 0 bytes
 geopy/geocoders/__init__.py                |  31 +-
 geopy/geocoders/__init__.pyc               | Bin 5644 -> 0 bytes
 geopy/geocoders/arcgis.py                  |  10 +-
 geopy/geocoders/arcgis.pyc                 | Bin 8525 -> 0 bytes
 geopy/geocoders/baidu.py                   |   3 +-
 geopy/geocoders/baidu.pyc                  | Bin 6741 -> 0 bytes
 geopy/geocoders/base.py                    |  34 +-
 geopy/geocoders/base.pyc                   | Bin 5110 -> 0 bytes
 geopy/geocoders/bing.py                    |  80 ++++-
 geopy/geocoders/bing.pyc                   | Bin 6291 -> 0 bytes
 geopy/geocoders/databc.py                  | 115 ++++++
 geopy/geocoders/dot_us.py                  |   5 +-
 geopy/geocoders/dot_us.pyc                 | Bin 5139 -> 0 bytes
 geopy/geocoders/geocodefarm.py             |  82 +++--
 geopy/geocoders/geocodefarm.pyc            | Bin 6112 -> 0 bytes
 geopy/geocoders/geonames.py                |  11 +-
 geopy/geocoders/geonames.pyc               | Bin 5853 -> 0 bytes
 geopy/geocoders/googlev3.py                |  44 ++-
 geopy/geocoders/googlev3.pyc               | Bin 11603 -> 0 bytes
 geopy/geocoders/ignfrance.py               | 541 +++++++++++++++++++++++++++++
 geopy/geocoders/mapquest.py                | 131 -------
 geopy/geocoders/mapquest.pyc               | Bin 4659 -> 0 bytes
 geopy/geocoders/navidata.py                | 197 +++++++++++
 geopy/geocoders/opencage.py                |   7 +-
 geopy/geocoders/opencage.pyc               | Bin 7115 -> 0 bytes
 geopy/geocoders/openmapquest.py            |   3 +-
 geopy/geocoders/openmapquest.pyc           | Bin 4399 -> 0 bytes
 geopy/geocoders/osm.py                     |  33 +-
 geopy/geocoders/osm.pyc                    | Bin 8175 -> 0 bytes
 geopy/geocoders/photon.py                  | 225 ++++++++++++
 geopy/geocoders/placefinder.py             |  19 +-
 geopy/geocoders/placefinder.pyc            | Bin 5894 -> 0 bytes
 geopy/geocoders/smartystreets.py           |  38 +-
 geopy/geocoders/smartystreets.pyc          | Bin 4848 -> 0 bytes
 geopy/geocoders/what3words.py              | 272 +++++++++++++++
 geopy/geocoders/{geonames.py => yandex.py} | 129 ++++---
 geopy/location.py                          |   4 +-
 geopy/location.pyc                         | Bin 4609 -> 0 bytes
 geopy/point.py                             |  17 +-
 geopy/point.pyc                            | Bin 12223 -> 0 bytes
 geopy/units.pyc                            | Bin 3154 -> 0 bytes
 geopy/util.py                              |  10 +
 geopy/util.pyc                             | Bin 2753 -> 0 bytes
 setup.py                                   |   9 +-
 59 files changed, 1849 insertions(+), 355 deletions(-)

diff --git a/LICENSE b/LICENSE
index f77cd82..7275f19 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,4 @@
-Copyright (c) 2006-2010 Brian Beck
-Copyright (c) 2010-2014 GeoPy Project and individual contributors
+Copyright (c) 2006-2015 geopy authors (see AUTHORS)
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
diff --git a/PKG-INFO b/PKG-INFO
index 31c2c33..6da3a80 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: geopy
-Version: 1.3.0
+Version: 1.11.0
 Summary: Python Geocoding Toolbox
 Home-page: https://github.com/geopy/geopy
 Author: GeoPy Contributors
 Author-email: uijllji at gmail
 License: MIT
-Download-URL: https://github.com/geopy/geopy/archive/1.3.0.tar.gz
+Download-URL: https://github.com/geopy/geopy/archive/1.11.0.tar.gz
 Description: UNKNOWN
 Keywords: geocode geocoding gis geographical maps earth distance
 Platform: UNKNOWN
@@ -19,4 +19,9 @@ Classifier: Programming Language :: Python
 Classifier: Topic :: Scientific/Engineering :: GIS
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
diff --git a/README b/README
index 5d7a877..68002c2 100644
--- a/README
+++ b/README
@@ -19,9 +19,13 @@ ArcGIS <http://resources.arcgis.com/en/help/arcgis-rest-api/>`__,
 Maps <http://developer.baidu.com/map/webservice-geocoding.htm>`__, `Bing
 Maps API <http://www.microsoft.com/maps/developers/web.aspx>`__, `Yahoo!
 PlaceFinder <https://developer.yahoo.com/boss/geo/docs/>`__,
+`Yandex <http://api.yandex.com/maps/doc/intro/concepts/intro.xml>`__,
+`IGN
+France <http://api.ign.fr/tech-docs-js/fr/developpeur/search.html>`__,
 `GeoNames <http://www.geonames.org/>`__,
-`MapQuest <http://www.mapquestapi.com/geocoding/>`__,
+`NaviData <http://navidata.pl>`__,
 `OpenMapQuest <http://developer.mapquest.com/web/products/open/geocoding-service>`__,
+`What3Words <http://what3words.com/api/reference>`__,
 `OpenCage <http://geocoder.opencagedata.com/api.html>`__,
 `SmartyStreets <https://smartystreets.com/products/liveaddress-api>`__,
 `geocoder.us <http://geocoder.us/>`__, and
@@ -29,7 +33,10 @@ PlaceFinder <https://developer.yahoo.com/boss/geo/docs/>`__,
 various geocoder classes are located in
 `geopy.geocoders <https://github.com/geopy/geopy/tree/master/geopy/geocoders>`__.
 
-© GeoPy Project and individual contributors under the `MIT
+geopy is tested against CPython 2.7, CPython 3.2, CPython 3.4, PyPy, and
+PyPy3.
+
+© geopy contributors 2006-2015 (see AUTHORS) under the `MIT
 License <https://github.com/geopy/geopy/blob/master/LICENSE>`__.
 
 Installation
@@ -56,10 +63,10 @@ To geolocate a query to an address and coordinates:
     >>> location = geolocator.geocode("175 5th Avenue NYC")
     >>> print(location.address)
     Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
-    >>> print(location.latitude, location.longitude)
+    >>> print((location.latitude, location.longitude))
     (40.7410861, -73.9896297241625)
     >>> print(location.raw)
-    {u'place_id': u'9167009604', u'type': u'attraction', ...}
+    {'place_id': '9167009604', 'type': 'attraction', ...}
 
 To find the address corresponding to a set of coordinates:
 
@@ -70,10 +77,10 @@ To find the address corresponding to a set of coordinates:
     >>> location = geolocator.reverse("52.509669, 13.376294")
     >>> print(location.address)
     Potsdamer Platz, Mitte, Berlin, 10117, Deutschland, European Union
-    >>> print(location.latitude, location.longitude)
+    >>> print((location.latitude, location.longitude))
     (52.5094982, 13.3765983)
     >>> print(location.raw)
-    {u'place_id': u'654513', u'osm_type': u'node', ...}
+    {'place_id': '654513', 'osm_type': 'node', ...}
 
 Measuring Distance
 ------------------
@@ -94,7 +101,7 @@ Here's an example usage of Vincenty distance:
     >>> from geopy.distance import vincenty
     >>> newport_ri = (41.49008, -71.312796)
     >>> cleveland_oh = (41.499498, -81.695391)
-    >>> vincenty(newport_ri, cleveland_oh).miles
+    >>> print(vincenty(newport_ri, cleveland_oh).miles)
     538.3904451566326
 
 Using great-circle distance:
@@ -104,7 +111,7 @@ Using great-circle distance:
     >>> from geopy.distance import great_circle
     >>> newport_ri = (41.49008, -71.312796)
     >>> cleveland_oh = (41.499498, -81.695391)
-    >>> great_circle(newport_ri, cleveland_oh).miles
+    >>> print(great_circle(newport_ri, cleveland_oh).miles)
     537.1485284062816
 
 Documentation
diff --git a/geopy.egg-info/PKG-INFO b/geopy.egg-info/PKG-INFO
index 31c2c33..6da3a80 100644
--- a/geopy.egg-info/PKG-INFO
+++ b/geopy.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: geopy
-Version: 1.3.0
+Version: 1.11.0
 Summary: Python Geocoding Toolbox
 Home-page: https://github.com/geopy/geopy
 Author: GeoPy Contributors
 Author-email: uijllji at gmail
 License: MIT
-Download-URL: https://github.com/geopy/geopy/archive/1.3.0.tar.gz
+Download-URL: https://github.com/geopy/geopy/archive/1.11.0.tar.gz
 Description: UNKNOWN
 Keywords: geocode geocoding gis geographical maps earth distance
 Platform: UNKNOWN
@@ -19,4 +19,9 @@ Classifier: Programming Language :: Python
 Classifier: Topic :: Scientific/Engineering :: GIS
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
diff --git a/geopy.egg-info/SOURCES.txt b/geopy.egg-info/SOURCES.txt
index 94e361d..75dd473 100644
--- a/geopy.egg-info/SOURCES.txt
+++ b/geopy.egg-info/SOURCES.txt
@@ -21,9 +21,11 @@ geopy/units.py
 geopy/units.pyc
 geopy/util.py
 geopy/util.pyc
+geopy/version.pyc
 geopy.egg-info/PKG-INFO
 geopy.egg-info/SOURCES.txt
 geopy.egg-info/dependency_links.txt
+geopy.egg-info/pbr.json
 geopy.egg-info/requires.txt
 geopy.egg-info/top_level.txt
 geopy/geocoders/__init__.py
@@ -36,6 +38,8 @@ geopy/geocoders/base.py
 geopy/geocoders/base.pyc
 geopy/geocoders/bing.py
 geopy/geocoders/bing.pyc
+geopy/geocoders/databc.py
+geopy/geocoders/databc.pyc
 geopy/geocoders/dot_us.py
 geopy/geocoders/dot_us.pyc
 geopy/geocoders/geocodefarm.py
@@ -44,15 +48,23 @@ geopy/geocoders/geonames.py
 geopy/geocoders/geonames.pyc
 geopy/geocoders/googlev3.py
 geopy/geocoders/googlev3.pyc
-geopy/geocoders/mapquest.py
-geopy/geocoders/mapquest.pyc
+geopy/geocoders/ignfrance.py
+geopy/geocoders/ignfrance.pyc
+geopy/geocoders/navidata.py
+geopy/geocoders/navidata.pyc
 geopy/geocoders/opencage.py
 geopy/geocoders/opencage.pyc
 geopy/geocoders/openmapquest.py
 geopy/geocoders/openmapquest.pyc
 geopy/geocoders/osm.py
 geopy/geocoders/osm.pyc
+geopy/geocoders/photon.py
+geopy/geocoders/photon.pyc
 geopy/geocoders/placefinder.py
 geopy/geocoders/placefinder.pyc
 geopy/geocoders/smartystreets.py
-geopy/geocoders/smartystreets.pyc
\ No newline at end of file
+geopy/geocoders/smartystreets.pyc
+geopy/geocoders/what3words.py
+geopy/geocoders/what3words.pyc
+geopy/geocoders/yandex.py
+geopy/geocoders/yandex.pyc
\ No newline at end of file
diff --git a/geopy.egg-info/pbr.json b/geopy.egg-info/pbr.json
new file mode 100644
index 0000000..dc9c31d
--- /dev/null
+++ b/geopy.egg-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "cefd924"}
\ No newline at end of file
diff --git a/geopy.egg-info/top_level.txt b/geopy.egg-info/top_level.txt
index 8ae21a7..8c03329 100644
--- a/geopy.egg-info/top_level.txt
+++ b/geopy.egg-info/top_level.txt
@@ -1,2 +1,2 @@
-test
 geopy
+test
diff --git a/geopy/__init__.py b/geopy/__init__.py
index 5967138..6e544ed 100644
--- a/geopy/__init__.py
+++ b/geopy/__init__.py
@@ -4,11 +4,11 @@ geopy is a Python 2 and 3 client for several popular geocoding web services.
 geopy makes it easy for Python developers to locate the coordinates of
 addresses, cities, countries, and landmarks across the globe using third-party
 geocoders and other data sources.
+
+geopy is tested against CPython 2.7, CPython 3.2, CPython 3.4, PyPy, and PyPy3.
 """
 
 from geopy.point import Point
 from geopy.location import Location
 from geopy.geocoders import * # pylint: disable=W0401
-
-
-__version__ = "1.3.0"
+from geopy.util import __version__
diff --git a/geopy/__init__.pyc b/geopy/__init__.pyc
deleted file mode 100644
index 874e1a5..0000000
Binary files a/geopy/__init__.pyc and /dev/null differ
diff --git a/geopy/compat.py b/geopy/compat.py
index d878c59..54a4b4a 100644
--- a/geopy/compat.py
+++ b/geopy/compat.py
@@ -11,15 +11,51 @@ if py3k: # pragma: no cover
 else: # pragma: no cover
     string_compare = (str, unicode)
 
+# Unicode compatibility, borrowed from 'six'
+if py3k: # pragma: no cover
+    def u(s):
+        """
+        Convert to Unicode with py3k
+        """
+        return s
+else: # pragma: no cover
+    def u(s):
+        """
+        Convert to Unicode with unicode escaping
+        """
+        return unicode(s.replace(r'\\', r'\\\\'), 'unicode_escape')
+
 if py3k: # pragma: no cover
     from urllib.parse import urlencode, quote # pylint: disable=W0611,F0401,W0611,E0611
     from urllib.request import (Request, urlopen, # pylint: disable=W0611,F0401,W0611,E0611
-        build_opener, ProxyHandler, URLError, install_opener)
+                                build_opener, ProxyHandler,
+                                URLError, install_opener,
+                                HTTPPasswordMgrWithDefaultRealm,
+                                HTTPBasicAuthHandler)
     from urllib.error import HTTPError # pylint: disable=W0611,F0401,W0611,E0611
+
+    def itervalues(d):
+        """
+        Function for iterating on values due to methods
+        renaming between Python 2 and 3 versions
+        For Python2
+        """
+        return iter(d.values())
+    def iteritems(d):
+        """
+        Function for iterating on items due to methods
+        renaming between Python 2 and 3 versions
+        For Python2
+        """
+        return iter(d.items())
+
 else: # pragma: no cover
     from urllib import urlencode as original_urlencode, quote # pylint: disable=W0611,F0401,W0611,E0611
     from urllib2 import (Request, HTTPError,   # pylint: disable=W0611,F0401,W0611,E0611
-        ProxyHandler, URLError, urlopen, build_opener, install_opener)
+                         ProxyHandler, URLError, urlopen,
+                         build_opener, install_opener,
+                         HTTPPasswordMgrWithDefaultRealm,
+                         HTTPBasicAuthHandler)
 
     def force_str(str_or_unicode):
         """
@@ -46,3 +82,18 @@ else: # pragma: no cover
               if isinstance(v, (list, tuple)) else force_str(v))
              for k, v in query],
             doseq)
+
+    def itervalues(d):
+        """
+        Function for iterating on values due to methods
+        renaming between Python 2 and 3 versions
+        For Python3
+        """
+        return d.itervalues()
+    def iteritems(d):
+        """
+        Function for iterating on items due to methods
+        renaming between Python 2 and 3 versions
+        For Python3
+        """
+        return d.iteritems()
diff --git a/geopy/compat.pyc b/geopy/compat.pyc
deleted file mode 100644
index b372907..0000000
Binary files a/geopy/compat.pyc and /dev/null differ
diff --git a/geopy/distance.py b/geopy/distance.py
index e8abc57..3530148 100644
--- a/geopy/distance.py
+++ b/geopy/distance.py
@@ -22,9 +22,12 @@ accurate. geopy includes a few other
 models in the distance.ELLIPSOIDS dictionary::
 
                   model             major (km)   minor (km)     flattening
-    ELLIPSOIDS = {'WGS-84':        (6378.137,    6356.7523142,  1 / 298.257223563),
-                  'GRS-80':        (6378.137,    6356.7523141,  1 / 298.257222101),
-                  'Airy (1830)':   (6377.563396, 6356.256909,   1 / 299.3249646),
+    ELLIPSOIDS = {'WGS-84':        (6378.137,    6356.7523142,  1 / \
+                                                                298.257223563),
+                  'GRS-80':        (6378.137,    6356.7523141,  1 / \
+                                                                298.257222101),
+                  'Airy (1830)':   (6377.563396, 6356.256909,   1 / \
+                                                                299.3249646),
                   'Intl 1924':     (6378.388,    6356.911946,   1 / 297.0),
                   'Clarke (1880)': (6378.249145, 6356.51486955, 1 / 293.465),
                   'GRS-67':        (6378.1600,   6356.774719,   1 / 298.25),
@@ -35,7 +38,7 @@ Here's an example usage of distance.vincenty::
     >>> from geopy.distance import vincenty
     >>> newport_ri = (41.49008, -71.312796)
     >>> cleveland_oh = (41.499498, -81.695391)
-    >>> vincenty(newport_ri, cleveland_oh).miles
+    >>> print(vincenty(newport_ri, cleveland_oh).miles)
     538.3904451566326
 
 Using great-circle distance::
@@ -43,15 +46,16 @@ Using great-circle distance::
     >>> from geopy.distance import great_circle
     >>> newport_ri = (41.49008, -71.312796)
     >>> cleveland_oh = (41.499498, -81.695391)
-    >>> great_circle(newport_ri, cleveland_oh).miles
+    >>> print(great_circle(newport_ri, cleveland_oh).miles)
     537.1485284062816
 
 You can change the ellipsoid model used by the Vincenty formula like so::
 
     >>> distance.vincenty(ne, cl, ellipsoid='GRS-80').miles
 
-The above model name will automatically be retrieved from the ELLIPSOIDS dictionary.
-Alternatively, you can specify the model values directly::
+The above model name will automatically be retrieved from the
+ELLIPSOIDS dictionary. Alternatively, you can specify the model values
+directly::
 
     >>> distance.vincenty(ne, cl, ellipsoid=(6377., 6356., 1 / 297.)).miles
 
@@ -61,7 +65,7 @@ calculate the length of a path::
     >>> d = distance.distance
     >>> _, wa = g.geocode('Washington, DC')
     >>> _, pa = g.geocode('Palo Alto, CA')
-    >>> (d(ne, cl) + d(cl, wa) + d(wa, pa)).miles
+    >>> print((d(ne, cl) + d(cl, wa) + d(wa, pa)).miles)
     3276.157156868931
 
 """
@@ -147,6 +151,9 @@ class Distance(object):
     __bool__ = __nonzero__
 
     def measure(self, a, b):
+        """
+        Abstract method for measure
+        """
         raise NotImplementedError()
 
     def __repr__(self): # pragma: no cover
@@ -294,7 +301,7 @@ class vincenty(Distance):
         >>> from geopy.distance import vincenty
         >>> newport_ri = (41.49008, -71.312796)
         >>> cleveland_oh = (41.499498, -81.695391)
-        >>> vincenty(newport_ri, cleveland_oh).miles
+        >>> print(vincenty(newport_ri, cleveland_oh).miles)
         538.3904451566326
 
     Note: This implementation of Vincenty distance fails to converge for
@@ -474,7 +481,8 @@ class vincenty(Distance):
                     cos_sigma * (
                         -1 + 2 * cos2_sigma_m
                     ) - B / 6. * cos2_sigma_m * (
-                        -3 + 4 * sin_sigma ** 2) * (
+                        -3 + 4 * sin_sigma ** 2
+                    ) * (
                         -3 + 4 * cos2_sigma_m ** 2
                     )
                 )
diff --git a/geopy/distance.pyc b/geopy/distance.pyc
deleted file mode 100644
index 4d3ab1e..0000000
Binary files a/geopy/distance.pyc and /dev/null differ
diff --git a/geopy/exc.pyc b/geopy/exc.pyc
deleted file mode 100644
index 6d6e981..0000000
Binary files a/geopy/exc.pyc and /dev/null differ
diff --git a/geopy/format.pyc b/geopy/format.pyc
deleted file mode 100644
index bc1c328..0000000
Binary files a/geopy/format.pyc and /dev/null differ
diff --git a/geopy/geocoders/__init__.py b/geopy/geocoders/__init__.py
index 8b757d8..6a0d7b0 100644
--- a/geopy/geocoders/__init__.py
+++ b/geopy/geocoders/__init__.py
@@ -14,10 +14,10 @@ To geolocate a query to an address and coordinates:
     >>> location = geolocator.geocode("175 5th Avenue NYC")
     >>> print(location.address)
     Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
-    >>> print(location.latitude, location.longitude)
+    >>> print((location.latitude, location.longitude))
     (40.7410861, -73.9896297241625)
     >>> print(location.raw)
-    {u'place_id': u'9167009604', u'type': u'attraction', ...}
+    {'place_id': '9167009604', 'type': 'attraction', ...}
 
 
 To find the address corresponding to a set of coordinates:
@@ -27,10 +27,10 @@ To find the address corresponding to a set of coordinates:
     >>> location = geolocator.reverse("52.509669, 13.376294")
     >>> print(location.address)
     Potsdamer Platz, Mitte, Berlin, 10117, Deutschland, European Union
-    >>> print(location.latitude, location.longitude)
+    >>> print((location.latitude, location.longitude))
     (52.5094982, 13.3765983)
     >>> print(location.raw)
-    {u'place_id': u'654513', u'osm_type': u'node', ...}
+    {'place_id': '654513', 'osm_type': 'node', ...}
 
 Locators' ``geolocate`` and ``reverse`` methods require the argument ``query``,
 and also accept at least the argument ``exactly_one``, which is ``True``.
@@ -76,32 +76,43 @@ __all__ = (
     "ArcGIS",
     "Baidu",
     "Bing",
+    "DataBC",
     "GeocoderDotUS",
     "GeocodeFarm",
     "GeoNames",
     "GoogleV3",
-    "MapQuest",
+    "IGNFrance",
     "OpenCage",
     "OpenMapQuest",
+    "NaviData",
     "Nominatim",
     "YahooPlaceFinder",
     "LiveAddress",
+    'Yandex',
+    "What3Words",
+    "Photon",
 )
 
 
 from geopy.geocoders.arcgis import ArcGIS
 from geopy.geocoders.baidu import Baidu
 from geopy.geocoders.bing import Bing
+from geopy.geocoders.databc import DataBC
 from geopy.geocoders.dot_us import GeocoderDotUS
 from geopy.geocoders.geocodefarm import GeocodeFarm
 from geopy.geocoders.geonames import GeoNames
 from geopy.geocoders.googlev3 import GoogleV3
-from geopy.geocoders.mapquest import MapQuest
 from geopy.geocoders.opencage import OpenCage
 from geopy.geocoders.openmapquest import OpenMapQuest
+from geopy.geocoders.navidata import NaviData
 from geopy.geocoders.osm import Nominatim
 from geopy.geocoders.placefinder import YahooPlaceFinder
 from geopy.geocoders.smartystreets import LiveAddress
+from geopy.geocoders.what3words import What3Words
+from geopy.geocoders.yandex import Yandex
+from geopy.geocoders.ignfrance import IGNFrance
+from geopy.geocoders.photon import Photon
+
 
 from geopy.exc import GeocoderNotFound
 
@@ -109,6 +120,8 @@ from geopy.exc import GeocoderNotFound
 SERVICE_TO_GEOCODER = {
     "arcgis": ArcGIS,
     "baidu": Baidu,
+    "bing": Bing,
+    "databc": DataBC,
     "google": GoogleV3,
     "googlev3": GoogleV3,
     "geocoderdotus": GeocoderDotUS,
@@ -117,10 +130,14 @@ SERVICE_TO_GEOCODER = {
     "placefinder": YahooPlaceFinder,
     "opencage": OpenCage,
     "openmapquest": OpenMapQuest,
-    "mapquest": MapQuest,
     "liveaddress": LiveAddress,
+    "navidata": NaviData,
     "nominatim": Nominatim,
     "geocodefarm": GeocodeFarm,
+    "what3words": What3Words,
+    "yandex": Yandex,
+    "ignfrance": IGNFrance,
+    "photon": Photon
 }
 
 
diff --git a/geopy/geocoders/__init__.pyc b/geopy/geocoders/__init__.pyc
deleted file mode 100644
index a510480..0000000
Binary files a/geopy/geocoders/__init__.pyc and /dev/null differ
diff --git a/geopy/geocoders/arcgis.py b/geopy/geocoders/arcgis.py
index 78dd0d2..420366f 100644
--- a/geopy/geocoders/arcgis.py
+++ b/geopy/geocoders/arcgis.py
@@ -29,7 +29,8 @@ class ArcGIS(Geocoder):  # pylint: disable=R0921,R0902,W0223
 
     def __init__(self, username=None, password=None, referer=None, # pylint: disable=R0913
                  token_lifetime=60, scheme=DEFAULT_SCHEME,
-                 timeout=DEFAULT_TIMEOUT, proxies=None):
+                 timeout=DEFAULT_TIMEOUT, proxies=None,
+                user_agent=None):
         """
         Create a ArcGIS-based geocoder.
 
@@ -63,7 +64,7 @@ class ArcGIS(Geocoder):  # pylint: disable=R0921,R0902,W0223
             :class:`urllib2.ProxyHandler`.
         """
         super(ArcGIS, self).__init__(
-            scheme=scheme, timeout=timeout, proxies=proxies
+            scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent
         )
         if username or password or referer:
             if not (username and password and referer):
@@ -155,7 +156,7 @@ class ArcGIS(Geocoder):  # pylint: disable=R0921,R0902,W0223
         return geocoded
 
     def reverse(self, query, exactly_one=True, timeout=None, # pylint: disable=R0913,W0221
-                        distance=None, wkid=DEFAULT_WKID):
+                distance=None, wkid=DEFAULT_WKID):
         """
         Given a point, find an address.
 
@@ -196,7 +197,8 @@ class ArcGIS(Geocoder):  # pylint: disable=R0921,R0902,W0223
                 self.retry += 1
                 self._refresh_authentication_token()
                 return self.reverse(query, exactly_one=exactly_one,
-                        timeout=timeout, distance=distance, wkid=wkid)
+                                    timeout=timeout, distance=distance,
+                                    wkid=wkid)
             raise GeocoderServiceError(str(response['error']))
         address = (
             "%(Address)s, %(City)s, %(Region)s %(Postal)s,"
diff --git a/geopy/geocoders/arcgis.pyc b/geopy/geocoders/arcgis.pyc
deleted file mode 100644
index 781fe6f..0000000
Binary files a/geopy/geocoders/arcgis.pyc and /dev/null differ
diff --git a/geopy/geocoders/baidu.py b/geopy/geocoders/baidu.py
index c72a0df..0fd1cc6 100644
--- a/geopy/geocoders/baidu.py
+++ b/geopy/geocoders/baidu.py
@@ -28,6 +28,7 @@ class Baidu(Geocoder):
             scheme='http',
             timeout=DEFAULT_TIMEOUT,
             proxies=None,
+            user_agent=None
         ):
         """
         Initialize a customized Baidu geocoder using the v2 API.
@@ -47,7 +48,7 @@ class Baidu(Geocoder):
             :class:`urllib2.ProxyHandler`.
         """
         super(Baidu, self).__init__(
-            scheme=scheme, timeout=timeout, proxies=proxies
+            scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent
         )
         self.api_key = api_key
         self.scheme = scheme
diff --git a/geopy/geocoders/baidu.pyc b/geopy/geocoders/baidu.pyc
deleted file mode 100644
index e46efed..0000000
Binary files a/geopy/geocoders/baidu.pyc and /dev/null differ
diff --git a/geopy/geocoders/base.py b/geopy/geocoders/base.py
index b6b499f..8cadf5e 100644
--- a/geopy/geocoders/base.py
+++ b/geopy/geocoders/base.py
@@ -15,6 +15,7 @@ from geopy.compat import (
     ProxyHandler,
     URLError,
     install_opener,
+    Request,
 )
 from geopy.point import Point
 from geopy.exc import (
@@ -28,7 +29,7 @@ from geopy.exc import (
     GeocoderUnavailable,
     GeocoderParseError,
 )
-from geopy.util import decode_page
+from geopy.util import decode_page, __version__
 
 
 __all__ = (
@@ -44,6 +45,8 @@ DEFAULT_FORMAT_STRING = '%s'
 DEFAULT_SCHEME = 'https'
 DEFAULT_TIMEOUT = 1
 DEFAULT_WKID = 4326
+DEFAULT_USER_AGENT = "geopy/%s" % __version__
+
 
 ERROR_CODE_MAP = {
     400: GeocoderQueryError,
@@ -70,7 +73,8 @@ class Geocoder(object): # pylint: disable=R0921
             format_string=DEFAULT_FORMAT_STRING,
             scheme=DEFAULT_SCHEME,
             timeout=DEFAULT_TIMEOUT,
-            proxies=None
+            proxies=None,
+            user_agent=None
         ):
         """
         Mostly-common geocoder validation, proxies, &c. Not all geocoders
@@ -84,6 +88,7 @@ class Geocoder(object): # pylint: disable=R0921
             )
         self.proxies = proxies
         self.timeout = timeout
+        self.headers = {'User-Agent': user_agent or DEFAULT_USER_AGENT}
 
         if self.proxies:
             install_opener(
@@ -120,6 +125,7 @@ class Geocoder(object): # pylint: disable=R0921
             timeout=None,
             raw=False,
             requester=None,
+            deserializer=json.loads,
             **kwargs
         ):
         """
@@ -127,8 +133,14 @@ class Geocoder(object): # pylint: disable=R0921
         """
         requester = requester or self.urlopen
 
+        if not requester:
+            req = Request(url=url, headers=self.headers)
+        else:
+            # work around for placefinder's use of requests
+            req = url
+
         try:
-            page = requester(url, timeout=(timeout or self.timeout), **kwargs)
+            page = requester(req, timeout=(timeout or self.timeout), **kwargs)
         except Exception as error: # pylint: disable=W0703
             message = (
                 str(error) if not py3k
@@ -171,12 +183,16 @@ class Geocoder(object): # pylint: disable=R0921
             return page
 
         page = decode_page(page)
-        try:
-            return json.loads(page)
-        except ValueError:
-            raise GeocoderParseError(
-                "Could not deserialize from JSON:\n%s" % page
-            )
+
+        if deserializer is not None:
+            try:
+                return deserializer(page)
+            except ValueError:
+                raise GeocoderParseError(
+                    "Could not deserialize using deserializer:\n%s" % page
+                )
+        else:
+            return page
 
     def geocode(self, query, exactly_one=True, timeout=None):
         """
diff --git a/geopy/geocoders/base.pyc b/geopy/geocoders/base.pyc
deleted file mode 100644
index 850a269..0000000
Binary files a/geopy/geocoders/base.pyc and /dev/null differ
diff --git a/geopy/geocoders/bing.py b/geopy/geocoders/bing.py
index 6f3fdaa..cdac006 100644
--- a/geopy/geocoders/bing.py
+++ b/geopy/geocoders/bing.py
@@ -6,6 +6,13 @@ from geopy.compat import urlencode
 from geopy.geocoders.base import Geocoder, DEFAULT_FORMAT_STRING, \
     DEFAULT_TIMEOUT, DEFAULT_SCHEME
 from geopy.location import Location
+from geopy.exc import (
+    GeocoderAuthenticationFailure,
+    GeocoderQuotaExceeded,
+    GeocoderInsufficientPrivileges,
+    GeocoderUnavailable,
+    GeocoderServiceError,
+)
 from geopy.util import logger, join_filter
 
 
@@ -18,6 +25,14 @@ class Bing(Geocoder):
         https://msdn.microsoft.com/en-us/library/ff701715.aspx
     """
 
+    structured_query_params = {
+        'addressLine',
+        'locality',
+        'adminDistrict',
+        'countryRegion',
+        'postalCode',
+    }
+
     def __init__(
             self,
             api_key,
@@ -25,6 +40,7 @@ class Bing(Geocoder):
             scheme=DEFAULT_SCHEME,
             timeout=DEFAULT_TIMEOUT,
             proxies=None,
+            user_agent=None,
         ):  # pylint: disable=R0913
         """Initialize a customized Bing geocoder with location-specific
         address information and your Bing Maps API key.
@@ -55,7 +71,7 @@ class Bing(Geocoder):
 
             .. versionadded:: 0.96
         """
-        super(Bing, self).__init__(format_string, scheme, timeout, proxies)
+        super(Bing, self).__init__(format_string, scheme, timeout, proxies, user_agent=user_agent)
         self.api_key = api_key
         self.api = "%s://dev.virtualearth.net/REST/v1/Locations" % self.scheme
 
@@ -65,12 +81,19 @@ class Bing(Geocoder):
             exactly_one=True,
             user_location=None,
             timeout=None,
-            ):  # pylint: disable=W0221
+            culture=None,
+            include_neighborhood=None,
+            include_country_code=False
+        ):  # pylint: disable=W0221
         """
         Geocode an address.
 
         :param string query: The address or query you wish to geocode.
 
+            For a structured query, provide a dictionary whose keys
+            are one of: `addressLine`, `locality` (city), `adminDistrict` (state), `countryRegion`, or
+            `postalcode`.
+
         :param bool exactly_one: Return one result or a list of results, if
             available.
 
@@ -87,17 +110,48 @@ class Bing(Geocoder):
             only, the value set during the geocoder's initialization.
 
             .. versionadded:: 0.97
+
+        :param string culture: Affects the language of the response,
+            must be a two-letter country code.
+
+            .. versionadded:: 1.4.0
+
+        :param boolean include_neighborhood: Sets whether to include the
+            neighborhood field in the response.
+
+            .. versionadded:: 1.4.0
+
+        :param boolean include_country_code: Sets whether to include the
+            two-letter ISO code of the country in the response (field name
+            'countryRegionIso2').
+
+            .. versionadded:: 1.4.0
         """
-        params = {
-            'query': self.format_string % query,
-            'key': self.api_key
-        }
+        if isinstance(query, dict):
+            params = {
+                key: val
+                for key, val
+                in query.items()
+                if key in self.structured_query_params
+            }
+            params['key'] = self.api_key
+        else:
+            params = {
+                'query': self.format_string % query,
+                'key': self.api_key
+            }
         if user_location:
             params['userLocation'] = ",".join(
                 (str(user_location.latitude), str(user_location.longitude))
             )
         if exactly_one is True:
             params['maxResults'] = 1
+        if culture:
+            params['culture'] = culture
+        if include_neighborhood is not None:
+            params['includeNeighborhood'] = include_neighborhood
+        if include_country_code:
+            params['include'] = 'ciso2'  # the only acceptable value
 
         url = "?".join((self.api, urlencode(params)))
         logger.debug("%s.geocode: %s", self.__class__.__name__, url)
@@ -140,6 +194,20 @@ class Bing(Geocoder):
         """
         Parse a location name, latitude, and longitude from an JSON response.
         """
+        status_code = doc.get("statusCode", 200)
+        if status_code != 200:
+            err = doc.get("errorDetails", "")
+            if status_code == 401:
+                raise GeocoderAuthenticationFailure(err)
+            elif status_code == 403:
+                raise GeocoderInsufficientPrivileges(err)
+            elif status_code == 429:
+                raise GeocoderQuotaExceeded(err)
+            elif status_code == 503:
+                raise GeocoderUnavailable(err)
+            else:
+                raise GeocoderServiceError(err)
+
         resources = doc['resourceSets'][0]['resources']
         if resources is None or not len(resources): # pragma: no cover
             return None
diff --git a/geopy/geocoders/bing.pyc b/geopy/geocoders/bing.pyc
deleted file mode 100644
index d2a2389..0000000
Binary files a/geopy/geocoders/bing.pyc and /dev/null differ
diff --git a/geopy/geocoders/databc.py b/geopy/geocoders/databc.py
new file mode 100644
index 0000000..688e8d8
--- /dev/null
+++ b/geopy/geocoders/databc.py
@@ -0,0 +1,115 @@
+"""
+:class:`.DataBC` geocoder.
+"""
+
+from geopy.compat import urlencode
+
+from geopy.geocoders.base import Geocoder, DEFAULT_SCHEME, DEFAULT_TIMEOUT
+from geopy.exc import GeocoderQueryError
+from geopy.location import Location
+from geopy.util import logger
+
+
+__all__ = ("DataBC", )
+
+
+class DataBC(Geocoder):
+    """
+    Geocoder using the Physical Address Geocoder from DataBC. Documentation at:
+        http://www.data.gov.bc.ca/dbc/geographic/locate/geocoding.page
+    """
+
+    def __init__(self, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, user_agent=None):
+        """
+        Create a DataBC-based geocoder.
+
+        :param string scheme: Desired scheme.
+
+        :param int timeout: Time, in seconds, to wait for the geocoding service
+            to respond before raising a :class:`geopy.exc.GeocoderTimedOut`
+            exception.
+
+        :param dict proxies: If specified, routes this geocoder's requests
+            through the specified proxy. E.g., {"https": "192.0.2.0"}. For
+            more information, see documentation on
+            :class:`urllib2.ProxyHandler`.
+        """
+        super(DataBC, self).__init__(
+            scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent
+        )
+        self.api = '%s://apps.gov.bc.ca/pub/geocoder/addresses.geojson' % self.scheme
+
+    def geocode(
+            self,
+            query,
+            max_results=25,
+            set_back=0,
+            location_descriptor='any',
+            exactly_one=True,
+            timeout=None,
+        ):
+        """
+        Geocode a location query.
+
+        :param string query: The address or query you wish to geocode.
+
+        :param int max_results: The maximum number of resutls to request.
+
+        :param float set_back: The distance to move the accessPoint away
+            from the curb (in meters) and towards the interior of the parcel.
+            location_descriptor must be set to accessPoint for set_back to
+            take effect.
+
+        :param string location_descriptor: The type of point requested. It
+            can be any, accessPoint, frontDoorPoint, parcelPoint,
+            rooftopPoint and routingPoint.
+
+        :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.
+        """
+        params = {'addressString': query}
+        if set_back != 0:
+            params['setBack'] = set_back
+        if location_descriptor not in ['any',
+                                       'accessPoint',
+                                       'frontDoorPoint',
+                                       'parcelPoint',
+                                       'rooftopPoint',
+                                       'routingPoint']:
+            raise GeocoderQueryError(
+                "You did not provided a location_descriptor "
+                "the webservice can consume. It should be any, accessPoint, "
... 2498 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/geopy.git



More information about the Python-modules-commits mailing list