o
    e                     @  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 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dd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)	Generator)Generic)NoReturn)Optional)Tuple)Type)TypeVar
ResultTypewrap_controllerKGenerator[None, Result[ResultType], None] | Generator[None, object, object]msgstrreturnr	   c                 C  s    | j }td|j|j|j|f )Nzwrap_controller at %r %s:%d %s)gi_codeRuntimeErrorco_nameco_filenameco_firstlineno)r   r   co r   >D:\Projects\ConvertPro\env\Lib\site-packages\pluggy/_result.py_raise_wrapfail   s   r   c                   @  s   e Zd ZdZdS )HookCallErrorzHook was called incorrectly.N)__name__
__module____qualname____doc__r   r   r   r   r   $   s    r   c                   @  sf   e Zd ZdZdZdd	d
ZedddZed ddZe	d!ddZ
d"ddZd#ddZd$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 | Noner   Nonec                 C  s   || _ || _dS :meta private:Nr#   )selfr&   r(   r   r   r   __init__/   s   
zResult.__init___ExcInfo | Nonec                 C  s"   | j }|du r	dS t|||jfS r+   )r%   type__traceback__)r-   excr   r   r   excinfo8   s   zResult.excinfoc                 C  s   | j S )r,   )r%   )r-   r   r   r   r(   A   s   zResult.exceptionfuncCallable[[], ResultType]Result[ResultType]c              
   C  sJ   d}d }}z| }W n t y } z|}W Y d}~nd}~ww | ||S )r,   TN)BaseException)clsr4   __tracebackhide__r&   r(   r2   r   r   r   	from_callF   s   

zResult.from_callr   c                 C  s   || _ 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_resultQ   s   	
zResult.force_resultr7   c                 C  s   d| _ || _dS )zForce the result to fail with ``exception``.

        This overrides any previous result or exception.

        .. versionadded:: 1.1.0
        Nr#   )r-   r(   r   r   r   force_exception]   s   
zResult.force_exceptionc                 C  s*   d}| j }|du r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.
        TN)r%   r   r   r$   with_tracebackr1   )r-   r9   r2   r   r   r   
get_resultg   s
   zResult.get_resultN)r&   r'   r(   r)   r   r*   )r   r/   )r   r)   )r4   r5   r   r6   )r&   r   r   r*   )r(   r7   r   r*   )r   r   )r   r   r    r!   	__slots__r.   propertyr3   r(   classmethodr:   r;   r<   r>   r   r   r   r   r"   (   s    
	



r"   N)r   r   r   r   r   r	   )r!   
__future__r   typesr   typingr   r   r   r   r   r	   r
   r   r   r   r7   Z_ExcInfor   r   	Exceptionr   r"   Z_Resultr   r   r   r   <module>   s(    
M