Commits

Anonymous committed 037031a

Fixed setup.py.
Some pep8 cleaning.

  • Participants
  • Parent commits b2cc79b

Comments (0)

Files changed (4)

-================================================================
+==============
 pygeocoder 1.0
-----------------------------------------------------------------
+==============
 Xiao Yu
 19/12/2010
 
-based on googlemaps 1.0.2 by John Kleint
-================================================================
+*Based on googlemaps 1.0.2 by John Kleint*
 
 README
-------------
+------
 
 This is a Python wrapper for Google Geocoding API V3
 
 ------------
 Its only dependency is the json module, included with Python versions 2.6 and
 later and available for download as simplejson for earlier versions.
-It is developed on Python 2.7 but should work on earlier versions
+It is developed on Python 2.7 but should work on earlier versions.
 
 
 Installation
 	python setup.py install
 
 Usage
------------
+-----
 Please refer to http://code.xster.net/pygeocoder/wiki for help with usage
 
 
 
 Changelog
 ---------
+Version 1.1
+Added GeocoderResult in order to ease field retrieval/result parsing.
+
 Version 1.0
-Working version an API V3,
-
+Working version an API V3

File pygeocoder.py

 # it under the terms of the GNU Lesser General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
+
 """
 Python wrapper for Google Geocoding API V3.
 
 
 """
 
-
 import urllib
 import urllib2
 try:
     import simplejson as json
 
 
-VERSION = '1.0'
+VERSION = '1.1'
 __all__ = ['Geocoder', 'GeocoderError', 'GeocoderResult']
 
 
 Distutils setup script for pygeocoder module.
 """
 
+import os
+from distutils.core import setup
 
-from distutils.core import setup
-import sys
-
-sys.path.insert(0, 'pygeocoder')
 import pygeocoder
 
-
-setup(name='pygeocoder',
-      version=pygeocoder.VERSION,
-      author='Xiao Yu',
-      author_email='xiao@xiao-yu.com',
-      url='http://code.xster.net/pygeocoder',
-      download_url='https://bitbucket.org/xster/pygeocoder/downloads',
-      description='Python interface for Google Geocoding API V3.',
-      long_description=pygeocoder.Geocoder.__doc__,
-      package_dir={'': 'pygeocoder'},
-      py_modules=['pygeocoder'],
-      provides=['pygeocoder'],
-      requires=['simplejson'],
-      classifiers=['Development Status :: 4 - Beta',
-                   'Intended Audience :: Developers',
-                   'Natural Language :: English',
-                   'Operating System :: OS Independent',
-                   'Programming Language :: Python :: 2',
-                   'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
-                   'Topic :: Internet',
-                   'Topic :: Internet :: WWW/HTTP',
-                   'Topic :: Scientific/Engineering :: GIS',
-				   'Topic :: Software Development :: Libraries :: Python Modules',
-                  ],
-      keywords='google maps ajax api geocode geocoding address gps json',
-      license='Lesser General Public License v3',
-     )
+setup(
+    name='pygeocoder',
+    version=pygeocoder.VERSION,
+    author='Xiao Yu',
+    author_email='xiao@xiao-yu.com',
+    url='http://code.xster.net/pygeocoder',
+    download_url='https://bitbucket.org/xster/pygeocoder/downloads',
+    description='Python interface for Google Geocoding API V3.',
+    long_description=file(
+        os.path.join(os.path.dirname(__file__), 'README.txt')
+    ).read(),
+    py_modules=['pygeocoder'],
+    provides=['pygeocoder'],
+    requires=['simplejson'],
+    classifiers=[
+        'Development Status :: 4 - Beta',
+        'Intended Audience :: Developers',
+        'Natural Language :: English',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python :: 2',
+        'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
+        'Topic :: Internet',
+        'Topic :: Internet :: WWW/HTTP',
+        'Topic :: Scientific/Engineering :: GIS',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+    ],
+    keywords='google maps ajax api geocode geocoding address gps json',
+    license='Lesser General Public License v3',
+)
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 
-
 """
 Unit tests for pygeocoder.
 
 """
 
+import unittest
 
-import unittest
-import doctest
-    
-import pygeocoder
-from pygeocoder import Geocoder, GeocoderResult 
+from pygeocoder import Geocoder, GeocoderResult
 
 
 def searchkey(obj, key):
-    """Does BFS on JSON-like object `obj` to find a dict with a key == to `key` and 
-    returns the associated value.  Returns None if it didn't find `key`."""
+    """
+    Does BFS on JSON-like object `obj` to find a dict with a key == to `key`
+    and returns the associated value.  Returns None if it didn't find `key`.
+
+    """
     queue = [obj]
     while queue:
         item = queue.pop(0)
 
 
 class Test(unittest.TestCase):
-    """Unit tests for googlemaps."""
+    """
+    Unit tests for googlemaps.
 
+    """
     def test_geocode(self):
         """Test pygeocoder geocode() and address_to_latlng()"""
 
         self.assertAlmostEqual(lat, lat2, 3)
         self.assertAlmostEqual(lng, lng2, 3)
 
+    def test_reverse_geocode(self):
+        """
+        Test pygeocoder reverse_geocode() and latlng_to_address()
 
-    def test_reverse_geocode(self):
-        """Test pygeocoder reverse_geocode() and latlng_to_address()"""
-        
+        """
         lat, lng = 40.714224, -73.961452
         g = Geocoder()
         data = g.reverse_geocode(lat, lng)
         lat2, lng2 = result.location
         self.assertAlmostEquals(lat, lat2, 3)
         self.assertAlmostEquals(lng, lng2, 3)
-        
+
         addr2 = g.latlng_to_address(lat, lng)
         self.assertEqual(addr, addr2)
 
-        
+
 if __name__ == "__main__":
     unittest.main()