[GRASS-dev] [GRASS-SVN] r67819 - grass-addons/grass7/vector/v.neighborhoodmatrix

Hi,

On Fri, Feb 12, 2016 at 11:34 PM, <svn_grass@osgeo.org> wrote:

Author: mlennert
Date: 2016-02-12 14:34:26 -0800 (Fri, 12 Feb 2016)
New Revision: 67819

Modified:
   grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py
Log:
correctly read G_OPT_F_SEP options

I check GRASS + Addons for this change, there might be more candidates?

# core:

grep "options\['separator'" scripts/*/*
scripts/m.proj/m.proj.py: fs = options['separator']
scripts/r3.in.xyz/r3.in.xyz.py: fs = options['separator']
scripts/r.out.xyz/r.out.xyz.py:
separator=options['separator'])
scripts/r.tileset/r.tileset.py: fs = separator(options['separator'])
scripts/v.in.lines/v.in.lines.py: fs = separator(options['separator'])

# grass-addons:

general/g.rename.many/g.rename.many.py: sep = separator(options['separator'])

Should all make use of
grass.utils.separator(options['separator'])
?

Markus

On 13/02/16 14:24, Markus Neteler wrote:

Hi,

On Fri, Feb 12, 2016 at 11:34 PM, <svn_grass@osgeo.org> wrote:

Author: mlennert
Date: 2016-02-12 14:34:26 -0800 (Fri, 12 Feb 2016)
New Revision: 67819

Modified:
    grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py
Log:
correctly read G_OPT_F_SEP options

I check GRASS + Addons for this change, there might be more candidates?

# core:

grep "options\['separator'" scripts/*/*
scripts/m.proj/m.proj.py: fs = options['separator']

already uses the separator function

scripts/r3.in.xyz/r3.in.xyz.py: fs = options['separator']

passes the value as such to r.in.xyz which then parses it correctly

scripts/r.out.xyz/r.out.xyz.py:
separator=options['separator'])

passes on fs to r.stats which understands the special words

scripts/r.tileset/r.tileset.py: fs = separator(options['separator'])

already uses the separator function

scripts/v.in.lines/v.in.lines.py: fs = separator(options['separator'])

already uses the separator function

# grass-addons:

general/g.rename.many/g.rename.many.py: sep = separator(options['separator'])

already uses the separator function

Should all make use of
grass.utils.separator(options['separator'])
?

As shown, all either already do, or they pass the content on to a module that does. Those that do, do it a bit more elegantly than me by importing the function explicitely using something like

from grass.script.utils import separator

and then using it as such further down:

fs = separator(options['separator'])

Moritz