
      i                     h    d dl Z d dlmZ d dlmZmZ dZeddfdeee   ee   eef   fdZeddfdZ	y)	    N)Path)ListUnion)z.wavTpathsc                    g }t        | t        t        t        f      rt        |       } n| g} | D ]  }t	        |      j                         j                  t              r:t        t        j                  j                  |            }|j                  |       it        j                  j                  |      s|t        ||||      z  } |S )zReturn a list of paths to all audio files with the given extension(s) contained in the list or in its directories.
    Also traverses subdirectories by default.
    )filename_endingstraverse_subdirectoriesfollow_symlinks)
isinstancelisttuplesetstrlowerendswithSUPPORTED_EXTENSIONSr   ospathabspathappendisdirfind_audio_files)r   r   r	   r
   
file_pathsp	file_paths          u/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/torch_audiomentations/utils/file.pyfind_audio_files_in_pathsr   	   s     J%$s+,Uq6<<>""#78RWW__Q/0Ii(WW]]1*!1(? /	 J      c                 j   g }t        j                  | |      D ]  \  }}}t        |      }|D ]{  }t         j                  j	                  |      }	t         j                  j                  |	|      }
|j                         j                  |      sb|j                  t        |
             } |r |S  |S )zReturn a list of paths to all audio files with the given extension(s) in a directory.
    Also traverses subdirectories by default.
    )followlinks)
r   walksortedr   r   joinr   r   r   r   )	root_pathr   r	   r
   r   rootdirs	filenamesfilename
input_pathr   s              r   r   r   (   s     J!#!PdI9%	!H.JZ:I~~(()9:!!$y/2 " ' "Q r   )
r   pathlibr   typingr   r   r   r   r   r    r   r   <module>r-      sU    	   ! 
 * 	dT#Yc12B * 	r   