
                             S r SSKrSSKJr  SSKJr  SSKJr  Sr " S S\R                  5      r	 " S	 S
\	5      r
 " S S\	5      rS rg)z&Flags for gcloud ml language commands.    N)storage_util)
exceptions)fileslanguagec                       \ rS rSrSrSrg)Error   zExceptions for this module. N__name__
__module____qualname____firstlineno____doc____static_attributes__r
       2lib/googlecloudsdk/command_lib/ml/language/util.pyr   r      s    #r   r   c                       \ rS rSrSrSrg)ContentFileError!   z8Error if content file can't be read and isn't a GCS URL.r
   Nr   r
   r   r   r   r   !   s    @r   r   c                       \ rS rSrSrSrg)ContentError%   zError if content is not given.r
   Nr   r
   r   r   r   r   %   s    &r   r   c                    UR                   nUR                  nUR                  nU(       a  U(       a  [        S5      e[        R
                  R                  U5      (       a  [        R                  " U5      Ul         U$ [        R                  R                  U5      (       a  XEl        U$ [        SR                  U5      5      eU(       a  X5l         U$ [        S5      e)zEThe Python hook for yaml commands to inject content into the request.z]Either a file or content must be provided for analysis by the Natural Language API, not both.zCould not find --content-file [{}]. Content file must be a path to a local file or a Google Cloud Storage URL (format: `gs://bucket_name/object_name`)zJThe content provided is empty. Please provide language content to analyze.)contentcontent_filedocument
ValueErrorospathisfiler   ReadFileContentsr   ObjectReferenceIsStorageUrlgcsContentUrir   formatr   )
unused_refargsrequestr   r   r   s         r   UpdateRequestWithInputr*   )   s    LL'"",( I J J	ww~~l##//=h 
. 
	%	%	2	2<	@	@+ 
. ,,2F<,@B B  
.  6 7 7r   )r   r   googlecloudsdk.api_lib.storager   googlecloudsdk.corer   googlecloudsdk.core.utilr   LANGUAGE_APIr   r   r   r*   r
   r   r   <module>r/      sP     - 
 7 * * $J $Au A'5 'r   