vibe-sketcherDocumentation

vibesketcher.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 vibesketcher.inputs.registry.Batch(bundles=<factory>, refused=<factory>)[source]

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 vibesketcher.inputs.registry.UnknownReference(kind, identifier)[source]

Bases: KeyError

The document has no job or species with that id.

Parameters:
Return type:

None

exception vibesketcher.inputs.registry.UnknownWriter(name)[source]

Bases: LookupError

No writer is registered under that name.

Parameters:

name (str)

Return type:

None

vibesketcher.inputs.registry.get_writer(name)[source]

The writer registered as name; raises UnknownWriter.

Parameters:

name (str)

Return type:

InputWriter

vibesketcher.inputs.registry.register(writer, *, replace=False)[source]

Make writer available under writer.name.

Parameters:
Return type:

None

vibesketcher.inputs.registry.write_input(document, *, job=None, species=None, program=None, spec=None)[source]

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

vibesketcher.inputs.registry.write_inputs(document, *, program, spec, species=None)[source]

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

vibesketcher.inputs.registry.writers()[source]

Every registered writer, by name.

Return type:

list[InputWriter]