jam.types.base.choices.option module

class jam.types.base.choices.option.Option(initial: Codable = Null)[source]

Bases: Choice

An option is a choice that can be either None or a value.

__init__(initial: Codable = Null)[source]

Initialize Choice.

Parameters:

initial – Mapping of initial choice name and its value. Should have only one key.

Raises:

ValueError – If types list is empty

static option_to_choice(value: Codable | Nullable) Dict[str, Codable][source]
classmethod from_json(data: Any) Option[source]

Create from JSON representation.

to_json() Any[source]

Convert to JSON representation.

jam.types.base.choices.option.decodable_option(optional_type: Type[Codable]) Type[Option][source]

Decodable choice