
    Vh                        d Z ddlmZ ddlZddlZddlZddlmZm	Z	 ddZ
	 	 	 	 	 	 	 	 	 	 ddZ G d	 d
e      Z G d dej                        Z ej                  de      Zy)z2Provider (plugin) infrastructure for ansible-test.    )annotationsN   )ApplicationErrorget_subclassesc                0    t        t        |       d       S )z9Return a list of path provider classes of the given type.c                2    | j                   | j                  fS N)priority__name__)subclasss    X/home/dcms/DCMS/lib/python3.12/site-packages/ansible_test/_internal/provider/__init__.py<lambda>z+get_path_provider_classes.<locals>.<lambda>   s    xGXGXZbZkZkFl     )key)sortedr   )provider_types    r   get_path_provider_classesr      s    ./5lmmr   TPathProviderc                H   t        t        d |D                    }|D ]r  }|}|D cg c]  }|j                  |k(  s| }}	 |D ]  }	|	j                  |      s |	|      c c S  |sLt        j
                  j                  |      }
|
|k(  rq|
}O t        | |      c c}w )zJReturn the first found path provider of the given type for the given path.c              3  T   K   | ]   }|j                   d kD  s|j                    " yw)r   N)sequence).0pcs     r   	<genexpr>z%find_path_provider.<locals>.<genexpr>   s     U2R[[ST_2;;Us   (()r   setr   is_content_rootospathdirnameProviderNotFoundForPath)r   provider_classesr   walk	sequencesr   candidate_pathr   tier_classesprovider_classparent_paths              r   find_path_providerr(      s     sU1AUUVI )%5Qr9PQQ". :!11.A).99: ''//.9Kn,(N 	)& "-
66# Rs
   BBc                  $     e Zd ZdZd fdZ xZS )r    zPException generated when a path based provider cannot be found for a given path.c                `    t         |   d|j                  d|       || _        || _        y )NzNo z found for path: )super__init__r   r   r   )selfr   r   	__class__s      r   r,   z ProviderNotFoundForPath.__init__5   s*    }7M7MtTU*	r   )r   zt.Typer   strreturnNone)r   
__module____qualname____doc__r,   __classcell__)r.   s   @r   r    r    2   s    Z r   r    c                  P    e Zd ZdZdZdZddZeej                  dd              Z
y)PathProviderz4Base class for provider plugins that are path based.i  c                    || _         y r	   )root)r-   r9   s     r   r,   zPathProvider.__init__B   s	    	r   c                     y)zBReturn True if the given path is a content root for this provider.N )r   s    r   r   zPathProvider.is_content_rootE   s    r   N)r9   r/   r0   r1   )r   r/   r0   bool)r   r2   r3   r4   r   r
   r,   staticmethodabcabstractmethodr   r;   r   r   r7   r7   <   s8    >HH Q  Qr   r7   )	metaclass)bound)r   t.Type[TPathProvider]r0   list[t.Type[TPathProvider]])
r   rB   r!   rC   r   r/   r"   r<   r0   r   )r4   
__future__r   r>   r   typingtutilr   r   r   r(   r    ABCMetar7   TypeVarr   r;   r   r   <module>rJ      s    8 " 
 	 n
7(717 7 	7
 7>. QS[[ Q 		/>r   