vibesketch.inputs.registry

The registry of input writers, and the one call that runs them.

Functions

get_writer(name)

The writer registered as name; raises UnknownWriter.

register(writer, *[, replace])

Make writer available under writer.name.

write_input(document, *[, job, species, ...])

Write the input for one job of document.

write_inputs(document, *, program, spec[, ...])

The inputs for species (default: every species) with one writer.

writers()

Every registered writer, by name.

Classes

Batch([bundles, refused])

Inputs for several species with one writer and one specification.

Exceptions

UnknownReference(kind, identifier)

The document has no job or species with that id.

UnknownWriter(name)

No writer is registered under that name.

class vibesketch.inputs.registry.Batch(bundles=<factory>, refused=<factory>)

Bases: object

Inputs for several species with one writer and one specification.

Parameters:
bundles: list[InputBundle]
refused: dict[str, list[str]]

Per species id, why the writer refused it.

exception vibesketch.inputs.registry.UnknownReference(kind, identifier)

Bases: KeyError

The document has no job or species with that id.

Parameters:
Return type:

None

exception vibesketch.inputs.registry.UnknownWriter(name)

Bases: LookupError

No writer is registered under that name.

Parameters:

name (str)

Return type:

None

vibesketch.inputs.registry.get_writer(name)

The writer registered as name; raises UnknownWriter.

Parameters:

name (str)

Return type:

InputWriter

vibesketch.inputs.registry.register(writer, *, replace=False)

Make writer available under writer.name.

Parameters:
Return type:

None

vibesketch.inputs.registry.write_input(document, *, job=None, species=None, program=None, spec=None)

Write the input for one job of document.

Name a job by its id, or give a species id and a program (with an optional specification; the default is the geometry only). Raises WriterRefusal when the writer cannot express the request, UnknownWriter for an unknown program, and UnknownReference for an id the document does not have.

Parameters:
Return type:

InputBundle

vibesketch.inputs.registry.write_inputs(document, *, program, spec, species=None)

The inputs for species (default: every species) with one writer.

A species the writer refuses is listed in Batch.refused with the reasons, and the others are still written; a proton in a mechanism should not stop the rest of it. Raises UnknownWriter for an unknown program and UnknownReference for an unknown species id.

Parameters:
Return type:

Batch

vibesketch.inputs.registry.writers()

Every registered writer, by name.

Return type:

list[InputWriter]