zabgrab.model.choice¶
Choice values: a list of options plus a rule for selecting between them.
Config keys that support choices accept either a plain value or a table such as
{ choices = ["a", "b"], select = "all" }.
Module Attributes
Tags used by the discriminated union below. |
Functions
|
Make the type of a setting that takes a value or a choice of values. |
Classes
|
A list of options and a selection rule. |
|
How to select between the options of a |
- class zabgrab.model.choice.Select(*values)[source]¶
Bases:
StrEnumHow to select between the options of a
Choice.- ALL¶
Use every option, stacking the results.
- PROMPT¶
Ask the user (an error if non-interactive). The only one allowed for servers, since a fetch uses one server.
- FIRST¶
Use the first option that works (for hosts, the first with matching items).
- class zabgrab.model.choice.Choice(*, choices, select=Select.PROMPT)[source]¶
Bases:
BaseModel,Generic[T]A list of options and a selection rule.
- model_config = {'extra': 'forbid', 'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- zabgrab.model.choice.SINGLE_TAG = '<value>'¶
Tags used by the discriminated union below. They appear in validation error locations and are stripped when errors are formatted for the user. They contain characters that are invalid in names, so they can’t clash with config keys.