def register(self, key: Any, factory: Callable[['<STR_LIT>'], Any],<EOL>shared: bool = True) -> None:
if shared:<EOL><INDENT>self._factories[key] = SingletonFactory(factory)<EOL><DEDENT>else:<EOL><INDENT>self._factories[key] = Factory(factory)<EOL><DEDENT>
Registers a factory function for creating the class
:argument key name under which the dependencies will be
registered
:argument factory a function that receives the constructor as first
argument and is used to create the class
:argument shared if True, the factory result will be saved for reuse.
This means that the same instance will be returned once the same key
is requested again. If False requesting the same key will always return
a new instance. Autoresolved classes will always be shared