
                            d 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
 ddl	mZ dd	lmZ ej                   ej                  ej                   j"                         G d
 dej$                                      Zy)z0Cloud Speech-to-text recognizers update command.    )absolute_import)division)unicode_literals)client)base)flag_validations)flags_v2)logc                   ,    e Zd ZdZd Zed        Zd Zy)Updatez#Update a Speech-to-text recognizer.c                 .    t        j                  |       y)zValidates update flags.N)r   ValidateDecodingConfig)selfargss     +lib/surface/ml/speech/recognizers/update.pyValidateUpdateRecognizerFlagsz$Update.ValidateUpdateRecognizerFlags!   s    ++D1    c                 .    t        j                  |        y)z Register flags for this command.N)r	   AddAllFlagsToParser)parsers    r   ArgszUpdate.Args%   s       (r   c                 J   |j                   j                  j                         }t        j                         }|j
                  }| j                  |       g }|j                  |j                  |j                  |      \  }}|j                  |||      \  }}|j                  ||      \  |_        }|D cg c]  }d|z   	 }}|j                  ||j                  |j                  |j                  ||      }|r$t        j                   |j"                  dd       |S |j%                  |j'                         j)                         |j+                  |      dj-                  |j/                                     }	t        j                   |	j"                  d       |	S c c}w )	N)update_maskzdefault_recognition_config.zspeech recognizerT)kindis_asyncz)waiting for recognizer [{}] to be updated)locationoperation_refmessage)r   )CONCEPTS
recognizerParser   SpeechV2Clientasync_r   InitializeRecognitionConfigmodellanguage_codes InitializeDecodingConfigFromArgsInitializeASRFeaturesFromArgsfeaturesUpdateRecognizerdisplay_namer
   UpdatedResourcenameWaitForRecognizerOperationParentNameGetOperationRefformatRelativeName)
r   r   r    speech_clientr   recognition_config_update_maskrecognition_configfield	operationresources
             r   Runz
Update.Run*   s   ))//1J))+M{{H&&t,%'" 	11JJ++-K	
 76 	666 	7 	
 76 	33< 	4 	
 @!? 4&3E 	&-3 # &
 ..

2 / I 	
..2T 77""$))+#33I>;BB##%
 8 H ,?@O;&s   8F N)__name__
__module____qualname____doc__r   staticmethodr   r:    r   r   r   r      s%     ,2 ) );r   r   N)r>   
__future__r   r   r    googlecloudsdk.api_lib.ml.speechr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.ml.speechr   r	   googlecloudsdk.corer
   UniverseCompatibleReleaseTracksReleaseTrackALPHACommandr   r@   r   r   <module>rK      sk    7 &  ' 3 ( A 9 # D%%++,GT\\ G - Gr   