GitHub

API reference for Parser.

class Parser[T]

Values from a stream of chunks holding concatenated frames.

Values completed before a failure remain observable: the failure is raised by the next call. After a failure, the parser rejects further calls.

Attributes

AttributeTypeDescription
endEffect[None, SchemaError]

end_sync as an effect.

Functions

feed_sync

feed_sync(chunk) -> list[T]

Feeds a chunk and returns the values it completed.

ParameterTypeDescription
chunkbytes

Returns list[T]

def feed_sync(self, chunk: bytes, /) -> list[T]:
    """Feeds a chunk and returns the values it completed."""
    ...

end_sync

end_sync() -> None

Finishes; raises SchemaError for an incomplete frame.

def end_sync(self) -> None:
    """Finishes; raises ``SchemaError`` for an incomplete frame."""
    ...

feed

feed(chunk) -> Effect[list[T], SchemaError]

feed_sync as an effect.

ParameterTypeDescription
chunkbytes

Returns Effect[list[T], SchemaError]

def feed(self, chunk: bytes, /) -> Effect[list[T], SchemaError]:
    """``feed_sync`` as an effect."""
    ...