registry
Registry
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. |
name
|
The name of the class, by default None
TYPE:
|
saveto
|
The registry to save the class, by default None which will use the default registry
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Type | Callable
|
The class that was registered or a callable that registers the class |