Check for changes in contextvars, and set them to the current context for downstream consumers.
(context)
| 25 | |
| 26 | |
| 27 | def _restore_context(context): |
| 28 | """ |
| 29 | Check for changes in contextvars, and set them to the current |
| 30 | context for downstream consumers. |
| 31 | """ |
| 32 | for cvar in context: |
| 33 | cvalue = context.get(cvar) |
| 34 | try: |
| 35 | if cvar.get() != cvalue: |
| 36 | cvar.set(cvalue) |
| 37 | except LookupError: |
| 38 | cvar.set(cvalue) |
| 39 | |
| 40 | |
| 41 | async def _run_parallel(*coros): |
no test coverage detected