[GRASS-SVN] r60630 - grass/branches/releasebranch_7_0/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 31 05:22:40 PDT 2014


Author: neteler
Date: 2014-05-31 05:22:39 -0700 (Sat, 31 May 2014)
New Revision: 60630

Modified:
   grass/branches/releasebranch_7_0/lib/python/script/core.py
Log:
core.py: backport grass.separator() implementation (trunk r60622 and related)

Modified: grass/branches/releasebranch_7_0/lib/python/script/core.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/python/script/core.py	2014-05-31 12:21:15 UTC (rev 60629)
+++ grass/branches/releasebranch_7_0/lib/python/script/core.py	2014-05-31 12:22:39 UTC (rev 60630)
@@ -674,6 +674,28 @@
 
     return _parse_opts(lines[1:])
 
+
+def separator(sep):
+    """!Returns separator from G_OPT_F_SEP appropriately converted
+    to character.
+
+    @param separator character or separator keyword
+
+    @return separator character
+    """
+    if sep == "pipe":
+        return "|"
+    elif sep == "comma":
+        return ","
+    elif sep == "space":
+        return " "
+    elif sep == "tab" or sep == "\\t":
+        return "\t"
+    elif sep == "newline" or sep == "\\n":
+        return "\n"
+    return sep
+    
+
 # interface to g.tempfile
 
 



More information about the grass-commit mailing list