GRASS Programmer's Manual  6.4.2(2012)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
python.task Namespace Reference

Data Structures

class  grassTask
 This class holds the structures needed for filling by the parser. More...
class  processTask
 A ElementTree handler for the –interface-description output, as defined in grass-interface.dtd. More...

Functions

def get_interface_description
 Returns the XML description for the GRASS cmd.
def parse_interface
 Parse interface of given GRASS module.
def command_info
 Returns meta information for any GRASS command as dictionary with entries for description, keywords, usage, flags, and parameters, e.g.

Function Documentation

def python.task.command_info (   cmd)

Returns meta information for any GRASS command as dictionary with entries for description, keywords, usage, flags, and parameters, e.g.

>>> gtask.command_info('g.tempfile')
{'keywords': ['general', 'map management'],
'params': [{'gisprompt': False, 'multiple': False, 'name': 'pid', 'guidependency': '',
'default': '', 'age': None, 'required': True, 'value': '',
'label': '', 'guisection': '', 'key_desc': [], 'values': [], 'values_desc': [],
'prompt': None, 'hidden': False, 'element': None, 'type': 'integer',
'description': 'Process id to use when naming the tempfile'}],
'flags': [{'description': 'Verbose module output', 'value': False, 'label': '', 'guisection': '',
'suppress_required': False, 'hidden': False, 'name': 'verbose'}, {'description': 'Quiet module output',
'value': False, 'label': '', 'guisection': '', 'suppress_required': False, 'hidden': False, 'name': 'quiet'}],
'description': 'Creates a temporary file and prints the file name.',
'usage': 'g.tempfile pid=integer [--verbose] [--quiet]'
}
>>> gtask.command_info('v.buffer')['keywords']
['vector', 'geometry', 'buffer']

Definition at line 464 of file task.py.

References python.task.parse_interface().

def python.task.get_interface_description (   cmd)

Returns the XML description for the GRASS cmd.

The DTD must be located in $GISBASE/etc/grass-interface.dtd, otherwise the parser will not succeed.

Parameters:
cmdcommand (name of GRASS module)

Definition at line 421 of file task.py.

Referenced by python.task.parse_interface().

def python.task.parse_interface (   name,
  parser = processTask,
  blackList = None 
)

Parse interface of given GRASS module.

Parameters:
namename of GRASS module to be parsed

Definition at line 449 of file task.py.

References python.core.decode(), python.task.get_interface_description(), and python.core.parser().

Referenced by python.task.command_info().