Wrap a dict-like class and return the resulting class. The wrapped class and used to keep global in the current thread. Args: dict_class: Class used for keeping context. .. deprecated:: 22.1.0
(dict_class: type[Context])
| 79 | |
| 80 | |
| 81 | def wrap_dict(dict_class: type[Context]) -> type[Context]: |
| 82 | """ |
| 83 | Wrap a dict-like class and return the resulting class. |
| 84 | |
| 85 | The wrapped class and used to keep global in the current thread. |
| 86 | |
| 87 | Args: |
| 88 | dict_class: Class used for keeping context. |
| 89 | |
| 90 | .. deprecated:: 22.1.0 |
| 91 | """ |
| 92 | _deprecated() |
| 93 | Wrapped = type( |
| 94 | "WrappedDict-" + str(uuid.uuid4()), (_ThreadLocalDictWrapper,), {} |
| 95 | ) |
| 96 | Wrapped._tl = ThreadLocal() # type: ignore[attr-defined] |
| 97 | Wrapped._dict_class = dict_class # type: ignore[attr-defined] |
| 98 | |
| 99 | return Wrapped |
| 100 | |
| 101 | |
| 102 | TLLogger = TypeVar("TLLogger", bound=BindableLogger) |
searching dependent graphs…