a
    !f                     @  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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
ResultTypezKGenerator[None, Result[ResultType], None] | Generator[None, object, object]strr	   )wrap_controllermsgreturnc                 C  s$   | j }td|j|j|j|f d S )Nzwrap_controller at %r %s:%d %s)gi_codeRuntimeErrorco_nameco_filenameco_firstlineno)r   r   co r   O/var/www/html/python-backend/venv/lib/python3.9/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                   @  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
_exceptionzResultType | NonezBaseException | NoneNone)result	exceptionr   c                 C  s   || _ || _dS :meta private:Nr"   )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$   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.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)clsr0   __tracebackhide__r&   r'   r.   r   r   r   	from_callF   s    
zResult.from_callr   )r&   r   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_resultr1   )r'   r   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d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.
        TN)r$   r   r   r#   with_tracebackr-   )r*   r3   r.   r   r   r   
get_resultg   s
    zResult.get_resultN)r   r   r   r    	__slots__r+   propertyr/   r'   classmethodr4   r5   r6   r8   r   r   r   r   r!   (   s   	

r!   N)r    
__future__r   typesr   typingr   r   r   r   r   r	   r
   r   r   r   r1   Z_ExcInfor   r   	Exceptionr   r!   Z_Resultr   r   r   r   <module>   s&   M