Ë =˜aãóê—dZddlmZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZed«Zede def¬«ZeeefZeZ e e!edee!efe"geeeeffZ#e deeedeedfffZ$Gd„de«Z%Gd„de«Z&e Gd „d!««Z'e Gd"„d#««Z(d0d$„Z)e*ed%«Z+d1d&„Z,e Gd'„d(««Z-e-Z.eeee!efee e gdffZ/Gd)„d*«Z0e0Z1Gd+„d,e0«Z2e Gd-„d««Z3e Gd.„d/««Z4y)2zA Internal hook annotation, representation and calling machinery. é)Ú annotationsN)Ú ModuleType)Ú AbstractSet)ÚAny)ÚCallable)ÚFinal)Úfinal)Ú Generator)ÚList)ÚMapping)ÚOptional)Úoverload)ÚSequence)ÚTuple)Ú TYPE_CHECKING)Ú TypedDict)ÚTypeVar)ÚUnioné)ÚResultÚ_TÚ_F.)ÚboundÚHookImplcó0—eZdZUdZded<ded<ded<y)Ú HookspecOptsz!Options for a hook specification.ÚboolÚ firstresultÚhistoricúWarning | NoneÚ warn_on_implN©Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú__annotations__©óú2/usr/lib/python3.12/site-packages/pluggy/_hooks.pyrr)s…Ù+ðÓàƒNà Ô r)rcóN—eZdZUdZded<ded<ded<ded<ded<ded <y ) Ú HookimplOptsz"Options for a hook implementation.rÚwrapperÚ hookwrapperÚ optionalhookÚtryfirstÚtrylastú str | NoneÚspecnameNr"r(r)r*r,r,4s0…Ù,ðƒMðÓðÓðƒNðƒMàÔr)r,cóš—eZdZdZdZdd„Ze d d d„«Ze d d d„«Z d dd„Zy)ÚHookspecMarkeraDecorator for marking functions as hook specifications. Instantiate it with a project_name to get a decorator. Calling :meth:`PluginManager.add_hookspecs` later will discover all marked functions if the :class:`PluginManager` uses the same project name. ©Ú project_namecó—||_y©Nr6©Úselfr7s r*Ú__init__zHookspecMarker.__init__Tó €Ø#/ˆÕr)Ncó—yr9r(©r;Úfunctionrrr!s r*Ú__call__zHookspecMarker.__call__Wó€ð r)có—yr9r(r?s r*rAzHookspecMarker.__call__arBr)có4‡‡‡‡—dˆˆˆˆfd„ }|�||«S|S)apIf passed a function, directly sets attributes on the function which will make it discoverable to :meth:`PluginManager.add_hookspecs`. If passed no function, returns a decorator which can be applied to a function later using the attributes supplied. :param firstresult: If ``True``, the 1:N hook call (N being the number of registered hook implementation functions) will stop at I<=N when the I'th function returns a non-``None`` result. See :ref:`firstresult`. :param historic: If ``True``, every call to the hook will be memorized and replayed on plugins registered after the call was made. See :ref:`historic`. :param warn_on_impl: If given, every implementation of this hook will trigger the given warning. See :ref:`warn_on_impl`. cóf•—‰r ‰r td«‚‰‰‰dœ}t|‰jdz|«|S)Nz'cannot have a historic firstresult hook)rrr!Ú_spec)Ú ValueErrorÚsetattrr7)ÚfuncÚoptsrrr;r!s €€€€r*Úsetattr_hookspec_optsz6HookspecMarker.__call__..setattr_hookspec_opts†sBø€Ù™KÜ Ð!JÓKÐKà*Ø$Ø ,ñ"ˆDô �D˜$×+Ñ+¨gÑ5°tÔ <؈Kr)©rIrÚreturnrr()r;r@rrr!rKs` ``` r*rAzHookspecMarker.__call__ks&û€÷6 ð ð Ð Ù(¨Ó2Ð 2à(Ð (r)©r7ÚstrrMÚNone)FFN) r@rrrrrr!r rMr)....) r@rPrrrrr!r rMúCallable[[_F], _F])NFFN) r@ú _F | Nonerrrrr!r rMú_F | Callable[[_F], _F]©r#r$r%r&Ú __slots__r<rrAr(r)r*r5r5Is÷„ñð"€Ió0ðð"ØØ'+ð  àð ðð ðð  ð %ð  ð ò  óð ððØØØ'*ð  àð ðð ðð  ð %ð  ð ò  óð ð#Ø!ØØ'+ð ))àð))ðð))ðð ))ð %ð ))ð !ô ))r)r5cóЗeZdZdZdZdd„Ze d d d„«Ze d d d„«Z d dd„Zy)ÚHookimplMarkeraDecorator for marking functions as hook implementations. Instantiate it with a ``project_name`` to get a decorator. Calling :meth:`PluginManager.register` later will discover all marked functions if the :class:`PluginManager` uses the same project name. r6có—||_yr9r6r:s r*r<zHookimplMarker.__init__¢r=r)có—yr9r(©r;r@r.r/r0r1r3r-s r*rAzHookimplMarker.__call__¥ó€ð r)có—yr9r(rZs r*rAzHookimplMarker.__call__²r[r)Ncó@‡‡‡‡‡‡‡—dˆˆˆˆˆˆˆfd„ }|€|S||«S)a If passed a function, directly sets attributes on the function which will make it discoverable to :meth:`PluginManager.register`. If passed no function, returns a decorator which can be applied to a function later using the attributes supplied. :param optionalhook: If ``True``, a missing matching hook specification will not result in an error (by default it is an error if no matching spec is found). See :ref:`optionalhook`. :param tryfirst: If ``True``, this hook implementation will run as early as possible in the chain of N hook implementations for a specification. See :ref:`callorder`. :param trylast: If ``True``, this hook implementation will run as late as possible in the chain of N hook implementations for a specification. See :ref:`callorder`. :param wrapper: If ``True`` ("new-style hook wrapper"), the hook implementation needs to execute exactly one ``yield``. The code before the ``yield`` is run early before any non-hook-wrapper function is run. The code after the ``yield`` is run after all non-hook-wrapper functions have run. The ``yield`` receives the result value of the inner calls, or raises the exception of inner calls (including earlier hook wrapper calls). The return value of the function becomes the return value of the hook, and a raised exception becomes the exception of the hook. See :ref:`hookwrapper`. :param hookwrapper: If ``True`` ("old-style hook wrapper"), the hook implementation needs to execute exactly one ``yield``. The code before the ``yield`` is run early before any non-hook-wrapper function is run. The code after the ``yield`` is run after all non-hook-wrapper function have run The ``yield`` receives a :class:`Result` object representing the exception or result outcome of the inner calls (including earlier hook wrapper calls). This option is mutually exclusive with ``wrapper``. See :ref:`old_style_hookwrapper`. :param specname: If provided, the given name will be used instead of the function name when matching this hook implementation to a hook specification during registration. See :ref:`specname`. .. versionadded:: 1.2.0 The ``wrapper`` parameter. cóN•—‰‰‰‰‰‰dœ}t|‰jdz|«|S)N)r-r.r/r0r1r3Ú_impl)rHr7) rIrJr.r/r;r3r0r1r-s €€€€€€€r*Úsetattr_hookimpl_optsz6HookimplMarker.__call__..setattr_hookimpl_optsüs:ø€à"Ø*Ø ,Ø$Ø"Ø$ñ "ˆDô �D˜$×+Ñ+¨gÑ5°tÔ <؈Kr)rLr() r;r@r.r/r0r1r3r-r`s ` `````` r*rAzHookimplMarker.__call__¿s'þ€÷z ó ð Ð Ø(Ð (á(¨Ó2Ð 2r)rN)......)r@rr.rr/rr0rr1rr3r2r-rrMr).......)r@rPr.rr/rr0rr1rr3r2r-rrMrQ)NFFFFNF)r@rRr.rr/rr0rr1rr3r2r-rrMrSrTr(r)r*rWrW—su„ñð"€Ió0ðð Ø ØØØ"Øð  àð  ðð  ðð  ð ð  ð ð  ðð  ðð  ð ò  óð  ððØØ ØØØ"Øð  àð  ðð  ðð  ð ð  ð ð  ðð  ðð  ð ò  óð  ð#Ø!Ø"ØØØ#ØðL3àðL3ððL3ðð L3ð ð L3ð ð L3ððL3ððL3ð !ôL3r)rWcóÜ—|jdd«|jdd«|jdd«|jdd«|jdd«|jdd«y)Nr0Fr1r-r.r/r3)Ú setdefault)rJs r*Únormalize_hookimpl_optsrcsV€Ø‡O�O�J Ô&؇O�O�I˜uÔ%؇O�O�I˜uÔ%؇O�O�M 5Ô)؇O�O�N EÔ*؇O�O�J Õ%r)Úpypy_version_infocól—tj|«r |j}n#tj|«s t |d|«} tjtj|«r |jn|«}tjjtjjf}|jj«D��cic]\}}|j |vr||“Œ}}}t#|«}t#d„|j%«D««xsd}|r t'|« }|d|t#||d«} }nd} t(sd} nd} |r2t |dd «} tj|«s d | vr |d | vr|d d}|| fS#t$rYywxYw#t $rYywxYw#t$rYywxYwcc}}w) zâReturn tuple of positional and keywrord argument names for a function, method, class or callable. In case of a class, its ``__init__`` method is considered. For methods the ``self`` parameter is not included. )r(r(rAc3ódK—|](}|j|jur|j–—Œ*y­wr9)ÚdefaultÚempty)Ú.0Úparams r*Ú zvarnames..?s,èø€ð á/�Ø�}‰} E§K¡KÑ/ð �M�MÙ/ùs‚.0Nr(©r;)r;Úobjr%ÚÚ.rr)ÚinspectÚisclassr<ÚAttributeErrorÚ isroutineÚgetattrÚ ExceptionÚ signatureÚismethodÚ__func__Ú TypeErrorÚ ParameterÚPOSITIONAL_ONLYÚPOSITIONAL_OR_KEYWORDÚ parametersÚitemsÚkindÚtupleÚvaluesÚlenÚ_PYPY) rIÚsigÚ_valid_param_kindsÚnamerjÚ _valid_paramsÚargsÚdefaultsÚindexÚkwargsÚimplicit_namesÚqualnames r*ÚvarnamesrŽsÓ€ô‡��tÔð Ø—=‘=‰Dô× Ñ ˜tÔ $ð ܘ4 ¨TÓ2ˆDðä×ÑÜ$×-Ñ-¨dÔ3ˆD�MŠM¸ó ˆô ×Ñ×)Ñ)Ü×Ñ×/Ñ/ðÐð Ÿ>™>×/Ñ/Ô1ôá1‰KˆD�%Ø �:‰:Ð+Ñ +ð ˆe‰ Ø1ðñô �Ó €Dä ñ à&×-Ñ-Ô/ó ó ò ð ð  ñÜ�X“�ˆØ˜F˜U�|¤U¨4°°¨<Ó%8ˆf‰àˆõ Ø*3‰à(ˆÙ Ü  n°bÓ9ˆÜ × Ñ ˜DÔ ! c¨X¡o¸$¸q¹'À^Ñ:Sؘ˜�8ˆDà �ˆ<Ðøôiò Ùð ûô ò Ùð ûô òÙðüós:— Fº FÁ6F!ÃF0Æ FÆFÆ FÆFÆ! F-Æ,F-có*—eZdZdZdZdd„Zerdd„Zyy)Ú HookRelayzaHook holder object for performing 1:N hook calls where N is the number of registered plugins.)Ú__dict__có—y©ú:meta private:Nr(rls r*r<zHookRelay.__init__bs�r)có—yr9r()r;r†s r*Ú __getattr__zHookRelay.__getattr__gs€Ø r)N)rMrP)r†rOrMÚ HookCaller)r#r$r%r&rUr<rr–r(r)r*r�r�[s"„ñð€Ióñô ðr)r�có¼—eZdZdZdZ d dd„Zdd„Z dd„Zdd„Zdd„Z dd „Z dd „Z dd „Z dd „Z dd „Z d dd„Z dd„Zdd„Zy)r—zCA caller of all registered implementations of a hook specification.)r†ÚspecÚ _hookexecÚ _hookimplsÚ _call_historyNcó|—||_||_g|_d|_d|_|�|€J‚|j ||«yyr“)r†ršr›rœr™Úset_specification)r;r†Ú hook_executeÚspecmodule_or_classÚ spec_optss r*r<zHookCaller.__init__}sR€ð ˆŒ Ø ,ˆŒð24ˆŒØ26ˆÔà%)ˆŒ Ø Ð *ØÐ(Ð (Ð(Ø × "Ñ "Ð#6¸ Õ Bð +r)có—|jduSr9)r™rls r*Úhas_speczHookCaller.has_spec˜s€Ø�y‰y Ð$Ð$r)cóø—|j�9td|jj›d|jj›�«‚t ||j|«|_|j d«rg|_yy)NzHook z( is already registered within namespace r)r™rGr†Ú namespaceÚHookSpecÚgetrœ)r;r r¡s r*ržzHookCaller.set_specificationœsu€ð �9‰9Ð ÜØ˜Ÿ ™ Ÿ™Ð)ð*$Ø$(§I¡I×$7Ñ$7Ð#8ð:óð ôÐ0°$·)±)¸YÓGˆŒ Ø �=‰=˜Ô $Ø!#ˆDÕ ð %r)có—|jduS)z2Whether this caller is :ref:`historic `.N)rœrls r*Ú is_historiczHookCaller.is_historicªs€à×!Ñ!¨Ð-Ð-r)có–—t|j«D]#\}}|j|k(sŒ|j|=ytd|›d�«‚)Nzplugin z not found)Ú enumerater›ÚpluginrG)r;r¬ÚiÚmethods r*Ú_remove_pluginzHookCaller._remove_plugin®sJ€Ü" 4§?¡?Ö3‰IˆAˆvØ�}‰} Ó&Ø—O‘O AÐ&Ùð4ô˜7 6 *¨JÐ7Ó8Ð8r)có6—|jj«S)z6Get all registered hook implementations for this hook.)r›Úcopyrls r*Ú get_hookimplszHookCaller.get_hookimplsµs€à�‰×#Ñ#Ó%Ð%r)cóx—t|j«D]!\}}|js |jsŒ|}nt |j«}|js |jr|t |j«}}nd|}}|j r|jj ||«y|jr|jj ||«y|dz }||k\r=|j|jr$|dz}||k\r|j|jrŒ$|jj |dz|«y)z,Add an implementation to the callback chain.rrN)r«r›r.r-r‚r1Úinsertr0)r;Úhookimplr­r®Ú splitpointÚstartÚends r*Ú _add_hookimplzHookCaller._add_hookimpl¹s€ä" 4§?¡?Ö3‰IˆAˆvØ×!Ò! V§^£^Ø� Ùð4ô ˜TŸ_™_Ó-ˆJØ × Ò  8×#3Ò#3Ø#¤S¨¯©Ó%9�3‰Eà˜J�3ˆEà × Ò Ø �O‰O× "Ñ " 5¨(Õ 3Ø × Ò Ø �O‰O× "Ñ " 3¨Õ 1ð�a‘ˆAØ�u’* §¡°Ñ!3×!<Ò!<Ø�Q‘�ð�u’* §¡°Ñ!3×!<Ó!<à �O‰O× "Ñ " 1 q¡5¨(Õ 3r)có"—d|j›d�S)Nz ©r†rls r*Ú__repr__zHookCaller.__repr__Ñs€Ø˜dŸi™i˜]¨!Ð,Ð,r)có ‡—|jrv|jjD]\}|‰vsŒdjˆfd„|jjD««}tjdj |«d¬«yyy)Nz, c3óX•K—|]!}|‰j«vr t|«–—Œ#y­wr9)ÚkeysÚrepr)riÚargnamer‹s €r*rkz;HookCaller._verify_all_args_are_provided..Ùs+øèø€ð*á'9˜Gà"¨&¯+©+«-Ñ7ô˜WŸ Ù'9ùsƒ'*zSArgument(s) {} which are declared in the hookspec cannot be found in this hook callé)Ú stacklevel)r™ÚargnamesÚjoinÚwarningsÚwarnÚformat)r;r‹rÂÚ notincalls ` r*Ú_verify_all_args_are_providedz(HookCaller._verify_all_args_are_providedÔsuø€à �9Š9ØŸ9™9×-Ô-�Ø &Ò(Ø $§ ¡ ó*à'+§y¡y×'9Ò'9ó*ó!�Iô —M‘Mð<ßÐQVˆ à�~‰~˜dŸi™i¨¯©×)=Ñ)=Ó)?ÀÈÓUÐUr)có:—|j€J‚|xsi}|j|«|jj||f«|j|j|j j «|d«}|€yt|t«r|D] }||«Œ yy)a<Call the hook with given ``kwargs`` for all registered plugins and for all plugins which will be registered afterwards, see :ref:`historic`. :param result_callback: If provided, will be called for each non-``None`` result obtained from a hook implementation. NF) rœrËÚappendršr†r›r±Ú isinstanceÚlist)r;Úresult_callbackr‹ÚresÚxs r*Ú call_historiczHookCaller.call_historic÷s—€ð×!Ñ!Ð-Ð-Ð-Ø’˜2ˆØ ×*Ñ*¨6Ô2Ø ×Ñ×!Ñ! 6¨?Ð";Ô<ð�n‰n˜TŸY™Y¨¯©×(<Ñ(<Ó(>ÀÈÓNˆØ Ð "Ø Ü �cœ4Ô Û�Ù Õ"ñð !r)có„—|j«rJd«‚|j|«dddddddœ}|jj«}|D]Ÿ}t dd||«}t |«dz }|dk\rg||j s||js||jr:|dz}|dk\r0||j rŒ||jrŒ*||jrŒ:|j|dz|«Œ¡|jr&|jjjdd«nd}|j|j|||«S) zžCall the hook with some additional temporarily participating methods using the specified ``kwargs`` as call parameters, see :ref:`call_extra`.rÍFN)r-r.r/r1r0r3zrrr)r©rËr›r±rr‚r.r-r0r´r™rJr§ršr†) r;Úmethodsr‹rJÚ hookimplsr®rµr­rs r*Ú call_extrazHookCaller.call_extras@€ð× Ñ Ô"ð Oà Nó OØ "à ×*Ñ*¨6Ô2àØ Ø!ØØØñ  ˆð—O‘O×(Ñ(Ó*ˆ ÛˆFÜ  h°¸Ó=ˆHä�I“ Ñ"ˆAØ�q’&à˜1‘×)Ò)¨Y°q©\×-AÒ-Aà˜Q‘<×(Ò(à�Q‘�ð �q’&à˜1‘×)Ó)¨Y°q©\×-AÓ-Aà˜Q‘<×(Ó(ð × Ñ ˜Q ™U HÕ -ððCGÇ)Â)�d—i‘i—n‘n×(Ñ(¨¸Ô>ÐQVˆ Ø�~‰~˜dŸi™i¨°F¸KÓHÐHr)cóî—|j«re|j€J‚|jD]G\}}|j|j|g|d«}|sŒ(|€Œ+t |t «sJ‚||d«ŒIyy)zAApply call history to a new hookimpl if it is marked as historic.NFr)r©rœršr†rÐrÑ)r;r®r‹rÒrÓs r*Ú_maybe_apply_historyzHookCaller._maybe_apply_history4sx€à × Ñ Ô Ø×%Ñ%Ð1Ð 1Ð1Ø+/×+=Ô+=Ñ'�˜Ø—n‘n T§Y¡Y°°¸&À%ÓH�Ú˜?Ñ6ä% c¬4Ô0Ð0Ð0Ù# C¨¡FÕ+ñ ,>ð r))NN) r†rOrŸÚ _HookExecr z_Namespace | Noner¡zHookspecOpts | NonerMrP)rMr)r Ú _Namespacer¡rrMrP)r¬Ú_PluginrMrP©rMzlist[HookImpl])rµrrMrP©rMrO)r‹úMapping[str, object]rMrP)r‹ÚobjectrMr)rÒzCallable[[Any], None] | Noner‹zMapping[str, object] | NonerMrP)r×zSequence[Callable[..., object]]r‹rárMr)r®rrMrP)r#r$r%r&rUr<r£ržr©r¯r²r¹r½rËrArÕrÙrÛr(r)r*r—r—rsé„ÙMð€Ið26Ø)-ð CàðCð ðCð/ð Cð 'ð Cð ó Có6%ð $à'ð $ð ð $ð ó $ó.ó9ó&ó4ó0-óó$Vð&9=Ø.2ð#à5ð#ð,ð#ð ó #ð6 IØ6ð IØ@Tð Ià ó IôD ,r)r—cóZ—eZdZdZdZd d„Zed d„«Zed d„«Zed d„«Z d d„Z y)Ú_SubsetHookCallerztA proxy to another HookCaller which manages calls to all registered plugins except the ones from remove_plugins.)Ú_origÚ_remove_pluginscód—||_||_|j|_|j|_yr9)rårær†rš)r;ÚorigÚremove_pluginss r*r<z_SubsetHookCaller.__init__Ws'€ØˆŒ Ø-ˆÔØ—I‘IˆŒ ØŸ™ˆ�r)có„—|jjD�cgc]}|j|jvr|‘Œc}Scc}wr9)rår›r¬ræ)r;Úimpls r*r›z_SubsetHookCaller._hookimpls]sE€ðŸ ™ ×-Ò-ó á-�Ø�{‰{ $×"6Ñ"6Ñ6ò Ø-ñ ð ùò s™!=có.—|jjSr9)rår™rls r*r™z_SubsetHookCaller.speces€à�z‰z�‰Ðr)có.—|jjSr9)rårœrls r*rœz_SubsetHookCaller._call_historyis€à�z‰z×'Ñ'Ð'r)có"—d|j›d�S)Nz<_SubsetHookCaller r»r¼rls r*r½z_SubsetHookCaller.__repr__ms€Ø$ T§Y¡Y M°Ð3Ð3r)N)rèr—rézAbstractSet[_Plugin]rMrPrß)rMzHookSpec | None)rMz_CallHistory | Nonerà) r#r$r%r&rUr<Úpropertyr›r™rœr½r(r)r*räräDsT„ñ4ð€Ió (ð ò óð ðòóððò(óð(ô4r)räcó8—eZdZdZdZ dd„Zdd„Zy)rz/A hook implementation in a :class:`HookCaller`.) r@rÅÚ kwargnamesr¬rJÚ plugin_namer-r.r/r0r1cóì—||_t|j«\}}||_||_||_||_||_|d|_|d|_|d|_ |d|_ |d|_ y)r”r-r.r/r0r1N) r@rŽrÅrñr¬rJròr-r.r/r0r1)r;r¬ròr@Úhook_impl_optsrÅrñs r*r<zHookImpl.__init__ƒsˆ€ð (ˆŒ Ü'¨¯ © Ó6ш�*à'ˆŒ à!+ˆŒà#ˆŒ à)ˆŒ à"-ˆÔà,¨YÑ7ˆŒ ð#1°Ñ"?ˆÔð$2°.Ñ#AˆÔð .¨jÑ9ˆŒ ð-¨YÑ7ˆ� r)có<—d|j›d|j›d�S)Nzrsúðñõ#ãÛ ÛÝÝÝÝÝÝÝÝÝÝÝÝÝÝ ÝÝÝåñ ˆTƒ]€Ù ˆT˜ # v +Ñ.Ô/€Ø �:˜tÐ#Ñ $€ Ø €Ø ؈(�:Ñ  ¨¨V¨ Ñ 4°dÐ;Ø ˆ&�$�v‘,Ð Ñð!ñ € ð˜S %¨¨I°d¸FÀ2¹JÈÐ6LÑ,MÐ(MÑ"NÐNÑOÐô!�9ô!ô�9ôð*÷J)ðJ)óðJ)ðZ÷s3ðs3óðs3ól&ñ �Ð(Ó)€ó>ðB÷ ð óð ð € ð�E˜' # v +Ñ.°¸À3À%ÈÀ+Ñ9NÑ0OÐOÑPÑQ€ ÷K,ñK,ð^€ ô*4˜ ô*4ðZ÷6Vð6Vóð6Vðr÷5ð5óñ5r)