a
     ñ»j  ã                   @  s²   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„ deƒZeG dd„ de	e ƒƒZeZdS )z"
Hook wrapper "result" utilities.
é    )Úannotations)ÚTracebackType)ÚCallable)Úcast)Úfinal)ÚGeneric)ÚOptional)ÚTypeVarÚ
ResultTypec                   @  s   e Zd ZdZdS )ÚHookCallErrorzHook was called incorrectly.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú4E:\soccer\ml_env\Lib\site-packages\pluggy/_result.pyr      s   r   c                   @  sŒ   e Zd ZdZdZddddœdd„Zed	d
œdd„ƒZedd
œdd„ƒZe	dddœdd„ƒZ
dddœdd„Zdddœdd„Zdd
œdd„ZdS )ÚResultzYAn object used to inspect and set the result in a :ref:`hook wrapper
    <hookwrappers>`.©Ú_resultÚ
_exceptionÚ
_tracebackzResultType | NonezBaseException | NoneÚNone)ÚresultÚ	exceptionÚreturnc                 C  s$   || _ || _|dur|jnd| _dS ©ú:meta private:N©r   r   Ú__traceback__r   )Úselfr   r   r   r   r   Ú__init__   s    zResult.__init__z_ExcInfo | None)r   c                 C  s&   | j }|du rdS t|ƒ|| jfS dS r   )r   Útyper   )r   Úexcr   r   r   Úexcinfo*   s    zResult.excinfoc                 C  s   | j S )r   )r   )r   r   r   r   r   3   s    zResult.exceptionzCallable[[], ResultType]zResult[ResultType])Úfuncr   c              
   C  sJ   d}d }}z
|ƒ }W n( t y> } z|}W Y d}~n
d}~0 0 | ||ƒS )r   TN)ÚBaseException)Úclsr$   Ú__tracebackhide__r   r   r"   r   r   r   Ú	from_call8   s    
zResult.from_callr
   )r   r   c                 C  s   || _ 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   r   r   r   Úforce_resultC   s    	zResult.force_resultr%   )r   r   c                 C  s$   d| _ || _|dur|jnd| _dS )z�Force the result to fail with ``exception``.

        This overrides any previous result or exception.

        .. versionadded:: 1.1.0
        Nr   )r   r   r   r   r   Úforce_exceptionP   s    zResult.force_exceptionc                 C  s2   d}| j }| j}|du r$tt| jƒS | |¡‚dS )z®Get 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.
        TN)r   r   r   r
   r   Úwith_traceback)r   r'   r"   Útbr   r   r   Ú
get_result[   s    zResult.get_resultN)r   r   r   r   Ú	__slots__r    Úpropertyr#   r   Úclassmethodr(   r)   r*   r-   r   r   r   r   r      s   
r   N)r   Ú
__future__r   Útypesr   Útypingr   r   r   r   r   r	   Útupler!   r%   Z_ExcInfor
   Ú	Exceptionr   r   Ú_Resultr   r   r   r   Ú<module>   s   R