ML iUdZddlmZddlmZddlmZmZddlm Z ddl m Z ddl mZmZeee ee efZded <Gd d Zy ) zTrack current scope to easily calculate the corresponding fine-grained target. TODO: Use everywhere where we track targets, including in mypy.errors. ) annotations)Iterator)contextmanager nullcontext)Optional) TypeAlias)FuncBaseTypeInfo _TypeAlias SavedScopeceZdZdZddZddZddZddZddZddZ e ddZ e dd Z dd Z dd Zdd Ze dd ZddZe ddZy)Scopez7Track which target we are processing at any given time.cJd|_g|_d|_g|_d|_yNr)moduleclassesfunction functionsignoredselfs P/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/scope.py__init__zScope.__init__s%"& ') )- )+ c6|jsJ|jSN)rrs rcurrent_module_idzScope.current_module_ids{{{{{rc|jsJ|jr|jj}|xsdS|jS)zKReturn the current target (non-class; for a class return enclosing module).)rrfullname)rr s rcurrent_targetzScope.current_target!s8{{{ ==}}--H>r !{{rc|jsJ|jr|jjS|jr|jdjS|jS)z+Return the current target (may be a class).)rrr rrs rcurrent_full_targetzScope.current_full_target)sK{{{ ====)) ) <<<<#,, ,{{rcP|jr|jdjSdS)z1Return the current type's short name if it existsr#N)rnamers rcurrent_type_namezScope.current_type_name2s"(, t||B$$>$>rcJ|jr|jjSdS)z5Return the current function's short name if it existsN)rr&rs rcurrent_function_namezScope.current_function_name6s%)]]t}}!!<K|jj||js||_n|xjdz c_d|jj |jr|xjdzc_y|jsJd|_yw)N)rappendrrpop)rfdefs rfunction_scopezScope.function_scopeDsq d#}} DM LLA L   << LLA L== = DMsBBc |jddS)Nr#)rrs router_functionszScope.outer_functionsUs~~cr""rc~|js|jj|y|xjdz c_y)zEnter a class target scope.r.N)rrr/rrinfos r enter_classzScope.enter_classXs+}} LL   % LLA Lrc|jr|xjdzc_y|jsJ|jjy)zLeave a class target scope.r.N)rrr0rs r leave_classzScope.leave_class`s3 << LLA L<< < LL   rc#VK|j|d|jywr)r8r:r6s r class_scopezScope.class_scopejs#   s')c|jsJ|jr|jdnd}|j||jfS)zT((2KM       sKBB BA4B#B + B4A= 9BB B  BBN)returnNone)rCstr)rCz str | None)r+rErCIterator[None])r1r rCrF)rCzlist[FuncBase])r7r rCrD)r7r rCrF)rCr )rAr rCrF)__name__ __module__ __qualname____doc__rrr!r$r'r)rr,r2r4r8r:r<r?rBrrrrsA?=!! # /rrN)rJ __future__rcollections.abcr contextlibrrtypingrtyping_extensionsrr mypy.nodesr r tuplerEr __annotations__rrKrrrTsJ #$25)sHX$68JJK JKllr