f of the input as an Option (None when missing).
Attributes#
| Attribute | Type | Description |
|---|---|---|
f | Callable[[Option[E_contra]], Option[T_co]] | |
tag | = 'TransformOptional' |
Functions#
__init__#
__init__(f) -> None| Parameter | Type | Description |
|---|---|---|
f | Callable[[Option[E_contra]], Option[T_co]] |
apply#
apply(value, options) -> ParseResult| Parameter | Type | Description |
|---|---|---|
value | object | |
options | ParseOptions |
Returns ParseResult
def apply(self, value: object, options: ParseOptions) -> ParseResult:
return map_value(_present(self.f, _option(value)), _option_value)pipe#
pipe[B](f) -> B| Parameter | Type | Description |
|---|---|---|
f | Callable[[Self], B] |
Returns B
def pipe[B](self, f: Callable[[Self], B], /) -> B:
return f(self)compose#
compose[T2, R2 = Never](other) -> Getter[T2, E_contra, R_co | R2]This getter, then other on its output (Effect's compose).
| Parameter | Type | Description |
|---|---|---|
other | Getter[T2, T_co, R2] |
Returns Getter[T2, E_contra, R_co | R2]
def compose[T2, R2 = Never](
self, other: Getter[T2, T_co, R2], /
) -> Getter[T2, E_contra, R_co | R2]:
"""This getter, then ``other`` on its output (Effect's ``compose``)."""
return cast("Getter[T2, E_contra, R_co | R2]", _compose(self, other))map#
map[T2](f) -> Getter[T2, E_contra, R_co]The output changed by f.
| Parameter | Type | Description |
|---|---|---|
f | Callable[[T_co], T2] |
Returns Getter[T2, E_contra, R_co]
def map[T2](self, f: Callable[[T_co], T2], /) -> Getter[T2, E_contra, R_co]:
"""The output changed by ``f``."""
return self.compose(Transform(f))