[GRASS-SVN] r53551 - grass/trunk/lib/python/pygrass/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 25 07:41:10 PDT 2012


Author: zarch
Date: 2012-10-25 07:41:09 -0700 (Thu, 25 Oct 2012)
New Revision: 53551

Modified:
   grass/trunk/lib/python/pygrass/modules/__init__.py
Log:
Change value type check and add __str__ method to the Module class

Modified: grass/trunk/lib/python/pygrass/modules/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/__init__.py	2012-10-25 11:56:43 UTC (rev 53550)
+++ grass/trunk/lib/python/pygrass/modules/__init__.py	2012-10-25 14:41:09 UTC (rev 53551)
@@ -44,9 +44,9 @@
 
 _GETTYPE = {
     'string': str,
-    'integer': np.int32,
-    'float': np.float32,
-    'double': np.float64,
+    'integer': int,
+    'float': float,
+    'double': float,
 }
 
 
@@ -177,8 +177,8 @@
             else:
                 self._value = value
         else:
-            raise TypeError('The Parameter <%s>, require: %s' %
-                            (self.name, self.typedesc))
+            str_err = 'The Parameter <%s>, require: %s, get: %s instead'
+            raise TypeError(str_err % (self.name, self.typedesc, type(value)))
 
     # here the property function is used to transform value in an attribute
     # in this case we define which function must be use to get/set the value
@@ -463,6 +463,9 @@
         if self.run_:
             self.run()
 
+    def __str__(self):
+        return ' '.join(self.make_cmd())
+
     @property
     def __doc__(self):
         """{cmd_name}({cmd_params})



More information about the grass-commit mailing list