
    Vh9                        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lmZ  e       Zedd	       Zedd
       Zy)    )annotations)AnsibleError)!with_collection_artifacts_manager)find_existing_collections)to_bytes)_get_collection_name_from_path)DisplayNc                R    i }t        || ||      D ]  }t        |      }|||<    |S )N)search_pathscoll_filterartifacts_managerdedupe)list_collection_dirsr   )r   r   r   r   collections	candidate
collections          H/home/dcms/DCMS/lib/python3.12/site-packages/ansible/collections/list.pylist_collectionsr      sM     K)|Q\  qB  KQ  R ,	3I>
"+J,     c              #    K   d}d}d}|t        |t              r|g}t               }|D ]Z  }d|v r?	 |j                  d      \  }}	|j                  |       |r0|g }|j                  |	       F|j                  |       d}d}\ t        |      }t        | ||||      D ],  }
|s||
j                  |vrt        |
j                         . y# t        $ r t        d|z        w xY ww)aO  
    Return paths for the specific collections found in passed or configured search paths
    :param search_paths: list of text-string paths, if none load default config
    :param coll_filter: limit collections to just the specific namespace or collection, if None all are returned
    :return: list of collection directory paths
    NF.z'Invalid collection pattern supplied: %sT)namespace_filtercollection_filterr   )
isinstancestrsetsplit
ValueErrorr   addappendsortedr   fqcnr   src)r   r   r   r   r   r   has_pure_namespace_filter	coll_name	namespacer   reqs              r   r   r      s-      %k3'&-K5$ 	)Ii^,5OOC,@)Iz !$$Y/0(0,.)%,,Z8 $$Y/,0)$(!	) ""23(7H[k;LU[]   )[-DYdIdsww  " ^&'PS\'\]]^s#   /C-CC-A8C-C**C-)NNTN)NNNT)
__future__r   ansible.errorsr   ansible.cli.galaxyr   ansible.galaxy.collectionr   +ansible.module_utils.common.text.convertersr   2ansible.utils.collection_loader._collection_finderr   ansible.utils.displayr	   displayr   r    r   r   <module>r1      sK    # ' @ ? @ ] )
) # # #%  #% r   