a
    !fY	                     @   sz   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lmZ ddl	m
Z
 d dlmZ d	d
ddddZG dd dZdS )    N)Path)Optional   )LEGACY_PATH)legacy_path)HOOK_LEGACY_PATH_ARG)_check_path)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_collectionfinishc                   @   s.   e Zd ZdZdd Zdd Zejf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
    c                 C   s
   || _ d S N) _PathAwareHookProxy__hook_caller)selfZhook_caller r   V/var/www/html/python-backend/venv/lib/python3.9/site-packages/_pytest/config/compat.py__init__   s    zPathAwareHookProxy.__init__c                 C   s
   t | jS r   )dirr   )r   r   r   r   __dir__!   s    zPathAwareHookProxy.__dir__c                    s^   t | j||tvr"| j|< S t| \ | fdd}||_|| j|< |S d S )Nc                     s   |  d }|   d }|d ur8tjtj ddd |d ur^|d urTt|| qrt|}n|d usjJ t|}|| < ||  < f i | S )N)Zpylib_path_argZpathlib_path_argr   )
stacklevel)popwarningswarnr   formatr   r   r   )kwZ
path_valueZfspath_valueZ
fspath_varhookZpath_varr   r   
fixed_hook,   s$    
z2PathAwareHookProxy.__getattr__.<locals>.fixed_hook)getattrr   imply_paths_hooks__dict____name__)r   keyZ_wrapsr   r   r   r   __getattr__$   s    

zPathAwareHookProxy.__getattr__N)	r!   
__module____qualname____doc__r   r   	functoolswrapsr#   r   r   r   r   r      s   r   )r'   r   pathlibr   typingr   compatr   r   
deprecatedr   Z_pytest.nodesr   r   r   r   r   r   r   <module>   s   	