zabgrab.cli.reading¶
Options and helpers shared by commands that read a file’s merged data.
zabgrab export, zabgrab info and zabgrab plot select items, times and
groups the same way.
Functions
|
Refuse delimited files, which commands reading merged data can't read. |
|
Suggest how to find what to select in a file, when nothing was. |
|
Read a file's merged data, limited to the selected items, times and groups. |
|
Add the |
|
Parse |
- zabgrab.cli.reading.selection_options(function)[source]¶
Add the
--item,--match,--from,--toand--groupoptions.- Parameters:
function (callable) – The click command to add them to.
- Returns:
callable – The command, taking
items,match,from_,toandgroupsarguments.- Return type:
F
- zabgrab.cli.reading.read_dataset(app, file, *, verb, items, match, from_, to, groups)[source]¶
Read a file’s merged data, limited to the selected items, times and groups.
- Parameters:
app (AppContext) – For the config (the time zone
--from/--toare in), clock and UI.file (Path) – A
.mator.h5file written by zabgrab.verb ((str, str)) – What the command does, and its past participle, for messages (e.g.
("export", "exported")).items (Sequence[ItemSpec]) – The
--item,--match,--from,--toand--groupvalues. Items are kept if any--itemor--matchselects them.match (Sequence[str]) – The
--item,--match,--from,--toand--groupvalues. Items are kept if any--itemor--matchselects them.from – The
--item,--match,--from,--toand--groupvalues. Items are kept if any--itemor--matchselects them.to (str | None) – The
--item,--match,--from,--toand--groupvalues. Items are kept if any--itemor--matchselects them.groups (Sequence[str]) – The
--item,--match,--from,--toand--groupvalues. Items are kept if any--itemor--matchselects them.from_ (str | None)
- Returns:
Dataset – The merged, filtered data.
tzinfo or None – The configured time zone (
Nonefor local time).
- Raises:
ZabgrabError – If
fileis a delimited file, or has no such groups.click.BadParameter – If
--fromor--tocan’t be parsed.
- Return type:
- zabgrab.cli.reading.check_readable(file, verb)[source]¶
Refuse delimited files, which commands reading merged data can’t read.
- Parameters:
- Raises:
ZabgrabError – If
fileis a delimited file.- Return type:
None
- zabgrab.cli.reading.time_range(app, from_, to)[source]¶
Parse
--fromand--to, in the configured time zone.- Parameters:
app (AppContext) – For the config (the time zone) and the clock.
from (str or None) – The options’ values, if given.
to (str or None) – The options’ values, if given.
from_ (str | None)
- Returns:
start, end (datetime or None) – The times, if given.
tz (tzinfo or None) – The configured time zone (
Nonefor local time).
- Raises:
click.BadParameter – If a time can’t be parsed.
- Return type: