
                         X    d Z ddlZddlmZ ddlmZ dZ ee      dhz  Zd Z	d
dZ
d	 Zy)z/Validation functions for speech commands flags.    N)storage_util)
exceptions)LINEAR16MULAWALAWAUTOc                     | j                   =| j                  0| j                   | j                  kD  rt        j                  dd      yyy)z)Validates speaker diarization flag input.Nz--max-speaker-countzH[--max-speaker-count] must be equal to or larger than min-speaker-count.)min_speaker_countmax_speaker_countr   InvalidArgumentExceptionargss    <lib/googlecloudsdk/command_lib/ml/speech/flag_validations.pyValidateSpeakerDiarizationr      sX     (T-C-C-O			$"8"8	8

-
-	  
9 .P(    c                 j   t         j                  j                  | j                        ry|r/t	        j
                  ddj                  | j                              t        j                  j                  | j                        s/t	        j
                  ddj                  | j                              y)z"Validates audio source flag input.Nz--audiozfInvalid audio source [{}]. The source must be a Google Cloud Storage URL (such as gs://bucket/object).z}Invalid audio source [{}]. The source must either be a local path or a Google Cloud Storage URL (such as gs://bucket/object).)
r   ObjectReferenceIsStorageUrlaudior   r   formatospathisfile)r   batchs     r   ValidateAudioSourcer   &   s    !!..tzz:



-
-	55;VDJJ5G  


	#

-
-	((.tzz(:	  
$r   c           	      X   | j                   y| j                   t        vr5t        j                  dddj	                  t        t                    z         | j                   dk(  rB| j                  | j                  )t        j                  | j                  dd      dd      y| j                  8t        j                  dd	dj	                  t        t                    z   d
z         | j                  5t        j                  dddj	                  t        t                    z         y)zValidates encoding flag input.Nz
--encodingz#[--encoding] must be set to one of z, r   z--sample-ratez--audio-channel-countzJAUTO encoding does not support setting sample rate or audio channel count.zM[--sample-rate] must be specified when configuring explicit encoding options .zU[--audio-channel-count] must be specified when configuring explicit encoding options )	encodingENCODING_OPTIONSr   r   joinsortedsample_rateaudio_channel_countEXPLICIT_ENCODING_OPTIONSr   s    r   ValidateDecodingConfigr%   ;   sC   	]]
	]]**

-
--
))F+,
-	. 
 
]]f#t'?'?'K//) 	  '	  (L //
IIf6789   '//
!,		&!:;<=  (r   )F)__doc__r   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   r$   	frozensetr   r   r   r%    r   r   <module>r+      s=    6 	 7 . : 676(B 	*$r   