registry#

Model registration functions used by API client to determine how to interpret JSON responses. Used for either cryosparc-tools or cryosparc models.

Functions:

check_finalized([finalized])

Ensure the register has or hasn't been finalized.

finalize()

Prevent registering additional types.

get_literal_module_name(name)

Returns name of the module that that contains the registered literal.

model_for_ref(schema_ref)

Given a string with format either #/components/schemas/X or #/components/schemas/X_Y_, looks up key X in REGISTERED_MODEL_CLASSES`, and return either X or X[Y] depending on whether the string includes the final Y component.

check_finalized(finalized: bool = True)#

Ensure the register has or hasn’t been finalized. This is used in special contexts such as cryosparcm icli or Jupyter Notebooks where cryosparc-tools may be used alongside an API client.

finalize()#

Prevent registering additional types. Cannot be called twice.

get_literal_module_name(name: str) str#

Returns name of the module that that contains the registered literal.

model_for_ref(schema_ref: str) Type | None#

Given a string with format either #/components/schemas/X or #/components/schemas/X_Y_, looks up key X in REGISTERED_MODEL_CLASSES`, and return either X or X[Y] depending on whether the string includes the final Y component.

Returns None if ref is not found.