Skip to content

registry

registry module-attribute

registry: Registry = Registry()

Registry

Bases: Dict[str, Type]

Registry of all available models

getName

getName(model) -> str

Get the name of the ssi object

PARAMETER DESCRIPTION
model

The model object

TYPE: MicroMechanicalModelBase

RETURNS DESCRIPTION
str

Name of the ssi object

register

register(
    cls_or_name: Type | str = None, name: str = None, *, saveto: Registry = None
) -> Type | Callable

Register a new model

Examples:

The following calls are equivalent:

1) cls_or_name = "Foo", name = None

@register("Foo") ... class Foo: ... ...

2) cls_or_name = None, name = "Foo"

@register(name="Foo") ... class Foo: ... ...

3) cls_or_name = Foo, name = "Foo"

class Foo: ... ... register(Foo, "Foo")

PARAMETER DESCRIPTION
cls_or_name

The class to register or the name of the class, by default None.

TYPE: Type | str DEFAULT: None

name

The name of the class, by default None

TYPE: str DEFAULT: None

saveto

The registry to save the class, by default None which will use the default registry

TYPE: Registry DEFAULT: None

RETURNS DESCRIPTION
Type | Callable

The class that was registered or a callable that registers the class