o 3Ûøa$ã@sNddlZddlZddlZddlmZddlmZerejZnejZdd„Z dS)éN)ÚSynchronousOnlyOperation)ÚPY37cs(‡fdd„}tˆƒrˆ}d‰||ƒS|S)z• Decorator to mark functions as async-unsafe. Someone trying to access the function while in an async context will get an error message. cst ˆ¡‡‡fdd„ƒ}|S)NcsLtj d¡sztƒ}Wn tyYn wts| ¡rtˆƒ‚ˆ|i|¤ŽS)NÚDJANGO_ALLOW_ASYNC_UNSAFE)ÚosÚenvironÚgetÚget_running_loopÚ RuntimeErrorrÚ is_runningr)ÚargsÚkwargsÚ event_loop)ÚfuncÚmessage©ú6/usr/lib/python3/dist-packages/django/utils/asyncio.pyÚinners   ÿ z.async_unsafe..decorator..inner)Ú functoolsÚwraps)rr©r)rrÚ decorators zasync_unsafe..decoratorzKYou cannot call this from an async context - use a thread or sync_to_async.)Úcallable)rrrrrrÚ async_unsafes r) ÚasynciorrÚdjango.core.exceptionsrÚdjango.utils.versionrrÚget_event_looprrrrrÚs