1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
U
¸ý°dã@stddlmZddlmZddlZddlmZddlmZddlm    Z    d    Z
d
d „Z d d „Z dd„Z dd„Zdd„ZdS)é)Ú annotations)ÚwrapsNé)Úconfigé)Ú_util_async_run©Ú"_util_async_run_coroutine_functionTcOst|f|ž|ŽS©Nr©ÚfnÚargsÚkwargs©rúQd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/testing/asyncio.pyÚ_run_coroutine_function#srcOsts|||ŽSt|f|ž|ŽS)aRun a function in an asyncio loop unconditionally.
 
    This function is used for provisioning features like
    testing a database connection for server info.
 
    Note that for blocking IO database drivers, this means they block the
    event loop.
 
    )ÚENABLE_ASYNCIOrr rrrÚ _assume_async's 
rcOs2ts|||ŽStjr$t|f|ž|ŽS|||ŽSdS)a¸Run a function in an asyncio loop if any current drivers might need it.
 
    This function is used for provisioning features that take
    place outside of a specific database driver being selected, so if the
    current driver that happens to be used for the provisioning operation
    is an async driver, it will run in asyncio and not fail.
 
    Note that for blocking IO database drivers, this means they block the
    event loop.
 
    N)rrZ    any_asyncrr rrrÚ_maybe_async_provisioning8s
 
rcOs8ts|||ŽStjj}|r*t|f|ž|ŽS|||ŽSdS)zÇRun a function in an asyncio loop if the current selected driver is
    async.
 
    This function is used for test setup/teardown and tests themselves
    where the current DB driver is known.
 
 
    N)rrÚ_currentÚis_asyncr)r r rrrrrÚ _maybe_asyncMs     
rcsNt ˆ¡r6tƒ‰‡fdd„‰tˆƒ‡‡‡fdd„ƒ}ntˆƒ‡fdd„ƒ}|S)z×Apply the _maybe_async function to an existing function and return
    as a wrapped callable, supporting generator functions as well.
 
    This is currently used for pytest fixtures that support generator use.
 
    cs(z
t|ƒWStk
r"ˆYSXdSr
)ÚnextÚ StopIteration)Úgen)Ú_stoprrÚ    call_nextms
z'_maybe_async_wrapper.<locals>.call_nextc?s*ˆ||Ž}tˆ|ƒ}|ˆkrq&|Vq
dSr
©r)r rrÚvalue©rrr rrÚ wrap_fixturets
 
 
z*_maybe_async_wrapper.<locals>.wrap_fixturecstˆf|ž|ŽSr
r)r r)r rrr s)ÚinspectÚisgeneratorfunctionÚobjectr)r r rrrÚ_maybe_async_wrapperbs
 
r$)Ú
__future__rÚ    functoolsrr!ÚrZutil.concurrencyrr    rrrrrr$rrrrÚ<module>s