B
    GFFbÿ  ã               @   s6   d Z ddlZdd„ ZG dd„ deƒZG dd„ dƒZdS )	z"
Hook wrapper "result" utilities.
é    Nc             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)Zwrap_controllerÚmsgÚco© r	   ú-lib/python3.7/site-packages/pluggy/_result.pyÚ_raise_wrapfail   s    r   c               @   s   e Zd ZdZdS )ÚHookCallErrorzHook was called wrongly.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r	   r	   r
   r      s   r   c               @   s<   e Zd Zdd„ Zedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dS )Ú_Resultc             C   s   || _ || _d S )N)Ú_resultÚ_excinfo)ÚselfÚresultÚexcinfor	   r	   r
   Ú__init__   s    z_Result.__init__c             C   s   | j S )N)r   )r   r	   r	   r
   r      s    z_Result.excinfoc             C   s>   d}d  }}y
|ƒ }W n t k
r2   t ¡ }Y nX | ||ƒS )NT)ÚBaseExceptionÚsysÚexc_info)ÚclsÚfuncÚ__tracebackhide__r   r   r	   r	   r
   Ú	from_call   s    
z_Result.from_callc             C   s   || _ d| _dS )zñ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.
        N)r   r   )r   r   r	   r	   r
   Úforce_result'   s    z_Result.force_resultc             C   s0   d}| j dkr| jS | j }|d  |d ¡‚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   Úwith_traceback)r   r   Úexr	   r	   r
   Ú
get_result1   s
    
z_Result.get_resultN)
r   r   r   r   Úpropertyr   Úclassmethodr   r   r$   r	   r	   r	   r
   r      s
   
r   )r   r   r   Ú	Exceptionr   r   r	   r	   r	   r
   Ú<module>   s   