ML iddlmZddlmZmZmZmZmZddlm Z m Z m Z m Z m Z mZddlmZGddeZGddZy ) ) annotations) ParamSpecExprSymbolTableNode TypeVarExprTypeVarLikeExprTypeVarTupleExpr)ParamSpecFlavor ParamSpecType TypeVarIdTypeVarLikeTypeTypeVarTupleType TypeVarType)TypeTraverserVisitorcDeZdZdZddZdfd Zdfd Zd fd ZxZS) TypeVarLikeNamespaceSetterz-Set namespace for all TypeVarLikeTypes types.c||_yN namespaceselfrs U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/tvar_scope.py__init__z#TypeVarLikeNamespaceSetter.__init__s "cZ|j|j_t| |yr)ridsupervisit_type_varrt __class__s rrz)TypeVarLikeNamespaceSetter.visit_type_vars q!rcX|j|j_t| |Sr)rrrvisit_param_specrs rr#z+TypeVarLikeNamespaceSetter.visit_param_specs"w'**rcZ|j|j_t| |yr)rrrvisit_type_var_tuplers rr%z/TypeVarLikeNamespaceSetter.visit_type_var_tuple#s $Q'r)rstrreturnNone)r rr'r()r r r'r()r r r'r() __name__ __module__ __qualname____doc__rrr#r% __classcell__)r!s@rrrs7#"+((rrc|eZdZdZ d ddZddZddZddZddZddZ dd Z dd Z dd Z dd Z y)TypeVarLikeScopezvScope that holds bindings for type variables and parameter specifications. Node fullname -> TypeVarLikeType. Nci|_||_d|_d|_||_||_||_|#|j|_|j|_yy)aVInitializer for TypeVarLikeScope Parameters: parent: the outer scope for this scope is_class_scope: True if this represents a generic class prohibited: Type variables that aren't strictly in scope exactly, but can't be bound because they're part of an outer class's scope. rN)scopeparentfunc_idclass_idis_class_scope prohibitedr)rr2r5r6rs rrzTypeVarLikeScope.__init__.sW24    ,$"  !>>DL"OODM rc\|}|'|jr|j}| |jr|S)zAGet the nearest parent that's a function scope, not a class scope)r5r2)rits rget_function_scopez#TypeVarLikeScope.get_function_scopeHs1&*n!2!2Bn!2!2 rc||jvry|jr|jj|sy|jr|jj|syy)NFT)r1r2 allow_bindingr6)rfullnames rr;zTypeVarLikeScope.allow_bindingOsJ tzz ! [[!:!:8!D __T__%B%B8%Lrc t|dd|S)z&A new scope frame for binding a methodFNr)r/rs r method_framezTypeVarLikeScope.method_frameXseTYGGrc<t|jd||S)zEA new scope frame for binding a class. Prohibits *this* class's tvarsTr)r/r9rs r class_framezTypeVarLikeScope.class_frame\s 7 7 94QZ[[rcV|xjdzc_t|jS)zHUsed by plugin-like code that needs to make synthetic generic functions.)r3r )rs rnew_unique_func_idz#TypeVarLikeScope.new_unique_func_id`s  &&rc |jr"|xjdz c_|j}n!|xjdzc_|j}|j}|jj t |t|trft||jt|||j|j|j|j|j|j  }nt|t"r_t%||jt||t&j(|j|j|j|j }nmt|t*r[t-||jt|||j|j.|j|j|j }nJ||j0|j<|S)NrBr) namer<rvalues upper_bounddefaultvariancelinecolumn)rEr<rflavorrGrHrJrK)rEr<rrGtuple_fallbackrHrJrK)r5r4r3rrHacceptr isinstancerrr<r rFrGrIrJrKrr r BARErr rMr1)rrE tvar_exprirtvar_defs rbind_newzTypeVarLikeScope.bind_newes    MMQ M A LLA L ANN   !;I!FG i -(3"++Q)4 ''%11!))"++^^ '' )H = 1$"++Q)4&++%11!))^^ '' H #3 4'"++Q)4%11(77!))^^ '' H 5)1 9%%&rc6||j|j<yr)r1r<)rrSs r bind_existingzTypeVarLikeScope.bind_existings(0 8$$%rct|tr |jn|}|sJ||jvr|j|S|j|jj |Syr)rOrr<r1r2 get_binding)ritemr<s rrXzTypeVarLikeScope.get_bindingsZ$.t_$E4==4x tzz !::h' ' [[ $;;**84 4rcdjd|jjD}|j|S|jd|S)Nz, c3^K|]%\}}|d|jd|j'yw)z: `N)rEr).0kvs r z+TypeVarLikeScope.__str__..s-N41a!Bqvvhav.Ns+-z <- )joinr1itemsr2)rmes r__str__zTypeVarLikeScope.__str__sG YYN4::;K;K;MN N ;; I++d2$''r)NFN) r2TypeVarLikeScope | Noner5boolr6rfrr&r'r()r'rf)r<r&r'rg)rr&r'r/)r'r )rEr&rQrr'r )rSr r'r()rYzstr | SymbolTableNoder'zTypeVarLikeType | None)r'r&)r)r*r+r,rr9r;r>r@rCrTrVrXrdrrr/r/(sz+/$.2 ,',,, ,  ,  ,4H\' /b1(rr/N) __future__r mypy.nodesrrrrr mypy.typesr r r r r rmypy.typetraverserrrr/rhrrrms:"4(!5(&((r