maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Maposmatic-dev] [PATCH] Don't implicitely import most packages from


From: Thomas Petazzoni
Subject: Re: [Maposmatic-dev] [PATCH] Don't implicitely import most packages from the __init__.py
Date: Fri, 11 Sep 2009 23:52:17 +0200

Pulled and pushed, thanks!

Le Fri, 11 Sep 2009 23:26:19 +0200,
David Decotigny <address@hidden> a écrit :

> This patch removes almost everything from the __init__, since we
> don't want to merge symbols from submodules into the package. That
> way, we don't implicitely import almost all submodules when we import
> the package. This allows to use some ocitysmap submodules from
> outside ocitysmap without having to provide osgeo or mapnik support.
> --- ocitysmap-render      |   12 ++++++------ ocitysmap/__init__.py
> |    5 ----- 2 files changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/ocitysmap-render b/ocitysmap-render
> index 166059d..8849be2 100755
> --- a/ocitysmap-render
> +++ b/ocitysmap-render
> @@ -28,7 +28,9 @@ import logging
>  import optparse
>  import sys, os
>  
> -import ocitysmap
> +from ocitysmap.street_index import OCitySMap, BaseOCitySMapError
> +from ocitysmap.coords import BoundingBox
> +
>  
>  def main():
>      logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
> @@ -101,7 +103,7 @@ def main():
>      boundingbox = None
>      if options.bbox:
>          try:
> -            boundingbox = ocitysmap.BoundingBox.parse(options.bbox)
> +            boundingbox = BoundingBox.parse(options.bbox)
>          except ValueError:
>              sys.stderr.write('ERROR: Invalid city bounding box!\n')
>              return 1
> @@ -111,10 +113,8 @@ def main():
>      city_name = unicode(options.city_name.decode('utf-8'))
>  
>      try:
> -        renderer = ocitysmap.OCitySMap(options.config_file,
> -                                       city_name,
> -                                       boundingbox)
> -    except ocitysmap.BaseOCitySMapError, e:
> +        renderer = OCitySMap(options.config_file, city_name,
> boundingbox)
> +    except BaseOCitySMapError, e:
>          sys.stderr.write('ERROR: %s\n' % e)
>          return 1
>      except KeyboardInterrupt:
> diff --git a/ocitysmap/__init__.py b/ocitysmap/__init__.py
> index be475d7..90f90e4 100644
> --- a/ocitysmap/__init__.py
> +++ b/ocitysmap/__init__.py
> @@ -28,8 +28,3 @@ Provide documentation here.
>  
>  __author__ = 'The Hackfest2009 team'
>  __version__ = '0.1'
> -
> -# Package symbols
> -from street_index import OCitySMap, BaseOCitySMapError,
> UnsufficientDataError -from coords import BoundingBox
> -from grid import GridDescriptor


-- 
Thomas Petazzoni                         http://thomas.enix.org
Promouvoir et défendre le Logiciel Libre http://www.april.org
Logiciels Libres à Toulouse              http://www.toulibre.org

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]