class FromBrand[A, B]
from_brand(brand): apply with .pipe.
Functions#
__init__#
__init__(brand, identifier) -> None| Parameter | Type | Description |
|---|---|---|
brand | Brand[A, B] | |
identifier | str | None |
def __init__(self, brand: Brand[A, B], identifier: str | None) -> None:
self._brand = brand
self._identifier = identifier__call__#
__call__[I, RD, RE](schema) -> BrandSchema[B, I, RD, RE]| Parameter | Type | Description |
|---|---|---|
schema | Codec[A, I, RD, RE] |
Returns BrandSchema[B, I, RD, RE]
def __call__[I, RD, RE](self, schema: Codec[A, I, RD, RE], /) -> BrandSchema[B, I, RD, RE]:
bottom = schema.__codec__()
checks = self._brand.checks
checked = bottom.check(*checks) if checks else bottom
# A brand is a ``NewType``: the checked value is the branded one.
return BrandSchema(checked.ast, checked, self._identifier)