ML i<UdZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddl mZmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddl m!Z!dd l"m#Z#dd l$m%Z%m&Z&dd l'm(Z(dd l)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;d Zde=d<e GddZ?e Gdde?Z@d'dZAd(dZBGdde ZCdddd d)dZDdddd d)dZEGdd e&ZFd*d!ZGd+d"ZHe d,d#ZIe d- d.d$ZI d- d/d%ZId0d&ZJy)1z@Shared definitions used by different parts of semantic analysis.) annotations)abstractmethod)CallableFinalLiteralProtocoloverload)trait) LITERAL_REQ ErrorCode)CallExprClassDefContextDataclassTransformSpec Decorator ExpressionFuncDefNameExprNodeOverloadedFuncDefRefExpr SymbolNode SymbolTableSymbolTableNodeTypeInfo)SemanticAnalyzerPluginInterface)TypeVarLikeScope) ANY_STRATEGY BoolTypeQuery)make_simplified_union)TPDICT_FB_NAMESAnyType FunctionLikeInstance ParametersParamSpecFlavor ParamSpecTypePlaceholderType ProperType TupleTypeType TypeOfAny TypeVarIdTypeVarLikeTypeTypeVarTupleType UnpackTypeflatten_nested_tuplesget_proper_type) __slots__ __deletable____match_args__rALLOW_INCOMPATIBLE_OVERRIDEPRIORITY_FALLBACKScfeZdZdZe d ddZeddZeddZe dddd ddZedd dd Z edd Z edd Z eddd Z eddZ eeddZed dZeeddZeddZeed!dZy)"SemanticAnalyzerCoreInterfacezA core abstract interface to generic semantic analyzer functionality. This is implemented by both semantic analyzer passes 2 and 3. FctNNotImplementedErrorselfnamectxsuppress_errorss Y/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/semanal_shared.pylookup_qualifiedz.SemanticAnalyzerCoreInterface.lookup_qualifiedH "!ctr<r=r@fullnames rDlookup_fully_qualifiedz4SemanticAnalyzerCoreInterface.lookup_fully_qualifiedN!!rGctr<r=rIs rDlookup_fully_qualified_or_nonezr )rfallbackritem unpacked_types rDcalculate_tuple_fallbackrs##H == ! !%5 55 5 E%cii0 dJ '+DII6M-)9: / 0I0I J =(3!&&//3CC ]//23)) LL +513HMrGceZdZdddZy)_NamedTypeCallbackNcyr<rrs rD__call__z_NamedTypeCallback.__call__9srGr<r)rzr{r|rrrGrDrr8sVrGrN)rcolumnprefixc t|||tj|d|dgttj ||| S)Nrbuiltins.objectflavorrdefaultrrr)r'r&ARGSr"r,from_omitted_genericsrArJidnamed_type_funcrrrs rDparamspec_argsr<sN   ###$4GX7Y6Z[ 778   rGc t|||tj|d|d|dgttj ||| S)Nz builtins.dictz builtins.strrr)r'r&KWARGSr"r,rrs rDparamspec_kwargsrSsY   %%# on=O`?ab  778   rGc(eZdZdfd ZddZxZS)HasPlaceholdersc,t|tyr<)super__init__r)r@ __class__s rDrzHasPlaceholders.__init__ms &rGcy)NTr)r@ts rDvisit_placeholder_typez&HasPlaceholders.visit_placeholder_typepsrGrx)rr(rtrs)rzr{r|rr __classcell__)rs@rDrrls 'rGrc4|jtS)z=Check if a type contains any placeholder types (recursively).)rr)rs rDhas_placeholderrts ::o' ((rGct|tr |j}t|tr |j}t|t r |j }t|tr7|jD]}t|}||cSt|jSt|tr |jSt|tr |j}t|trh|j ddD]}|j|jcS|j"}|,|j$j|j$jSy)a^ Find the dataclass transform spec for the given node, if any exists. Per PEP 681 (https://peps.python.org/pep-0681/#the-dataclass-transform-decorator), dataclass transforms can be specified in multiple ways, including decorator functions and metaclasses/base classes. This function resolves the spec from any of these variants. Nr7)rr calleerrrfuncrrfind_dataclass_transform_specimplrdataclass_transform_specrrrmrometaclass_typero)r candidatespecbasers rDrrys&$!{{$ yy$ "yy$)*  I0;D  -TYY77$ ,,,$!yy$!HHQRL 5D,,8444 5 ,,  %.*=*=*V*V*b!&&?? ? rGcyr<rapi expressionrArs rDrequire_bool_literal_argumentrs rGcyr<rrs rDrrs rGc\t|}||jd|d|t|S|S)zWAttempt to interpret an expression as a boolean literal, and fail analysis if we can't."z*" argument must be a True or False literalrU)rrTr )rrrArvalues rDrrsB z "E } v? @*S^   LrGcdt|tr |jdk(ry|jdk(ryy)Nz builtins.TrueTzbuiltins.FalseF)rrrJ)rs rDrrs.$! ==O + ==, , rG)rr+rrrtr))rr*rtrw)rArrrJrrrr-rrrrrrrzParameters | Nonertr')rr+rtrs)rz Node | NonertzDataclassTransformSpec | None) r;SemanticAnalyzerInterface | SemanticAnalyzerPluginInterfacerrrArrrzLiteral[True, False]rtrsr<) rr rrrArrrrwrtr) rr rrrArrrrrtrr)Kr} __future__rabcrtypingrrrrr mypy_extensionsr mypy.errorcodesr r mypy.nodesr rrrrrrrrrrrrrr mypy.pluginrmypy.tvar_scopermypy.type_visitorrr mypy.typeopsr mypy.typesr!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r6rr8r:rrrrrrrrrrrrrGrDrsaF"??!2"8,9..&VUUEL"L"L"^p" =p"p"f  4FWW $   (     : $   (     2m) FT  D "       D       D    "rG