我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用dummy_threading.local()。
def __init__(self, init=None): if init is None: init = {} def callback(): return scoped_session( sessionmaker(class_=RoutedSession, registry=dbs) ) self._session_factory = callback self.storage = threading.local() self.storage.lazies = {} self.storage.concrete = {} self.storage.metadatas = {} self.lazies.update(init)