httk.core.saving

Dispatch local file writers and format serializers.

Functions

has_writer_for(name)

Return whether name matches a registered writer key.

save(obj, destination, *[, format])

Save obj to a local destination selected by its name or format hint.

Module Contents

httk.core.saving.has_writer_for(name)[source]

Return whether name matches a registered writer key.

Parameters:

name (str) – Destination filename whose writer registration is checked.

Returns:

Whether the name matches a registered extension or exact basename.

Return type:

bool

httk.core.saving.save(obj, destination, *, format=None, **kwargs)[source]

Save obj to a local destination selected by its name or format hint.

The writer registry selects by extension first and exact basename second, case-insensitively after stripping one recognized compression suffix, unless format selects a registered writer directly. The format-serializer registry converts non-neutral objects before writing, and a recognized compression suffix wraps the destination transparently.

Parameters:
  • obj (Any) – Object or neutral payload to serialize and write.

  • destination (str | os.PathLike[str]) – Local filename or path to write.

  • format (str | None) – Optional registered format name that selects the writer.

  • **kwargs (Any) – Additional options passed to the selected writer.

Raises:

ValueError – If the destination or format has no writer, no serializer exists, or the destination is a URL.