@@ -17,9 +17,11 @@ An instance of `StatsStep` is callable.
1717Call an instance of function of type `F` with arguments from `ntargs`
1818formed by accessing the keys in `S` and `T` sequentially.
1919
20- If a keyword argument `verbose` takes `true`
21- or `ntargs` contains a key-value pair `verbose=true`,
22- a message with the name of the `StatsStep` is printed to `stdout`.
20+ A message with the name of the `StatsStep` is printed to `stdout`
21+ if a keyword `verbose` takes the value `true`
22+ or `ntargs` contains a key-value pair `verbose=true`.
23+ The value from `ntargs` supersedes the keyword argument
24+ in case both are specified.
2325
2426## Returns
2527- `NamedTuple`: named intermidiate results.
@@ -31,8 +33,8 @@ _specnames(::StatsStep{A,F,S}) where {A,F,S} = S
3133_tracenames (:: StatsStep{A,F,S,T} ) where {A,F,S,T} = T
3234
3335function (step:: StatsStep{A,F,S,T} )(ntargs:: NamedTuple ; verbose:: Bool = false ) where {A,F,S,T}
34- verbose || ( haskey (ntargs, :verbose ) && ntargs. verbose) &&
35- println ( " Running " , step)
36+ haskey (ntargs, :verbose ) && (verbose = ntargs. verbose)
37+ verbose && printstyled ( " Running " , step, " \n " , color = :green )
3638 args = NamedTuple {(S...,T...)} (ntargs)
3739 ret = F. instance (args... )
3840 if ret isa NamedTuple
@@ -323,7 +325,7 @@ while ignoring the orders.
323325function (sp:: StatsSpec{A,T} )(;
324326 verbose:: Bool = false , keep= nothing , keepall:: Bool = false ) where {A,T}
325327 args = verbose ? merge (sp. args, (verbose= true ,)) : sp. args
326- ntall = foldl (|> , T (), init= sp . args)
328+ ntall = foldl (|> , T (), init= args)
327329 if keepall
328330 return ntall
329331 elseif ! isempty (ntall)
@@ -336,7 +338,7 @@ function (sp::StatsSpec{A,T})(;
336338 elseif eltype (keep) != Symbol
337339 throw (ArgumentError (" expect Symbol or collections of Symbols for the value of option `keep`" ))
338340 end
339- return (result = res, (kv for kv in pairs (ntall) if kv[1 ] in keep). .. )
341+ return ((kv for kv in pairs (ntall) if kv[1 ] in keep). .. , result = res )
340342 end
341343 else
342344 return nothing
@@ -361,7 +363,7 @@ function run_specset(sps::AbstractVector{<:StatsSpec};
361363 gids = groupfind (r-> procedure (r. spec), tb)
362364 steps = pool ((p () for p in keys (gids)). .. )
363365 for step in steps
364- verbose && println ( " Running " , step)
366+ verbose && printstyled ( " Running " , step, " \n " , color = :green )
365367 args = _specnames (step)
366368 tras = _tracenames (step)
367369 byf = r-> merge (NamedTuple {args} (r. spec. args), NamedTuple {tras} (r. trace))
0 commit comments