Container utils
💻 API reference
opt_dict
Bases: dict[K, V]
, _ConverterProtocol
Source code in fateful/container.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
map_to(clazz)
expected a dataclass or a pydantic basemodel
Source code in fateful/container.py
82 83 84 |
|
opt_list
Bases: list[T]
, _ConverterProtocol
Immutable wrapper around a list that converts all dicts to JsObjects and all lists to JsArrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list |
_type_
|
description |
required |
x = opt_list([1,2,3])
v: Some[int] = x.at(0)
z: Empty = x.at(12)
Source code in fateful/container.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|