[GRASS-SVN] r44815 - in grass/trunk: gui/wxpython/gui_modules lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 30 13:54:05 EST 2010


Author: martinl
Date: 2010-12-30 10:54:05 -0800 (Thu, 30 Dec 2010)
New Revision: 44815

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm_base.py
   grass/trunk/lib/python/vector.py
Log:
pythonlib: follow param naming convention


Modified: grass/trunk/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_base.py	2010-12-30 18:21:53 UTC (rev 44814)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_base.py	2010-12-30 18:54:05 UTC (rev 44815)
@@ -90,7 +90,7 @@
         line = None
         nselected = 0
 
-        data = grass.vector_what(name = self.map,
+        data = grass.vector_what(map = self.map,
                                  coord = (float(queryCoords[0]), float(queryCoords[1])),
                                  distance = float(qdist))
 

Modified: grass/trunk/lib/python/vector.py
===================================================================
--- grass/trunk/lib/python/vector.py	2010-12-30 18:21:53 UTC (rev 44814)
+++ grass/trunk/lib/python/vector.py	2010-12-30 18:54:05 UTC (rev 44815)
@@ -24,6 +24,7 @@
 
 import os
 import types
+import __builtin__
 
 from core import *
 
@@ -219,12 +220,12 @@
              'values' : values }
 
 # interface to v.what
-def vector_what(name, coord, distance = 0.0):
+def vector_what(map, coord, distance = 0.0):
     """!Query vector map at given locations
     
     To query one vector map at one location
     @code
-    print grass.vector_what(name = 'archsites', coord = (595743, 4925281), distance = 250)
+    print grass.vector_what(map = 'archsites', coord = (595743, 4925281), distance = 250)
 
     [{'Category': 8, 'Map': 'archsites', 'Layer': 1, 'Key_column': 'cat',
       'Database': '/home/martin/grassdata/spearfish60/PERMANENT/dbf/',
@@ -235,7 +236,7 @@
 
     To query one vector map at more locations
     @code
-    for q in grass.vector_what(name = ('archsites', 'roads'), coord = (595743, 4925281),
+    for q in grass.vector_what(map = ('archsites', 'roads'), coord = (595743, 4925281),
                                distance = 250):
         print q['Map'], q['Attributes']
                             
@@ -245,7 +246,7 @@
 
     To query more vector maps at one location
     @code
-    for q in grass.vector_what(name = 'archsites', coord = [(595743, 4925281), (597950, 4918898)],
+    for q in grass.vector_what(map = 'archsites', coord = [(595743, 4925281), (597950, 4918898)],
                                distance = 250):
         print q['Map'], q['Attributes']
 
@@ -253,7 +254,7 @@
     archsites {'str1': 'Bob_Miller', 'cat': '22'}
     @endcode
 
-    @param name vector map(s) to query given as string or list/tuple
+    @param map vector map(s) to query given as string or list/tuple
     @param coord coordinates of query given as tuple (easting, northing) or list of tuples
     @param distance query threshold distance (in map units)
 
@@ -263,12 +264,12 @@
         locale = os.environ["LC_ALL"]
         os.environ["LC_ALL"] = "C"
 
-    if type(name) in (types.StringType, types.UnicodeType):
-        name_list = [name]
+    if type(map) in (types.StringType, types.UnicodeType):
+        map_list = [map]
     else:
-        name_list = name
+        map_list = map
     
-    layer_list = ['-1'] * len(name_list)
+    layer_list = ['-1'] * len(map_list)
     
     coord_list = list()
     if type(coord) is types.TupleType:
@@ -280,7 +281,7 @@
     ret = read_command('v.what',
                        quiet      = True,
                        flags      = 'ag',
-                       map        = ','.join(name_list),
+                       map        = ','.join(map_list),
                        layer      = ','.join(layer_list),
                        east_north = ','.join(coord_list),
                        distance   = float(distance))
@@ -295,7 +296,7 @@
     dict_attrb = None
     for item in ret.splitlines():
         try:
-            key, value = map(lambda x: x.strip(), item.split('=', 1))
+            key, value = __builtin__.map(lambda x: x.strip(), item.split('=', 1))
         except ValueError:
             continue
         if key in ('East', 'North'):



More information about the grass-commit mailing list