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
|
Add the |
|
Refuse delimited files, which commands reading merged data can't read. |
|
Make the |
|
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 |
|
Combine |
- 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.bin_option(function)[source]¶
Add the
--binoption.- Parameters:
function (callable) – The click command to add it to.
- Returns:
callable – The command, taking a
binsargument (aBins, orNone).- Return type:
F
- zabgrab.cli.reading.log_option(help)[source]¶
Make the
--logoption, with its old name--log-yhidden.--log-ywas renamed--login 1.1.0, since with--binit applies to the counts, along the horizontal axis. The old name still works, with a warning, until 2.0.
- zabgrab.cli.reading.use_log(app, log, log_y)[source]¶
Combine
--logand its old name, warning about the old one.- Parameters:
app (AppContext) – For the UI.
log (bool) – Whether
--logand--log-ywere given.log_y (bool) – Whether
--logand--log-ywere given.
- Returns:
bool – Whether to use log scales.
- Return type:
- 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: