Update singleton_thread_locals.py

fix
This commit is contained in:
RobinsonMa 2020-06-16 11:10:54 +08:00 committed by GitHub
parent efd6e3e7e5
commit f6751cef2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
"""`ThreadLocalSingleton` providers example.""" """`ThreadLocalSingleton` providers example."""
import threading import threading
import Queue from queue import Queue
import dependency_injector.providers as providers import dependency_injector.providers as providers
@ -15,7 +15,7 @@ def example(example_object, queue):
thread_local_object = providers.ThreadLocalSingleton(object) thread_local_object = providers.ThreadLocalSingleton(object)
# Create singleton provider for thread-safe queue: # Create singleton provider for thread-safe queue:
queue = providers.Singleton(Queue.Queue) queue = providers.ThreadSafeSingleton(Queue)
# Create callable provider for example(), inject dependencies: # Create callable provider for example(), inject dependencies:
example = providers.DelegatedCallable(example, example = providers.DelegatedCallable(example,