
    F-Ph                       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 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)TypeVar
ResultTypec                      e Zd ZdZdS )HookCallErrorzHook was called incorrectly.N)__name__
__module____qualname____doc__     N/var/www/html/test/jupyter/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
_tracebackresultResultType | None	exceptionBaseException | NonereturnNonec                B    || _         || _        ||j        nd| _        dS :meta private:Nr   r   __traceback__r   )selfr   r   s      r   __init__zResult.__init__   s+     #5>5J)11PTr   _ExcInfo | Nonec                F    | j         }|dS t          |          || j        fS r"   )r   typer   )r&   excs     r   excinfozResult.excinfo*   s*     o;4IIsDO44r   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                0    || _         d| _        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                B    d| _         || _        ||j        n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_exceptionP   s+     #5>5J)11PTr   c                    d}| j         }| j        }|t          t          | j                  S |                    |          )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   r   with_traceback)r&   r4   r+   tbs       r   
get_resultzResult.get_result[   sC     !o_;
DL111$$R(((r   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          8I	U 	U 	U 	U 5 5 5 X5    X & & & [&   	U 	U 	U 	U) ) ) ) ) )r   r   N)r   
__future__r   typesr   typingr   r   r   r   r	   r
   tupler*   r2   _ExcInfor   	Exceptionr   r   _Resultr   r   r   <module>rH      sF    # " " " " "                                           m$mXm5LLMW\""
' ' ' ' 'I ' ' ' N) N) N) N) N)WZ  N) N) N)d r   