The shared registry of schema decoders (Effect's SchemaCompiler).
A decoder installed with set for an exact AST is used by every parser
(S.decode_unknown_sync, S.is_, Bottom.make, ...) and by every
schema that reaches the AST, without a compiled schema type or a second
parser API. The JIT compiler (pyfect.schema.jit_compiler) and modules
written by the ahead-of-time compiler (pyfect.schema.aot_compiler) fill
the same registry.
An installed decoder (a CompiledDecoder, or any object with these
attributes) has decode_effect, the complete decoder, and may have the
fast paths is_, decode and make, which return INVALID for an
invalid input (is_ returns False), and make_effect, the
complete constructor. Each attribute is read once, when first needed.
Parsers that already resolved an AST keep its entry after a later set.
Re-exports#
- From
pyfect.schema.ast:MISSING
Values#
| Attribute | Type | Description |
|---|---|---|
DEFAULT_PARSE_OPTIONS | Final[ParseOptions] = {} | The options of a call that gives none (Effect's |
INVALID | Invalid | What a fast path ( |
Types#
| Type | Definition | Description |
|---|---|---|
Decode | type Decode = Callable[[object, ParseOptions], object] | The decoded value, or |
DecodeEffect | type DecodeEffect = Parser | |
Is | type Is = Callable[[object, ParseOptions], bool] | |
Make | type Make = Callable[[object, ParseOptions], object] | |
MakeEffect | type MakeEffect = Parser |
Classes#
Functions#
set#
set(ast, decoder) -> NoneInstall decoder for ast (Effect's SchemaCompiler.set). A
later set replaces it for parsers that have not resolved ast
yet; the decoder is trusted to implement the AST's semantics.
| Parameter | Type | Description |
|---|---|---|
ast | AST | |
decoder | DecoderSource |
def set(ast: AST, decoder: DecoderSource, /) -> None:
"""Install ``decoder`` for ``ast`` (Effect's ``SchemaCompiler.set``). A
later ``set`` replaces it for parsers that have not resolved ``ast``
yet; the decoder is trusted to implement the AST's semantics."""
_set(ast, decoder)