L iA0ZdZddlmZddlmZddlmZddlm Z ddlm Z ddlmZdd lm Z dd l m Z dd l mZdd lmZdd lmZddlmZddlmZGddej*ZGddej.ZGddej.ZeZeZGddZddZy)zEvaluation functions used **INTERNALLY** by ORM DML use cases. This module is **private, for internal use by SQLAlchemy**. .. versionchanged:: 2.0.4 renamed ``EvaluatorCompiler`` to ``_EvaluatorCompiler``. ) annotations)Type)exc)LoaderCallableStatus) PassiveFlag)inspect)and_) operators) Concatenable)Integer)Numeric)warn_deprecatedc eZdZy)UnevaluatableErrorN)__name__ __module__ __qualname__^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/orm/evaluator.pyrr%srrceZdZdZdZy) _NoObjectcyNrselfargkws roperatez_NoObject.operate*rcyrrrs rreverse_operatez_NoObject.reverse_operate-r"rNrrrr!r$rrrrr) rrceZdZdZdZy)_ExpiredObjectc|Srrrs rr!z_ExpiredObject.operate2 rc|Srrrs rr$z_ExpiredObject.reverse_operate5r*rNr%rrrr(r(1r&rr(ceZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZeZeZeZeZeZeZeZeZeZeZeZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'y)_EvaluatorCompilerNc||_yr) target_cls)rr/s r__init__z_EvaluatorCompiler.__init__>s $rc|r t|g|}t|d|jd}|s!tdt |j ||S)Nvisit_Cannot evaluate )r getattr__visit_name__rtyper)rclauseclausesmeths rprocessz_EvaluatorCompiler.processAsa &+7+Ftvf&;&;%<=tD$"4<#8#8"9: F|rc8|j|jSr)r:elementrr7s rvisit_groupingz!_EvaluatorCompiler.visit_groupingLs||FNN++rcdS)Ncyrrobjs rz/_EvaluatorCompiler.visit_null..Prrr=s r visit_nullz_EvaluatorCompiler.visit_nullOrcdS)Ncy)NFrrAs rrCz0_EvaluatorCompiler.visit_false..SrDrrr=s r visit_falsez_EvaluatorCompiler.visit_falseRs  rcdS)Ncy)NTrrAs rrCz/_EvaluatorCompiler.visit_true..VrDrrr=s r visit_truez_EvaluatorCompiler.visit_trueUrFrc |jd}|jr8t |j|j std|j |j  |j|j}|j|jfd}|S#t$r}td||d}~wwxYw#tj$r}td||d}~wwxYw)N parentmapperzCannot evaluate column: z0Can't evaluate criteria against alternate class zCannot evaluate expression: c|tSt|}|j}j||tj }|t jurtS|S)N)passive) _NO_OBJECTr dictgetrPASSIVE_NO_FETCHrPASSIVE_NO_RESULT_EXPIRED_OBJECT)rBstatedict_valueimpls rget_corresponding_attrz?_EvaluatorCompiler.visit_column..get_corresponding_attrs\{!!CLEJJEHHuk&B&BE,>>>&&Lr) _annotationsKeyErrorrr/ issubclassclass__check_configure_columntopropertykeyorm_excUnmappedColumnError class_managerrZ)rr7rNkerberrr[rZs @r visit_columnz_EvaluatorCompiler.visit_columnXs !..~>L ??: OO\00$ %##/#6#6"79  %%' 008<.evaluatesNH * 5 $S)O+**#4u}  5rrrrsrur7rs ` rvisit_or_clauselist_opz)_EvaluatorCompiler.visit_or_clauselist_ops rcfd}|S)NcdD]*}||}|turtcS|r||turyyyr)rVrQ)rBrrYrus rrz<_EvaluatorCompiler.visit_and_clauselist_op..evaluatesD * ! $S)O+**}(;#  !rrrs ` rvisit_and_clauselist_opz*_EvaluatorCompiler.visit_and_clauselist_ops rcfd}|S)Ncg}D]7}||}|turtcS||tury|j|9t|Sr)rVrQappendtuple)rBvaluesrrYrus rrzA_EvaluatorCompiler.visit_comma_op_clauselist_op..evaluatesVF * % $S)O+**]ez&9 e$  %= rrrs ` rvisit_comma_op_clauselist_opz/_EvaluatorCompiler.visit_comma_op_clauselist_ops !rct|jr|j||||Std|jd)NzCustom operator zR can't be evaluated in Python unless it specifies a callable using `.python_impl`.) python_impl_straight_evaluateropstringrrsr|r}r7s rvisit_custom_op_binary_opz,_EvaluatorCompiler.visit_custom_op_binary_opsP   **)Z %"8#4#4"78"" rcfd}|S)NcZ|}|}|tus|turtS||k(SrrrBleft_val right_valr|r}s rrz7_EvaluatorCompiler.visit_is_binary_op..evaluate5 ~H"3I?*i?.J&&y( (rrrrsr|r}r7rs `` rvisit_is_binary_opz%_EvaluatorCompiler.visit_is_binary_op )rcfd}|S)NcZ|}|}|tus|turtS||k7Srrrs rrz;_EvaluatorCompiler.visit_is_not_binary_op..evaluaterrrrs `` rvisit_is_not_binary_opz)_EvaluatorCompiler.visit_is_not_binary_oprrcfd}|S)Nc|}|}|tus|turtS||y||Srr)rBrrr|r}rss rrz7_EvaluatorCompiler._straight_evaluate..evaluatesM ~H"3I?*i?.J&&!Y%6IcNJsO< .(s1J#6aDrrrs rvisit_in_op_binary_opz(_EvaluatorCompiler.visit_in_op_binary_op&s!&& @      rc,|jd|||S)Nc|tur||vSdSrrrs rrCz>_EvaluatorCompiler.visit_not_in_op_binary_op..2sq ':!rrrs rvisit_not_in_op_binary_opz,_EvaluatorCompiler.visit_not_in_op_binary_op.s#&& D      rcpt|jjjtr.t|j jjtsFt d|jd|jjd|j j|jd|||S)Nz&Cannot evaluate concatenate operator "rrc ||zSrrrs rrCz>_EvaluatorCompiler.visit_concat_op_binary_op..Fs Qr) r^rzr6rr r{rrrrs rvisit_concat_op_binary_opz,_EvaluatorCompiler.visit_concat_op_binary_op8s KK   + +\ FLL--<.Msarrrs rvisit_startswith_op_binary_opz0_EvaluatorCompiler.visit_startswith_op_binary_opIs && ()Z  rc,|jd|||S)Nc$|j|Sr)endswithrs rrCz@_EvaluatorCompiler.visit_endswith_op_binary_op..TsArrrs rvisit_endswith_op_binary_opz._EvaluatorCompiler.visit_endswith_op_binary_opPs && & :v  rc|j|j|jtjurfd}|St dt |jd|j)Nc<|}|turtS|y| Srr)rBrY eval_inners rrz0_EvaluatorCompiler.visit_unary..evaluate[s*"3O+**] y rr3ry)r:r<rsr invrr6r)rr7rrs @r visit_unaryz_EvaluatorCompiler.visit_unaryWsd\\&..1 ??imm + !O tF|4456#__- /  rc`|jr|jn |jfdS)NcSrr)rBvals rrCz4_EvaluatorCompiler.visit_bindparam..ns3r)callablerY)rr7rs @rvisit_bindparamz"_EvaluatorCompiler.visit_bindparamis% ??//#C,,Crr)(rrrr0r:r>rErIrLrhrlrorkr~rrrrrrrrvisit_add_binary_opvisit_mul_binary_opvisit_sub_binary_opvisit_mod_binary_opvisit_truediv_binary_opvisit_lt_binary_opvisit_le_binary_opvisit_ne_binary_opvisit_gt_binary_opvisit_ge_binary_opvisit_eq_binary_oprrrrrrrrrrr-r-=s% , ! 4&l--       P:999=++++++   "   $rr-cZ|dk(rtddtStdtd|)NEvaluatorCompilerzDirect use of 'EvaluatorCompiler' is not supported, and this name will be removed in a future release. '_EvaluatorCompiler' is for internal use onlyz2.0zmodule z has no attribute )rr-AttributeErrorr)names r __getattr__rqs> "" <   "!wxl2DTHMNNrN)rstrreturnzType[_EvaluatorCompiler])__doc__ __future__rtypingrrrcbaserrr sqlr r sql.sqltypesr rrutilrInvalidRequestErrorrColumnOperatorsrr(rQrVr-rrrrrs#&'""" 00  ))Y..[  "qqh Or