def register(cls, key: str, store_factory, default: bool=False):
"""
Registers the store factory into stores registry, use :meth:`unregister` to remove it.
:param key: The unique key for store.
:param store_factory: A callable that returns an instance of :class:`.Store`.
:param default: If :data:`True` the given store will be marked as default also. in addition you can use
:meth:`.make_default` to mark a store as default.
"""
_factories[key] = store_factory
if default:
cls._default = key
评论列表
文章目录