bgSdZddlmZddlZddlmZddlZddlmZmZddl m Z ddl m Z ddlmZerdd lmZGd d e jZddZdS)z=Checker for anything related to the async protocol (PEP 492).) annotationsN) TYPE_CHECKING)nodesutil)checkers)utils)decorated_with)PyLinterceZdZdZdddddifddd ddifd Zdd ZejdddZejdddZ dS) AsyncCheckerasynczYield inside async functionyield-inside-async-functionzQUsed when an `yield` or `yield from` statement is found inside an async function. minversionzFAsync context manager '%s' doesn't implement __aenter__ and __aexit__.not-async-context-managerzxUsed when an async context manager is used with an object that does not implement the async context management protocol.)E1700E1701returnNonecB|jjj|_dg|_dS)Nzcontextlib.asynccontextmanager)linterconfigmixin_class_rgx_mixin_class_rgx_async_generators)selfs f/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pylint/checkers/async.pyopenzAsyncChecker.open*s# $ 2 B"B!Cnodenodes.AsyncFunctionDefc|tjD]a}||urItjdddkst |tjr|d|bdS)Nrr)r") nodes_of_classrYieldscopesys version_info isinstance YieldFrom add_message)rr"childs rvisit_asyncfunctiondefz#AsyncChecker.visit_asyncfunctiondef.s((55 L LE{{}}$$ !$..*UEO2T2T.  !>U KKK  L Lr!nodes.AsyncWithc|jD]m\}}tj|}|t|tjr7t|t jrt||j rgnt|tj j rt|j |j rn |d|d#tjj$rit|tjrLtj|sYd|jjjvr"|j|jrYIYnwxYw|d||jfodS)N __aenter__ __aexit__r)r"args)items checker_utils safe_inferr+rUninferableBaserAsyncFunctionDefr rastroidbasesAsyncGeneratorparentgetattr exceptions NotFoundErrorInstancehas_known_basesrrignored_checks_for_mixinsrmatchnamer-)rr"ctx_mgr_inferreds rvisit_asyncwithzAsyncChecker.visit_asyncwith6s*$ $ JGQ$/88H:h8L#M#M(E$:;; "(D,BCCHgm&BCC "(/43IJJ$$\222$$[111)7 % % %!(G,<== % -r[s DC"""""" 222222000000%$$$$$$EEEEE8'EEEP222222r!