Skip to content

Commit

Permalink
grass.script: Fix ignored superquiet (--qq) parameter (#2814)
Browse files Browse the repository at this point in the history
The superquiet (--qq) parameter was ignored by the core functions and not supported in others. This adds superquiet=False to all relevant functions.
  • Loading branch information
wenzeslaus committed Mar 16, 2023
1 parent b3ba6c2 commit 35192ef
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
15 changes: 13 additions & 2 deletions python/grass/script/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def make_command(
:param str flags: flags to be used (given as a string)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run extra quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param options: module's parameters
Expand Down Expand Up @@ -375,6 +376,7 @@ def start_command(
:param str flags: flags to be used (given as a string)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run extra quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param kwargs: module's parameters
Expand All @@ -388,7 +390,15 @@ def start_command(
else:
options[opt] = val

args = make_command(prog, flags, overwrite, quiet, verbose, **options)
args = make_command(
prog,
flags=flags,
overwrite=overwrite,
quiet=quiet,
superquiet=superquiet,
verbose=verbose,
**options,
)

if debug_level() > 0:
sys.stderr.write(
Expand Down Expand Up @@ -627,12 +637,13 @@ def exec_command(
:param str flags: flags to be used (given as a string)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param env: directory with environmental variables
:param list kwargs: module's parameters
"""
args = make_command(prog, flags, overwrite, quiet, verbose, **kwargs)
args = make_command(prog, flags, overwrite, quiet, superquiet, verbose, **kwargs)

if env is None:
env = os.environ
Expand Down
22 changes: 20 additions & 2 deletions python/grass/script/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,20 @@ def float_or_null(s):


def mapcalc(
exp, quiet=False, verbose=False, overwrite=False, seed=None, env=None, **kwargs
exp,
quiet=False,
superquiet=False,
verbose=False,
overwrite=False,
seed=None,
env=None,
**kwargs,
):
"""Interface to r.mapcalc.
:param str exp: expression
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run extra quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param seed: an integer used to seed the random-number generator for the
Expand All @@ -137,6 +145,7 @@ def mapcalc(
env=env,
seed=seed,
quiet=quiet,
superquiet=superquiet,
verbose=verbose,
overwrite=overwrite,
)
Expand All @@ -145,7 +154,14 @@ def mapcalc(


def mapcalc_start(
exp, quiet=False, verbose=False, overwrite=False, seed=None, env=None, **kwargs
exp,
quiet=False,
superquiet=False,
verbose=False,
overwrite=False,
seed=None,
env=None,
**kwargs,
):
"""Interface to r.mapcalc, doesn't wait for it to finish, returns Popen object.
Expand All @@ -166,6 +182,7 @@ def mapcalc_start(
:param str exp: expression
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run extra quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param seed: an integer used to seed the random-number generator for the
Expand All @@ -188,6 +205,7 @@ def mapcalc_start(
env=env,
seed=seed,
quiet=quiet,
superquiet=superquiet,
verbose=verbose,
overwrite=overwrite,
)
Expand Down
11 changes: 10 additions & 1 deletion python/grass/script/raster3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,20 @@ def float_or_null(s):


def mapcalc3d(
exp, quiet=False, verbose=False, overwrite=False, seed=None, env=None, **kwargs
exp,
quiet=False,
superquiet=False,
verbose=False,
overwrite=False,
seed=None,
env=None,
**kwargs,
):
"""Interface to r3.mapcalc.
:param str exp: expression
:param bool quiet: True to run quietly (<tt>--q</tt>)
:param bool superquiet: True to run extra quietly (<tt>--qq</tt>)
:param bool verbose: True to run verbosely (<tt>--v</tt>)
:param bool overwrite: True to enable overwriting the output (<tt>--o</tt>)
:param seed: an integer used to seed the random-number generator for the
Expand All @@ -97,6 +105,7 @@ def mapcalc3d(
env=env,
seed=seed,
quiet=quiet,
superquiet=superquiet,
verbose=verbose,
overwrite=overwrite,
)
Expand Down

0 comments on commit 35192ef

Please sign in to comment.