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
U
¸ý°dÙã@söddlmZddlZddlmZddlmZddlmZddlmZddlmZdd    lm    Z    dd
l
m Z dd l m Z ejs~e s˜d d lmZd dlmZndd lmZddlmZedegefdZdddœdd„ZGdd„de ƒZGdd„dƒZdS)é)Ú annotationsN)ÚAny)ÚCallable)ÚOptional)ÚTypeVaré)Úexc)Úutil)ÚHAS_CYEXTENSION)ÚProtocolé)Ú_distill_params_20)Ú_distill_raw_paramsÚ_C)ÚboundÚstrzCallable[[_C], _C])ÚkeyÚreturncstj‡fdd„ƒ}|S)zËDecorator, memoize a function in a connection.info stash.
 
    Only applicable to functions which take no arguments other than a
    connection.  The memo will be stored in ``connection.info[key]``.
    csF| ¡}z |jˆWStk
r@|||ƒ|jˆ<}|YSXdS©N)ÚconnectÚinfoÚKeyError)ÚfnÚselfÚ
connectionÚval©r©úMd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/engine/util.pyÚ    decorated*s  z%connection_memoize.<locals>.decorated)r    Ú    decorator)rrrrrÚconnection_memoize#sr!c@seZdZUded<dS)Ú _TConsSubjectzOptional[TransactionalContext]Ú_trans_context_managerN)Ú__name__Ú
__module__Ú __qualname__Ú__annotations__rrrrr"6s
r"c@s¶eZdZUdZdZded<ddœdd„Zddœd    d
„Zddœd d „Zd dœdd„Z    ddœdd„Z
ddœdd„Z ddœdd„Z e d ddœdd„ƒZddœdd„Zdddddœdd„Zd S)!ÚTransactionalContextzÀApply Python context manager behavior to transaction objects.
 
    Performs validation to ensure the subject of the transaction is not
    used if the transaction were ended prematurely.
 
    )Ú_outer_trans_ctxÚ_trans_subjectÚ __weakref__zOptional[_TConsSubject]r*Úbool)rcCs
tƒ‚dSr©ÚNotImplementedError©rrrrÚ_transaction_is_activeFsz+TransactionalContext._transaction_is_activecCs
tƒ‚dSrr-r/rrrÚ_transaction_is_closedIsz+TransactionalContext._transaction_is_closedcCs
tƒ‚dS)aindicates the object is in a state that is known to be acceptable
        for rollback() to be called.
 
        This does not necessarily mean rollback() will succeed or not raise
        an error, just that there is currently no state detected that indicates
        rollback() would fail or emit warnings.
 
        It also does not mean that there's a transaction in progress, as
        it is usually safe to call rollback() even if no transaction is
        present.
 
        .. versionadded:: 1.4.28
 
        Nr-r/rrrÚ_rollback_can_be_calledLsz,TransactionalContext._rollback_can_be_calledr"cCs
tƒ‚dSrr-r/rrrÚ _get_subject]sz!TransactionalContext._get_subjectÚNonecCs
tƒ‚dSrr-r/rrrÚcommit`szTransactionalContext.commitcCs
tƒ‚dSrr-r/rrrÚrollbackcszTransactionalContext.rollbackcCs
tƒ‚dSrr-r/rrrÚclosefszTransactionalContext.close)ÚsubjectrcCs |j}|r| ¡st d¡‚dS)Nz‚Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.)r#r0rZInvalidRequestError)Úclsr8Ú trans_contextrrrÚ_trans_ctx_checkis ÿz%TransactionalContext._trans_ctx_checkcCs$| ¡}|j}||_||_||_|Sr)r3r#r)r*)rr8r:rrrÚ    __enter__ts zTransactionalContext.__enter__r)Útype_ÚvalueÚ    tracebackrc Csôt|ddƒ}|dkp|j|k    }|dkrš| ¡ršzBz | ¡Wn0t ¡|     ¡r^| 
¡W5QRXYnXW5|sŠ|dk    s‚t‚|j|_d|_|_XnVz.| ¡s¶|  ¡sÆ|  ¡n|     ¡rÆ| 
¡W5|sâ|dk    sÚt‚|j|_d|_|_XdS)Nr*) Úgetattrr#r0ÚAssertionErrorr)r*r5r    Z safe_reraiser2r6r1r7)rr=r>r?r8Zout_of_band_exitrrrÚ__exit__€s0
ÿ 
 
  zTransactionalContext.__exit__N)r$r%r&Ú__doc__Ú    __slots__r'r0r1r2r3r5r6r7Ú classmethodr;r<rBrrrrr(:s
 
 r()Ú
__future__rÚtypingrrrrÚrr    Z util._has_cyr
Z util.typingr Ú TYPE_CHECKINGZ_py_utilr rZsqlalchemy.cyextension.utilrr!r"r(rrrrÚ<module>s$