[GRASS-SVN] r57995 - grass/trunk/lib/python/pygrass/modules/interface
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 14 06:46:19 PDT 2013
Author: zarch
Date: 2013-10-14 06:46:19 -0700 (Mon, 14 Oct 2013)
New Revision: 57995
Modified:
grass/trunk/lib/python/pygrass/modules/interface/module.py
Log:
Check required parameters only if run_ is True
Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-10-14 13:20:06 UTC (rev 57994)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-10-14 13:46:19 UTC (rev 57995)
@@ -60,6 +60,7 @@
from typedict import TypeDict
from read import GETFROMTAG, DOC
+
class ParallelModuleQueue(object):
"""!This class is designed to run an arbitrary number of pygrass Module
processes in parallel.
@@ -170,11 +171,12 @@
proc.outputs['stderr'].value = stderr if stderr else ''
if proc.popen.returncode != 0:
- GrassError(("Error running module %s")%(proc.name))
+ GrassError(("Error running module %s") % (proc.name))
self._list = self._num_procs * [None]
self._proc_count = 0
+
class Module(object):
"""
@@ -348,20 +350,20 @@
raise ParameterError('%s is not a valid parameter.' % key)
#
- # check reqire parameters
- #
- for key in self.required:
- if ((key in self.inputs and self.inputs[key].value is None) or
- (key in self.outputs and self.outputs[key].value is None)):
- raise ParameterError(
- "Required parameter <%s> not set." % key)
-
- #
# check if execute
#
if self.run_:
+ #
+ # check reqire parameters
+ #
+ for k in self.required:
+ if ((k in self.inputs and self.inputs[k].value is None) or
+ (k in self.outputs and self.outputs[k].value is None)):
+ msg = "Required parameter <%s> not set."
+ raise ParameterError(msg % key)
self.run()
+
def get_bash(self):
return ' '.join(self.make_cmd())
More information about the grass-commit
mailing list