
    yIf!                       d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ ddlmZ eee         ee
e         f         Z ed          Z G d de          Ze G d de	e                               ZeZdS )z"
Hook wrapper "result" utilities.
    )annotations)TracebackType)Callable)cast)final)Generic)Optional)Tuple)Type)TypeVar
ResultTypec                      e Zd ZdZdS )HookCallErrorzHook was called incorrectly.N)__name__
__module____qualname____doc__     B/var/www/piapp/venv/lib/python3.11/site-packages/pluggy/_result.pyr   r      s        &&&&r   r   c                  ~    e Zd ZdZdZdd	Zedd            Zedd            Ze	dd            Z
ddZddZddZdS )ResultzYAn object used to inspect and set the result in a :ref:`hook wrapper
    <hookwrappers>`._result
_exceptionresultResultType | None	exceptionBaseException | NonereturnNonec                "    || _         || _        dS :meta private:Nr   )selfr   r   s      r   __init__zResult.__init__!   s     #r   _ExcInfo | Nonec                F    | j         }|dS t          |          ||j        fS r#   )r   type__traceback__)r%   excs     r   excinfozResult.excinfo*   s+     o;4IIsC$566r   c                    | j         S )r$   )r   )r%   s    r   r   zResult.exception3   s     r   funcCallable[[], ResultType]Result[ResultType]c                p    d}dx}}	  |            }n# t           $ r}|}Y d}~nd}~ww xY w | ||          S )r$   TN)BaseException)clsr.   __tracebackhide__r   r   r+   s         r   	from_callzResult.from_call8   sf     !!!	TVVFF 	 	 	IIIIII	s69%%%s   
 
)$)r   c                "    || _         d| _        dS )a,  Force the result(s) to ``result``.

        If the hook was marked as a ``firstresult`` a single value should
        be set, otherwise set a (modified) list of results. Any exceptions
        found during invocation will be deleted.

        This overrides any previous result or exception.
        Nr   )r%   r   s     r   force_resultzResult.force_resultC   s     r   r2   c                "    d| _         || _        dS )zForce the result to fail with ``exception``.

        This overrides any previous result or exception.

        .. versionadded:: 1.1.0
        Nr   )r%   r   s     r   force_exceptionzResult.force_exceptionO   s     #r   c                    d}| j         }|t          t          | j                  S |                    |j                  )zGet the result(s) for this hook call.

        If the hook was marked as a ``firstresult`` only a single value
        will be returned, otherwise a list of results.
        T)r   r   r   r   with_tracebackr*   )r%   r4   r+   s      r   
get_resultzResult.get_resultY   s?     !o;
DL111$$S%6777r   N)r   r   r   r   r    r!   )r    r'   )r    r   )r.   r/   r    r0   )r   r   r    r!   )r   r2   r    r!   )r    r   )r   r   r   r   	__slots__r&   propertyr,   r   classmethodr5   r7   r9   r<   r   r   r   r   r      s          *I$ $ $ $ 7 7 7 X7    X & & & [&
 
 
 
$ $ $ $8 8 8 8 8 8r   r   N)r   
__future__r   typesr   typingr   r   r   r   r	   r
   r   r   r2   _ExcInfor   	Exceptionr   r   _Resultr   r   r   <module>rF      sj    # " " " " "                                                       m$mXm5LLMW\""
' ' ' ' 'I ' ' ' I8 I8 I8 I8 I8WZ  I8 I8 I8Z r   