GitHub

API reference for Getter.

A getter (see the module); tag is its kind.

Attributes

AttributeTypeDescription
tagTag

Functions

__init__

__init__() -> None

apply

apply(value, options) -> ParseResult

The output for value (MISSING when there is none).

ParameterTypeDescription
valueobject
optionsParseOptions

Returns ParseResult

@abstractmethod
def apply(self, value: object, options: ParseOptions) -> ParseResult:
    """The output for ``value`` (``MISSING`` when there is none)."""

pipe

pipe[B](f) -> B
ParameterTypeDescription
fCallable[[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).

ParameterTypeDescription
otherGetter[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.

ParameterTypeDescription
fCallable[[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))