zabgrab.model.answers

What the user answered at prompts during a fetch.

Used to show the equivalent command (“Next time: zabgrab fetch …”) and to save the fetch as a template with --save-template.

Functions

config_value(value)

Convert a setting's value to the form it takes in a config file.

Classes

Answers([template, settings, server, items, ...])

Answers given at prompts, in the form the command line or a template takes.

class zabgrab.model.answers.Answers(template=None, settings=<factory>, server=None, items=<factory>, all_items=False)[source]

Bases: object

Answers given at prompts, in the form the command line or a template takes.

Parameters:
template

The template chosen instead of an unknown one.

Type:

str or None

settings

Settings by config key, e.g. {"from": "24 hours ago", "format": ["mat"]}.

Type:

dict of str to Any

server

The server name or URL chosen.

Type:

str or None

items

Request label to the items chosen, replacing the request’s own.

Type:

dict of str to tuple of ItemSpec

all_items

The user chose to fetch every match despite max_items (--yes).

Type:

bool

zabgrab.model.answers.config_value(value)[source]

Convert a setting’s value to the form it takes in a config file.

Parameters:

value (Any) – A setting’s value, as parsed (e.g. an enum or a Choice).

Returns:

Any – The value with enums as strings, choices as tables and tuples as lists.

Return type:

Any