o
    Uh                     @  sn   d dl mZ d dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZmZ edZG dd dejd	ZdS )
    )annotationsN)Path)PythonVersion)path_is_pythonsafe_iter_dir
findpythonc                   @  sb   e Zd ZU dZeZded< edddZee	j
dd	d
Ze	j
dddZe	ddddZdS )BaseProviderz#The base class for python providerszt.Callable[..., PythonVersion]version_makerreturnstrc                 C  s*   | j  }|dr|dtd  }|S )zuConfiguration name for this provider.

        By default, the lowercase class name with 'provider' removed.
        providerN)__name__lowerendswithlen)cls	self_name r   m/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/findpython/providers/base.pyname   s   

zBaseProvider.namet.Self | Nonec                 C     dS )zAReturn an instance of the provider or None if it is not availableNr   )r   r   r   r   create   s   zBaseProvider.createt.Iterable[PythonVersion]c                 C  r   )z0Return the python versions found by the providerNr   )selfr   r   r   find_pythons$   s   zBaseProvider.find_pythonsFpathr   as_interpreterboolc                   s    fddt |D S )aE  A general helper method to return pythons under a given path.

        :param path: The path to search for pythons
        :param as_interpreter: Use the path as the interpreter path.
            If the pythons might be a wrapper script, don't set this to True.
        :returns: An iterable of PythonVersion objects
        c                 3  s6    | ]}t |rj|  r| nd dV  qd S )N)_interpreter)r   r	   absolute).0childr   r   r   r   	<genexpr>4   s    
z6BaseProvider.find_pythons_from_path.<locals>.<genexpr>)r   )r   r   r   r   r#   r   find_pythons_from_path)   s   z#BaseProvider.find_pythons_from_pathN)r
   r   )r
   r   )r
   r   )F)r   r   r   r   r
   r   )r   
__module____qualname____doc__r   r	   __annotations__classmethodr   abcabstractmethodr   r   r%   r   r   r   r   r      s   
 
r   )	metaclass)
__future__r   r+   loggingtypingtpathlibr   findpython.pythonr   findpython.utilsr   r   	getLoggerloggerABCMetar   r   r   r   r   <module>   s    
