U
    42‹iz  ã                   @  sª   U d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlZd dl	Z	ddl
mZ ddl
mZ dd	lmZ d
dddddœZded< ddddœdd„ZG dd„ dƒZdS )é    )ÚannotationsN)ÚPath)ÚAny)ÚMappingé   )ÚLEGACY_PATH)Úlegacy_path)ÚHOOK_LEGACY_PATH_ARG)Zcollection_pathÚpath)Ú	file_pathr
   )Úmodule_pathr
   )Z
start_pathZstartdir)Zpytest_ignore_collectZpytest_collect_fileZpytest_pycollect_makemoduleZpytest_report_headerZpytest_report_collectionfinishzMapping[str, tuple[str, str]]Úimply_paths_hooksr   r   ÚNone)r
   ÚfspathÚreturnc                 C  s&   t |ƒ| kr"td|›d| ›dƒ‚d S )NzPath(z) != z8
if both path and fspath are given they need to be equal)r   Ú
ValueError)r
   r   © r   ú9/tmp/pip-unpacked-wheel-7n2p7kht/_pytest/config/compat.pyÚ_check_path   s    ÿr   c                   @  s>   e Zd ZdZdddœdd„Zddœd	d
„Zdddœdd„ZdS )ÚPathAwareHookProxyzê
    this helper wraps around hook callers
    until pluggy supports fixingcalls, this one will do

    it currently doesn't return full hook caller proxies for fixed hooks,
    this may have to be changed later depending on bugs
    zpluggy.HookRelayr   )Ú
hook_relayr   c                 C  s
   || _ d S ©N)Ú_hook_relay)Úselfr   r   r   r   Ú__init__+   s    zPathAwareHookProxy.__init__z	list[str])r   c                 C  s
   t | jƒS r   )Údirr   )r   r   r   r   Ú__dir__.   s    zPathAwareHookProxy.__dir__Ústrzpluggy.HookCaller)Úkeyr   c                   sx   t | j|ƒ‰|tkr"ˆ| j|< ˆS t| \‰‰ t ˆ¡dddœ‡ ‡‡fdd„ƒ}ˆj|_ˆj|_||_|| j|< |S d S )Nr   )Úkwr   c                    sŒ   |   ˆd ¡}|   ˆ d ¡}|d k	r8tjtjˆ ˆddd |d k	r^|d k	rTt||ƒ qrt|ƒ}n|d k	sjt‚t|ƒ}|| ˆ< || ˆ < ˆf | ŽS )N)Zpylib_path_argZpathlib_path_argr   )Ú
stacklevel)	ÚpopÚwarningsÚwarnr	   Úformatr   r   ÚAssertionErrorr   )r   Z
path_valueZfspath_value©Z
fspath_varÚhookZpath_varr   r   Ú
fixed_hook9   s&     ÿü
z2PathAwareHookProxy.__getattr__.<locals>.fixed_hook)	Úgetattrr   r   Ú__dict__Ú	functoolsÚwrapsÚnameÚspecÚ__name__)r   r   r(   r   r&   r   Ú__getattr__1   s    

zPathAwareHookProxy.__getattr__N)r/   Ú
__module__Ú__qualname__Ú__doc__r   r   r0   r   r   r   r   r   "   s   r   )Ú
__future__r   r+   Úpathlibr   Útypingr   r   r"   ZpluggyÚcompatr   r   Ú
deprecatedr	   r   Ú__annotations__r   r   r   r   r   r   Ú<module>   s$    û	