[GRASS-SVN] r55032 - grass/trunk/lib/python/pygrass
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 13 02:13:04 PST 2013
Author: lucadelu
Date: 2013-02-13 02:13:04 -0800 (Wed, 13 Feb 2013)
New Revision: 55032
Modified:
grass/trunk/lib/python/pygrass/functions.py
Log:
fix remove function; add doctest
Modified: grass/trunk/lib/python/pygrass/functions.py
===================================================================
--- grass/trunk/lib/python/pygrass/functions.py 2013-02-13 09:30:45 UTC (rev 55031)
+++ grass/trunk/lib/python/pygrass/functions.py 2013-02-13 10:13:04 UTC (rev 55032)
@@ -28,17 +28,26 @@
return fnmatch.filter(word_list, filter_string)
-def remove(**kargs):
- grasscore.run_command('g.remove', **kargs)
+def remove(oldname, maptype):
+ """Remove a map"""
+ grasscore.run_command('g.remove', **{maptype: '{old}'.format(old=oldname)})
def rename(oldname, newname, maptype):
+ """Rename a map"""
grasscore.run_command('g.rename',
**{maptype: '{old},{new}'.format(old=oldname,
new=newname), })
def copy(existingmap, newmap, maptype):
+ """Copy a map
+
+ >>> copy('census', 'mycensus', 'vect')
+ >>> rename('mycensus', 'mynewcensus', 'vect')
+ >>> remove('mynewcensus', 'vect')
+
+ """
grasscore.run_command('g.copy',
**{maptype: '{old},{new}'.format(old=existingmap,
new=newmap), })
More information about the grass-commit
mailing list