Skip to main content
Version: 0.0.5 (stable)

agrag.loaders.prose.TextLoader

Bases: ProseLoader

Reads plain-text and log files as one document each.

Attributes:

Functions:

  • is_available – Return whether the package that the loader's extra installs is present.
  • load – Yield one prose Document from the source.

extensions​

extensions = frozenset({'.txt', '.log'})

extra​

extra: str | None = None

extra_module​

extra_module: str | None = None

family​

family = DocumentFamily.PROSE

is_available​

is_available() -> bool

Return whether the package that the loader's extra installs is present.

A loader with no extra is always available. The check looks the module up without importing it, so an installed package that fails to import still counts.

load​

load(source:SourceRef, stream:BinaryIO, opts:ReadOptions, *, start_at:int = 0) -> Iterator[Document]

Yield one prose Document from the source.

Parameters:

  • source (SourceRef) – The source to read.
  • stream (BinaryIO) – The open binary stream for the source.
  • opts (ReadOptions) – The read options for this call.
  • start_at (int) – Ignored by prose loaders.

Yields:

  • Document – One Document holding the decoded text.

mime_types​

mime_types: frozenset[str] = frozenset()