L i2"ddlmZddlZddlmZddlmZddlmZddlmZddlmZdd lm Z dd l m Z dd l m Z dd l mZejse s d dlmZd dlmZn ddlmZddlmZedegefZddZGdde ZGddZy)) annotationsN)Any)Callable)Optional)TypeVar)exc)util)HAS_CYEXTENSION)Protocol)Self)_distill_params_20)_distill_raw_params_C)boundc8tjfd}|S)zDecorator, 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]``. c|j} |jS#t$r|||x|j<}|cYSwxYwN)connectinfoKeyError)fnself connectionvalkeys \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/engine/util.py decoratedz%connection_memoize..decorated+sS'')  ??3' ' )+D*)= =JOOC 3J s"#AA)r decorator)rrs` rconnection_memoizer!$s# ^^ ceZdZUded<y) _TConsSubjectzOptional[TransactionalContext]_trans_context_managerN)__name__ __module__ __qualname____annotations__r"rr$r$7s::r"r$czeZdZUdZdZded<ddZddZddZddZ dd Z dd Z dd Z e dd Zdd ZddZy)TransactionalContextzApply 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.ctrNotImplementedErrorrs r_transaction_is_activez+TransactionalContext._transaction_is_activeG !##r"ctrr1r3s r_transaction_is_closedz+TransactionalContext._transaction_is_closedJr5r"ct)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 r1r3s r_rollback_can_be_calledz,TransactionalContext._rollback_can_be_calledMs "##r"ctrr1r3s r _get_subjectz!TransactionalContext._get_subject^r5r"ctrr1r3s rcommitzTransactionalContext.commitar5r"ctrr1r3s rrollbackzTransactionalContext.rollbackdr5r"ctrr1r3s rclosezTransactionalContext.closegr5r"cl|j}|r&|jstjdyy)NzCan't operate on closed transaction inside context manager. Please complete the context manager before emitting further commands.)r%r4r InvalidRequestError)clssubject trans_contexts r_trans_ctx_checkz%TransactionalContext._trans_ctx_checkjs>66  779--8: r"ch|j}|j}||_||_||_|Sr)r;r%r-r.)rrErFs r __enter__zTransactionalContext.__enter__us:##% 66 -%)-& r"ct|dd}|duxs|j|u}|G|jr7 |j|s|J|j|_dx|_ |_y |js!|js1|jn |j r|j|s|J|j|_dx|_ |_y#t j 5|j r|jdddn #1swYnxYwYxYw#|s|J|j|_dx|_ |_wxYw#|s|J|j|_dx|_ |_wxYw)Nr.) getattrr%r4r=r safe_reraiser9r?r-r.r7rA)rtype_value tracebackrEout_of_band_exits r__exit__zTransactionalContext.__exit__s$ 0$7 tO Iw==TI  =T88: C ("...595J5JG2>BB#d&; C224668 335 '"...595J5JG2>BB#d&;+ (&&((335 (((("...595J5JG2>BB#d&;("...595J5JG2>BB#d&;s<C#,AE#D19!D# D1#D, (D1/D44'E'FN)returnbool)rRr$)rRNone)rEr$rRrT)rRr )rMrrNrrOrrRrT)r&r'r(__doc__ __slots__r)r4r7r9r;r=r?rA classmethodrGrIrQr*r"rr,r,;sWFI++$$$"$$$$ &Cr"r,)rstrrRzCallable[[_C], _C]) __future__rtypingrrrrr r util._has_cyr util.typingr r TYPE_CHECKING_py_utilrrsqlalchemy.cyextension.utilrr!r$r,r*r"rrasy# *" BD T"c'*+&;H;lClCr"