mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
scripts: csv.py: Replaced -l/--label with -I/-B/-F for hidden fields
It felt weird that adding hidden fields required changing existing flags unrelated to the field you actually want to affect, and the upper/lower flag thing seems to work well for -s/-S sooo... - Replaced -l/--label with -B/--hidden-by for by fields that can be hidden from the table renderer. - Added -F/--hidden-field as a similar thing for field fields. - Better integrated -i/--enumerate into by fields, now these actually maintain related order. And of course added a matching -I/--hidden-enumerate flag. The only downside is this is eating a lot of flag names.. But one of the nice thing about limiting this complexity to csv.py is it avoids these flag names cluttering up the other result scripts. --- The -F/--hidden-fields flag I'm not so sure about, since field exprs can't really reference each other (single pass). But it does provide symmetry with -B/--hidden-by, and reserves the name in case hidden field fields are more useful in the future. Unfortunately it _is_ annoyingly inconsistent with other hidden fields (-S/--sort, -D/--define, etc) in that it does end up in output csvs... But this script is already feeling way over-engineered as is.
This commit is contained in:
@ -537,14 +537,12 @@ def fold(Result, results, *,
|
||||
return folded
|
||||
|
||||
def hotify(Result, results, *,
|
||||
enumerate=None,
|
||||
enumerates=None,
|
||||
depth=1,
|
||||
hot=None,
|
||||
**_):
|
||||
# note! hotifying risks confusion if you don't enumerate/have a z
|
||||
# field, since it will allow folding across recursive boundaries
|
||||
import builtins
|
||||
enumerate_, enumerate = enumerate, builtins.enumerate
|
||||
# note! hotifying risks confusion if you don't enumerate/have a
|
||||
# z field, since it will allow folding across recursive boundaries
|
||||
|
||||
# hotify only makes sense for recursive results
|
||||
assert hasattr(Result, '_children')
|
||||
@ -569,8 +567,10 @@ def hotify(Result, results, *,
|
||||
for k, reverse in it.chain(hot, [(None, False)])))
|
||||
|
||||
hot_.append(r._replace(**(
|
||||
({enumerate_: len(hot_)}
|
||||
if enumerate_ is not None else {})
|
||||
# enumerate?
|
||||
({e: len(hot_) for e in enumerates}
|
||||
if enumerates is not None
|
||||
else {})
|
||||
| {Result._children: []})))
|
||||
|
||||
# recurse?
|
||||
|
||||
Reference in New Issue
Block a user