Create a `_tracing` instance member to store the thread-local tracing state value.
(self)
| 72 | """ |
| 73 | |
| 74 | def _init_trace_threadlocal(self): |
| 75 | """Create a `_tracing` instance member to store the thread-local tracing state value.""" |
| 76 | # needed since this class is meant to be a trait with no constructor |
| 77 | if not hasattr(self, "_tracing"): |
| 78 | self._tracing = threading.local() |
| 79 | |
| 80 | # This is True while the above initialising _tracing is False when this is |
| 81 | # called from a different thread than the one initialising _tracing. |
| 82 | if not hasattr(self._tracing, "value"): |
| 83 | self._tracing.value = MONAIEnvVars.trace_transform() != "0" |
| 84 | |
| 85 | def __getstate__(self): |
| 86 | """When pickling, remove the `_tracing` member from the output, if present, since it's not picklable.""" |
no test coverage detected