o
    i                    @   s|  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZmZmZmZmZmZmZmZmZmZmZmZmZ d dl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* d dl+m,Z, d dl-m.Z/ zee!j0ej1j2df Z3W n e4y   ee!j0e5df Z3Y nw z
d dlm6Z6 dZ7W n e8y   dZ7Y nw e9e:Z;d dl<m=  m>Z> d dl?m=  m@Z@ d dlAmB  mCZC d dlDmB  mEZE d dlFmB  mGZG d dlHmIZI d dlJmKZK d dlLmMZM d dlNmOZO ddlPmQZQmRZR ddlSmTZT ddlUmVZV ddlWmXZX G dd deYZZG dd deZdZ[ej\j]e/j^dZQe_eQd r:ejBj^eQ_`d!ZadS )"    N)OrderedDict)
HTTPStatus)CallableDictIterableIteratorMappingMutableMappingMutableSequenceOptionalSequenceTupleTypeUnioncast)client_options)
exceptions)gapic_v1)retry)credentials)MutualTLSChannelError)mtls)SslCredentials)service_account)gapic_version)client_loggingTF)locations_pb2)operations_pb2)pagers)cloud_speech   )DEFAULT_CLIENT_INFOSpeechTransport)SpeechGrpcTransport)SpeechGrpcAsyncIOTransport)SpeechRestTransportc                   @   sL   e Zd ZdZe Zeed< eed< eed< 	d
de	e
 dee fdd	ZdS )SpeechClientMetazMetaclass for the Speech client.

    This provides class-level methods for building and retrieving
    support objects (e.g. transport) without polluting the client instance
    objects.
    grpcgrpc_asynciorestNlabelreturnc                 C   s    |r| j | S tt| j  S )a  Returns an appropriate transport class.

        Args:
            label: The name of the desired transport. If none is
                provided, then the first transport in the registry is used.

        Returns:
            The transport class to use.
        )_transport_registrynextitervalues)clsr*    r1   a/home/ubuntu/.local/lib/python3.10/site-packages/google/cloud/speech_v2/services/speech/client.pyget_transport_class`   s   
z$SpeechClientMeta.get_transport_classN)__name__
__module____qualname____doc__r   r,   r#   r$   r%   r   strr   r"   r3   r1   r1   r1   r2   r&   S   s    r&   c                   @   sL  e Zd ZdZedd ZdZeeZdZ	dZ
edd Zed	efd
dZedefddZeZedefddZedededefddZededeeef fddZedededededef
ddZededeeef fddZededededededefd d!Zededeeef fd"d#Zededed$edefd%d&Zededeeef fd'd(Zededed)edefd*d+Zededeeef fd,d-Zededed.edefd/d0Z ededeeef fd1d2Z!ed3edefd4d5Z"ededeeef fd6d7Z#ed8edefd9d:Z$ededeeef fd;d<Z%ed=edefd>d?Z&ededeeef fd@dAZ'ededefdBdCZ(ededeeef fdDdEZ)edededefdFdGZ*ededeeef fdHdIZ+e	JddKe,e-j. fdLdMZ/edNdO Z0edPdQ Z1edRdS Z2edTe,e dUe,e defdVdWZ3dXdY Z4dZe5j6ddJfd[d\Z7ed]d^ Z8edefd_d`Z9dJdJdJe:dadbe,e;j< dce,e=eee>ddef f  dKe,e=e-j.ef  dee?j@jAddJf
dfdgZB	JddJdJdJe?jCjDe?jCjDdhdidje,e=eEjFef  dke,e d.e,eEjG dle,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfdpdqZP	JddJe?jCjDe?jCjDdhdrdje,e=eEjQef  dke,e dmeHdne=eIeJf doeKeLee=eeMf f  deRjSfdsdtZT	JddJe?jCjDe?jCjDdhdudje,e=eEjUef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deEjGfdwdxZV	JddJdJe?jCjDe?jCjDdhdydje,e=eEjWef  d.e,eEjG dze,eXjY dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfd{d|ZZ	JddJe?jCjDe?jCjDdhdudje,e=eEj[ef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfd}d~Z\	JddJe?jCjDe?jCjDdhdudje,e=eEj]ef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ^	JddJdJdJdJdJe?jCjDe?jCjDdhddje,e=eEj_ef  d.e,e de,eEj` de,eXjY de,eM de,e dmeHdne=eIeJf doeKeLee=eeMf f  deEjafddZb	Jde?jCjDe?jCjDdhdde,eceEjd  dmeHdne=eIeJf doeKeLee=eeMf f  deeeEjf f
ddZg	JddJdJdJdJe?jCjDe?jCjDdhddje,e=eEjhef  d.e,e de,eEj` de,eXjY de,eieEjj  dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZk	JddJe?jCjDe?jCjDdhdudje,e=eEjlef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deEjmfddZn	JddJdJe?jCjDe?jCjDdhddje,e=eEjoef  de,eEjm dze,eXjY dmeHdne=eIeJf doeKeLee=eeMf f  deEjmfddZp	JddJdJdJe?jCjDe?jCjDdhddje,e=eEjqef  dke,e d$e,eEjr de,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZs	JddJe?jCjDe?jCjDdhdrdje,e=eEjtef  dke,e dmeHdne=eIeJf doeKeLee=eeMf f  deRjufddZv	JddJe?jCjDe?jCjDdhdudje,e=eEjwef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deEjrfddZx	JddJdJe?jCjDe?jCjDdhddje,e=eEjyef  d$e,eEjr dze,eXjY dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZz	JddJe?jCjDe?jCjDdhdudje,e=eEj{ef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ|	JddJe?jCjDe?jCjDdhdudje,e=eEj}ef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ~	JddJdJdJe?jCjDe?jCjDdhddje,e=eEjef  dke,e d)e,eEj de,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ	JddJe?jCjDe?jCjDdhdrdje,e=eEjef  dke,e dmeHdne=eIeJf doeKeLee=eeMf f  deRjfddZ	JddJe?jCjDe?jCjDdhdudje,e=eEjef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deEjfddZ	JddJdJe?jCjDe?jCjDdhddje,e=eEjef  d)e,eEj dze,eXjY dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ	JddJe?jCjDe?jCjDdhdudje,e=eEjef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZ	JddJe?jCjDe?jCjDdhdudje,e=eEjef  dve,e dmeHdne=eIeJf doeKeLee=eeMf f  deNjOfddZdddZdd Z	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  dejf
ddZ	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  dejOf
ddZ	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  ddJf
ddZ	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  ddJf
ddZ	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  dejf
ddZ	Jde?jCjDe?jCjDdhddje,ej dmeHdne=eIeJf doeKeLee=eeMf f  dejf
ddZdJS )SpeechClientz5Enables speech transcription and resource management.c                 C   sT   | s| S t d}|| }| \}}}}|s|s| S |r$| ddS | ddS )a\  Converts api endpoint to mTLS endpoint.

        Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
        "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
        Args:
            api_endpoint (Optional[str]): the api endpoint to convert.
        Returns:
            str: converted mTLS api endpoint.
        z[(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?zsandbox.googleapis.comzmtls.sandbox.googleapis.comz.googleapis.comz.mtls.googleapis.com)recompilematchgroupsreplace)api_endpointmtls_endpoint_remnamer   sandboxgoogledomainr1   r1   r2   _get_default_mtls_endpointy   s   
z'SpeechClient._get_default_mtls_endpointzspeech.googleapis.comzspeech.{UNIVERSE_DOMAIN}zgoogleapis.comc                  C   s:   t tdr	t S tdd } | dvrtd| dkS )a  Returns whether client certificate should be used for mTLS if the
        google-auth version supports should_use_client_cert automatic mTLS enablement.

        Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.

        Returns:
            bool: whether client certificate should be used for mTLS
        Raises:
            ValueError: (If using a version of google-auth without should_use_client_cert and
            GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
        should_use_client_cert!GOOGLE_API_USE_CLIENT_CERTIFICATEfalse)truerI   zYEnvironment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`rJ   )hasattrr   rG   osgetenvlower
ValueError)use_client_cert_strr1   r1   r2   _use_client_cert_effective   s   
z'SpeechClient._use_client_cert_effectiveinfoc                 O   "   t j|}||d< | |i |S )av  Creates an instance of this client using the provided credentials
            info.

        Args:
            info (dict): The service account private key info.
            args: Additional arguments to pass to the constructor.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            SpeechClient: The constructed client.
        r   )r   Credentialsfrom_service_account_info)r0   rR   argskwargsr   r1   r1   r2   rU      s   z&SpeechClient.from_service_account_infofilenamec                 O   rS   )a  Creates an instance of this client using the provided credentials
            file.

        Args:
            filename (str): The path to the service account private key json
                file.
            args: Additional arguments to pass to the constructor.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            SpeechClient: The constructed client.
        r   )r   rT   from_service_account_file)r0   rX   rV   rW   r   r1   r1   r2   rY      s   z&SpeechClient.from_service_account_filer+   c                 C      | j S )zReturns the transport used by the client instance.

        Returns:
            SpeechTransport: The transport used by the client
                instance.
        )
_transportselfr1   r1   r2   	transport   s   zSpeechClient.transportprojectlocationc                 C      dj | |dS )z(Returns a fully-qualified config string.z.projects/{project}/locations/{location}/configr_   r`   formatrb   r1   r1   r2   config_path      zSpeechClient.config_pathpathc                 C      t d| }|r| S i S )z1Parses a config path into its component segments.z>^projects/(?P<project>.+?)/locations/(?P<location>.+?)/config$r;   r=   	groupdictrg   rB   r1   r1   r2   parse_config_path   s   zSpeechClient.parse_config_pathkey_ring
crypto_keyc                 C   s   dj | |||dS )z,Returns a fully-qualified crypto_key string.zSprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}r_   r`   rm   rn   rc   ro   r1   r1   r2   crypto_key_path   s   zSpeechClient.crypto_key_pathc                 C   rh   )z5Parses a crypto_key path into its component segments.zq^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)$ri   rk   r1   r1   r2   parse_crypto_key_path  
   z"SpeechClient.parse_crypto_key_pathcrypto_key_versionc                 C   s   dj | ||||dS )z4Returns a fully-qualified crypto_key_version string.zzprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}r_   r`   rm   rn   rs   rc   rt   r1   r1   r2   crypto_key_version_path  s   	z$SpeechClient.crypto_key_version_pathc                 C   rh   )z=Parses a crypto_key_version path into its component segments.z^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)/cryptoKeyVersions/(?P<crypto_key_version>.+?)$ri   rk   r1   r1   r2   parse_crypto_key_version_path'  rr   z*SpeechClient.parse_crypto_key_version_pathcustom_classc                 C      dj | ||dS )z.Returns a fully-qualified custom_class string.zDprojects/{project}/locations/{location}/customClasses/{custom_class}r_   r`   rw   rc   ry   r1   r1   r2   custom_class_path0  
   zSpeechClient.custom_class_pathc                 C   rh   )z7Parses a custom_class path into its component segments.z[^projects/(?P<project>.+?)/locations/(?P<location>.+?)/customClasses/(?P<custom_class>.+?)$ri   rk   r1   r1   r2   parse_custom_class_path=  rr   z$SpeechClient.parse_custom_class_path
phrase_setc                 C   rx   )z,Returns a fully-qualified phrase_set string.z?projects/{project}/locations/{location}/phraseSets/{phrase_set}r_   r`   r}   rc   r~   r1   r1   r2   phrase_set_pathF  r{   zSpeechClient.phrase_set_pathc                 C   rh   )z5Parses a phrase_set path into its component segments.zV^projects/(?P<project>.+?)/locations/(?P<location>.+?)/phraseSets/(?P<phrase_set>.+?)$ri   rk   r1   r1   r2   parse_phrase_set_pathS  rr   z"SpeechClient.parse_phrase_set_path
recognizerc                 C   rx   )z,Returns a fully-qualified recognizer string.z@projects/{project}/locations/{location}/recognizers/{recognizer}r_   r`   r   rc   r   r1   r1   r2   recognizer_path\  s   zSpeechClient.recognizer_pathc                 C   rh   )z5Parses a recognizer path into its component segments.zW^projects/(?P<project>.+?)/locations/(?P<location>.+?)/recognizers/(?P<recognizer>.+?)$ri   rk   r1   r1   r2   parse_recognizer_pathk  rr   z"SpeechClient.parse_recognizer_pathbilling_accountc                 C      dj | dS )z1Returns a fully-qualified billing_account string.z!billingAccounts/{billing_account}r   rc   r   r1   r1   r2   common_billing_account_patht     z(SpeechClient.common_billing_account_pathc                 C   rh   )z9Parse a billing_account path into its component segments.z*^billingAccounts/(?P<billing_account>.+?)$ri   rk   r1   r1   r2   !parse_common_billing_account_path}     z.SpeechClient.parse_common_billing_account_pathfolderc                 C   r   )z(Returns a fully-qualified folder string.zfolders/{folder}r   rc   r   r1   r1   r2   common_folder_path  r   zSpeechClient.common_folder_pathc                 C   rh   )z0Parse a folder path into its component segments.z^folders/(?P<folder>.+?)$ri   rk   r1   r1   r2   parse_common_folder_path  r   z%SpeechClient.parse_common_folder_pathorganizationc                 C   r   )z.Returns a fully-qualified organization string.zorganizations/{organization}r   rc   r   r1   r1   r2   common_organization_path  r   z%SpeechClient.common_organization_pathc                 C   rh   )z6Parse a organization path into its component segments.z%^organizations/(?P<organization>.+?)$ri   rk   r1   r1   r2   parse_common_organization_path  r   z+SpeechClient.parse_common_organization_pathc                 C   r   )z)Returns a fully-qualified project string.zprojects/{project}r_   rc   r   r1   r1   r2   common_project_path  r   z SpeechClient.common_project_pathc                 C   rh   )z1Parse a project path into its component segments.z^projects/(?P<project>.+?)$ri   rk   r1   r1   r2   parse_common_project_path  r   z&SpeechClient.parse_common_project_pathc                 C   ra   )z*Returns a fully-qualified location string.z'projects/{project}/locations/{location}rb   rc   rb   r1   r1   r2   common_location_path  rf   z!SpeechClient.common_location_pathc                 C   rh   )z2Parse a location path into its component segments.z7^projects/(?P<project>.+?)/locations/(?P<location>.+?)$ri   rk   r1   r1   r2   parse_common_location_path  r   z'SpeechClient.parse_common_location_pathNr   c                 C   s   t dt |du rt }t }tdd}|dvr t	dd}|r3|j
r+|j
}nt r3t }|jdur?|j}||fS |dksI|dkrP|rP| j}||fS | j}||fS )a  Deprecated. Return the API endpoint and client cert source for mutual TLS.

        The client cert source is determined in the following order:
        (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
        client cert source is None.
        (2) if `client_options.client_cert_source` is provided, use the provided one; if the
        default client cert source exists, use the default one; otherwise the client cert
        source is None.

        The API endpoint is determined in the following order:
        (1) if `client_options.api_endpoint` if provided, use the provided one.
        (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
        default mTLS endpoint; if the environment variable is "never", use the default API
        endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
        use the default API endpoint.

        More details can be found at https://google.aip.dev/auth/4114.

        Args:
            client_options (google.api_core.client_options.ClientOptions): Custom options for the
                client. Only the `api_endpoint` and `client_cert_source` properties may be used
                in this method.

        Returns:
            Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
                client cert source to use.

        Raises:
            google.auth.exceptions.MutualTLSChannelError: If any errors happen.
        zWget_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.NGOOGLE_API_USE_MTLS_ENDPOINTautor   neveralwaysWEnvironment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`r   )warningswarnDeprecationWarningclient_options_libClientOptionsr:   rQ   rL   rM   r   client_cert_sourcer   has_default_client_cert_sourcedefault_client_cert_sourcer@   DEFAULT_MTLS_ENDPOINTDEFAULT_ENDPOINT)r0   r   use_client_certuse_mtls_endpointr   r@   r1   r1   r2   !get_mtls_endpoint_and_cert_source  s6   #
z.SpeechClient.get_mtls_endpoint_and_cert_sourcec                  C   s<   t  } tdd }td}|dvrtd| ||fS )a  Returns the environment variables used by the client.

        Returns:
            Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
            GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.

        Raises:
            ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
                any of ["true", "false"].
            google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
                is not any of ["auto", "never", "always"].
        r   r   GOOGLE_CLOUD_UNIVERSE_DOMAINr   r   )r:   rQ   rL   rM   rN   r   )r   r   universe_domain_envr1   r1   r2   _read_environment_variables  s   

z(SpeechClient._read_environment_variablesc                 C   s(   d}|r| r
| }|S t  rt  }|S )aZ  Return the client cert source to be used by the client.

        Args:
            provided_cert_source (bytes): The client certificate source provided.
            use_cert_flag (bool): A flag indicating whether to use the client certificate.

        Returns:
            bytes or None: The client cert source to be used by the client.
        N)r   r   r   )provided_cert_sourceuse_cert_flagr   r1   r1   r2   _get_client_cert_source  s   z$SpeechClient._get_client_cert_sourcec                 C   s^   | dur| }|S |dks|dkr&|r&t j}||kr!td| dt j}|S t jj|d}|S )a  Return the API endpoint used by the client.

        Args:
            api_override (str): The API endpoint override. If specified, this is always
                the return value of this function and the other arguments are not used.
            client_cert_source (bytes): The client certificate source used by the client.
            universe_domain (str): The universe domain used by the client.
            use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
                Possible values are "always", "auto", or "never".

        Returns:
            str: The API endpoint to be used by the client.
        Nr   r   z1mTLS is not supported in any universe other than .)UNIVERSE_DOMAIN)r:   _DEFAULT_UNIVERSEr   r   _DEFAULT_ENDPOINT_TEMPLATErd   )api_overrider   universe_domainr   r@   _default_universer1   r1   r2   _get_api_endpoint/  s    
zSpeechClient._get_api_endpointclient_universe_domainr   c                 C   s<   t j}| dur
| }n|dur|}t| dkrtd|S )a  Return the universe domain used by the client.

        Args:
            client_universe_domain (Optional[str]): The universe domain configured via the client options.
            universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.

        Returns:
            str: The universe domain to be used by the client.

        Raises:
            ValueError: If the universe domain is an empty string.
        Nr   z*Universe Domain cannot be an empty string.)r:   r   lenstriprO   )r   r   r   r1   r1   r2   _get_universe_domainQ  s   z!SpeechClient._get_universe_domainc                 C   s   dS )zValidates client's and credentials' universe domains are consistent.

        Returns:
            bool: True iff the configured universe domain is valid.

        Raises:
            ValueError: If the configured universe domain is not valid.
        Tr1   r\   r1   r1   r2   _validate_universe_domainj  s   z&SpeechClient._validate_universe_domainerrorc                 C   sf   |j tjtjtjfvrdS | jj}t|dsdS | }|r/t|j	dr1|j	
t| dS dS dS )zAdds credential info string to error details for 401/403/404 errors.

        Args:
            error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
        Nget_cred_infoappend)coder   UNAUTHORIZED	FORBIDDEN	NOT_FOUNDr[   _credentialsrK   r   _detailsr   jsondumps)r]   r   cred	cred_infor1   r1   r2   _add_cred_info_for_auth_errorsw  s   
z+SpeechClient._add_cred_info_for_auth_errorsc                 C   rZ   )zReturn the API endpoint used by the client instance.

        Returns:
            str: The API endpoint used by the client instance.
        )_api_endpointr\   r1   r1   r2   r@        zSpeechClient.api_endpointc                 C   rZ   )zReturn the universe domain used by the client instance.

        Returns:
            str: The universe domain used by the client instance.
        )_universe_domainr\   r1   r1   r2   r     r   zSpeechClient.universe_domain)r   r^   r   client_infor   r^   .r   c          
      C   sX  || _ t| j trt| j | _ | j du rt | _ ttj| j | _ t| j dd}t	 \| _
| _| _t| j j| j
| _t|| j| _d| _d| _trQt  t| j dd}|r`|r`tdt|t}|r|so| j jso|rstd| j jr{tdtt|| _| jj| _| jpt| j j| j| j| j| _|sddl}|rt |j!j"d	r|j!j"#|}t|t$s|du rt%|ntt&d
tf |}	|	|| j j| j| j j| j| j j'|d| j j(d	| _dt$| jvr&tr(t)*t+j,r*t)j-dt | jdrdt| jj.ddt/| jj.j0 dt/| jj.j1 t| j2j.ddd  dndddd dS dS dS dS )ao  Instantiates the speech client.

        Args:
            credentials (Optional[google.auth.credentials.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify the application to the service; if none
                are specified, the client will attempt to ascertain the
                credentials from the environment.
            transport (Optional[Union[str,SpeechTransport,Callable[..., SpeechTransport]]]):
                The transport to use, or a Callable that constructs and returns a new transport.
                If a Callable is given, it will be called with the same set of initialization
                arguments as used in the SpeechTransport constructor.
                If set to None, a transport is chosen automatically.
            client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
                Custom options for the client.

                1. The ``api_endpoint`` property can be used to override the
                default endpoint provided by the client when ``transport`` is
                not explicitly provided. Only if this property is not set and
                ``transport`` was not explicitly provided, the endpoint is
                determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
                variable, which have one of the following values:
                "always" (always use the default mTLS endpoint), "never" (always
                use the default regular endpoint) and "auto" (auto-switch to the
                default mTLS endpoint if client certificate is present; this is
                the default value).

                2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
                is "true", then the ``client_cert_source`` property can be used
                to provide a client certificate for mTLS transport. If
                not provided, the default SSL client certificate will be used if
                present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
                set, no client certificate will be used.

                3. The ``universe_domain`` property can be used to override the
                default "googleapis.com" universe. Note that the ``api_endpoint``
                property still takes precedence; and ``universe_domain`` is
                currently not supported for mTLS.

            client_info (google.api_core.gapic_v1.client_info.ClientInfo):
                The client info used to send a user-agent string along with
                API requests. If ``None``, then default info will be used.
                Generally, you only need to set this if you're developing
                your own client library.

        Raises:
            google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
                creation failed for any reason.
        Nr   Fapi_keyz=client_options.api_key and credentials are mutually exclusivezFWhen providing a transport instance, provide its credentials directly.zAWhen providing a transport instance, provide its scopes directly.r   get_api_key_credentials.T)	r   credentials_filehostscopesclient_cert_source_for_mtlsquota_project_idr   always_use_jwt_accessapi_audienceasyncz5Created client `google.cloud.speech_v2.SpeechClient`.r   zgoogle.cloud.speech.v2.Speech r   r   c                   S   s   d S r4   r1   r1   r1   r1   r2   <lambda>F  s    z'SpeechClient.__init__.<locals>.<lambda>)serviceNameuniverseDomaincredentialsTypecredentialsInfo)r   r   )extra)3_client_options
isinstancedictr   	from_dictr   r   getattrr:   r   _use_client_cert_use_mtls_endpoint_universe_domain_envr   r   _client_cert_sourcer   r   r   _is_universe_domain_validCLIENT_LOGGING_SUPPORTEDr   initialize_loggingrO   r"   r   r   r[   r   r   r@   google.auth._defaultrK   auth_defaultr   r9   r3   r   r   r   _LOGGERisEnabledForstd_loggingDEBUGdebugr   typer6   r7   r^   )
r]   r   r^   r   r   universe_domain_optapi_key_valuetransport_providedgoogletransport_initr1   r1   r2   __init__  s   ;









 
zSpeechClient.__init__r1   )parentr   recognizer_idr   timeoutmetadatarequestr   r   r   r   r   c                C      |||g}t dd |D dk}	|dur|	rtdt|tjs:t|}|dur,||_|dur3||_|dur:||_| jj	| jj
 }
t|tjd|jfff }|   |
||||d}tj|| jjtjtjd}|S )	a  Creates a [Recognizer][google.cloud.speech.v2.Recognizer].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_create_recognizer():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.CreateRecognizerRequest(
                    parent="parent_value",
                )

                # Make the request
                operation = client.create_recognizer(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.CreateRecognizerRequest, dict]):
                The request object. Request message for the
                [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer]
                method.
            parent (str):
                Required. The project and location where this Recognizer
                will be created. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            recognizer (google.cloud.speech_v2.types.Recognizer):
                Required. The Recognizer to create.
                This corresponds to the ``recognizer`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            recognizer_id (str):
                The ID to use for the Recognizer, which will become the
                final component of the Recognizer's resource name.

                This value should be 4-63 characters, and valid
                characters are /[a-z][0-9]-/.

                This corresponds to the ``recognizer_id`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be
                :class:`google.cloud.speech_v2.types.Recognizer` A
                Recognizer message. Stores recognition configuration and
                metadata.

        c                 S      g | ]}|d ur|qS r4   r1   .0paramr1   r1   r2   
<listcomp>      z2SpeechClient.create_recognizer.<locals>.<listcomp>r   N\If the `request` argument is set, then none of the individual field arguments should be set.r   r   r   r   metadata_type)r   rO   r   r   CreateRecognizerRequestr   r   r   r[   _wrapped_methodscreate_recognizertupler   routing_headerto_grpc_metadatar   	operation
from_gapicoperations_client
RecognizerOperationMetadata)r]   r  r   r   r   r   r   r   flattened_paramshas_flattened_paramsrpcresponser1   r1   r2   r  P  B   
\
zSpeechClient.create_recognizer)r   r   r   r   c          
      C      |g}t dd |D dk}|dur|rtdt|tjs*t|}|dur*||_| jj| jj }t	|t
jd|jfff }|   |||||d}	tj|||	|||d}	|	S )	aD
  Lists Recognizers.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_list_recognizers():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.ListRecognizersRequest(
                    parent="parent_value",
                )

                # Make the request
                page_result = client.list_recognizers(request=request)

                # Handle the response
                for response in page_result:
                    print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.ListRecognizersRequest, dict]):
                The request object. Request message for the
                [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers]
                method.
            parent (str):
                Required. The project and location of Recognizers to
                list. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.services.speech.pagers.ListRecognizersPager:
                Response message for the
                   [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers]
                   method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        c                 S   r  r4   r1   r  r1   r1   r2   r  -  r  z1SpeechClient.list_recognizers.<locals>.<listcomp>r   Nr	  r   r
  methodr  r  r   r   r   )r   rO   r   r   ListRecognizersRequestr   r[   r  list_recognizersr  r   r  r  r   r   ListRecognizersPager
r]   r  r   r   r   r   r  r  r  r  r1   r1   r2   r!    >   H
	
zSpeechClient.list_recognizers)rC   r   r   r   rC   c          
      C      |g}t dd |D dk}|dur|rtdt|tjs*t|}|dur*||_| jj| jj }t	|t
jd|jfff }|   |||||d}	|	S )a	  Returns the requested
        [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
        [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested
        Recognizer doesn't exist.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_get_recognizer():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.GetRecognizerRequest(
                    name="name_value",
                )

                # Make the request
                response = client.get_recognizer(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.GetRecognizerRequest, dict]):
                The request object. Request message for the
                [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer]
                method.
            name (str):
                Required. The name of the Recognizer to retrieve. The
                expected format is
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``.

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.Recognizer:
                A Recognizer message. Stores
                recognition configuration and metadata.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z/SpeechClient.get_recognizer.<locals>.<listcomp>r   Nr	  rC   r
  )r   rO   r   r   GetRecognizerRequestrC   r[   r  get_recognizerr  r   r  r  r   
r]   r  rC   r   r   r   r  r  r  r  r1   r1   r2   r'  a  .   F
zSpeechClient.get_recognizer)r   update_maskr   r   r   r*  c                C      ||g}t dd |D dk}|dur|rtdt|tjs2t|}|dur+||_|dur2||_| jj| jj	 }	t
|tjd|jjfff }|   |	||||d}
tj|
| jjtjtjd}
|
S )	a  Updates the [Recognizer][google.cloud.speech.v2.Recognizer].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_update_recognizer():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UpdateRecognizerRequest(
                )

                # Make the request
                operation = client.update_recognizer(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UpdateRecognizerRequest, dict]):
                The request object. Request message for the
                [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer]
                method.
            recognizer (google.cloud.speech_v2.types.Recognizer):
                Required. The Recognizer to update.

                The Recognizer's ``name`` field is used to identify the
                Recognizer to update. Format:
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``.

                This corresponds to the ``recognizer`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            update_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields to update. If empty, all non-default
                valued fields are considered for update. Use ``*`` to
                update the entire Recognizer resource.

                This corresponds to the ``update_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be
                :class:`google.cloud.speech_v2.types.Recognizer` A
                Recognizer message. Stores recognition configuration and
                metadata.

        c                 S   r  r4   r1   r  r1   r1   r2   r  )  r  z2SpeechClient.update_recognizer.<locals>.<listcomp>r   Nr	  zrecognizer.namer
  r  )r   rO   r   r   UpdateRecognizerRequestr   r*  r[   r  update_recognizerr  r   r  r  rC   r   r  r  r  r  r  )r]   r  r   r*  r   r   r   r  r  r  r  r1   r1   r2   r-    B   U
zSpeechClient.update_recognizerc          
      C      |g}t dd |D dk}|dur|rtdt|tjs*t|}|dur*||_| jj| jj }t	|t
jd|jfff }|   |||||d}	tj|	| jjtjtjd}	|	S )	a
  Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_delete_recognizer():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.DeleteRecognizerRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.delete_recognizer(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.DeleteRecognizerRequest, dict]):
                The request object. Request message for the
                [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer]
                method.
            name (str):
                Required. The name of the Recognizer to delete. Format:
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be
                :class:`google.cloud.speech_v2.types.Recognizer` A
                Recognizer message. Stores recognition configuration and
                metadata.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z2SpeechClient.delete_recognizer.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   DeleteRecognizerRequestrC   r[   r  delete_recognizerr  r   r  r  r   r  r  r  r  r  r(  r1   r1   r2   r1  ^  :   J
zSpeechClient.delete_recognizerc          
      C   r/  )	a
  Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_undelete_recognizer():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UndeleteRecognizerRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.undelete_recognizer(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UndeleteRecognizerRequest, dict]):
                The request object. Request message for the
                [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer]
                method.
            name (str):
                Required. The name of the Recognizer to undelete.
                Format:
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be
                :class:`google.cloud.speech_v2.types.Recognizer` A
                Recognizer message. Stores recognition configuration and
                metadata.

        c                 S   r  r4   r1   r  r1   r1   r2   r  (  r  z4SpeechClient.undelete_recognizer.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   UndeleteRecognizerRequestrC   r[   r  undelete_recognizerr  r   r  r  r   r  r  r  r  r  r(  r1   r1   r2   r4    :   K
z SpeechClient.undelete_recognizer)r   configconfig_maskcontenturir   r   r   r6  r7  r8  r9  c                C   s   |||||g}
t dd |
D dk}|dur|rtdt|tjsJt|}|dur.||_|dur5||_|dur<||_|durC||_|durJ||_	| j
j| j
j }t|	tjd|jfff }	|   |||||	d}|S )ab  Performs synchronous Speech recognition: receive
        results after all audio has been sent and processed.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_recognize():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.RecognizeRequest(
                    content=b'content_blob',
                    recognizer="recognizer_value",
                )

                # Make the request
                response = client.recognize(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.RecognizeRequest, dict]):
                The request object. Request message for the
                [Recognize][google.cloud.speech.v2.Speech.Recognize]
                method. Either ``content`` or ``uri`` must be supplied.
                Supplying both or neither returns
                [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
                See `content
                limits <https://cloud.google.com/speech-to-text/quotas#content>`__.
            recognizer (str):
                Required. The name of the Recognizer to use during
                recognition. The expected format is
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``.
                The {recognizer} segment may be set to ``_`` to use an
                empty implicit Recognizer.

                This corresponds to the ``recognizer`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            config (google.cloud.speech_v2.types.RecognitionConfig):
                Features and audio metadata to use for the Automatic
                Speech Recognition. This field in combination with the
                [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask]
                field can be used to override parts of the
                [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
                of the Recognizer resource.

                This corresponds to the ``config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            config_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields in
                [config][google.cloud.speech.v2.RecognizeRequest.config]
                that override the values in the
                [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
                of the recognizer during this recognition request. If no
                mask is provided, all non-default valued fields in
                [config][google.cloud.speech.v2.RecognizeRequest.config]
                override the values in the recognizer for this
                recognition request. If a mask is provided, only the
                fields listed in the mask override the config in the
                recognizer for this recognition request. If a wildcard
                (``*``) is provided,
                [config][google.cloud.speech.v2.RecognizeRequest.config]
                completely overrides and replaces the config in the
                recognizer for this recognition request.

                This corresponds to the ``config_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            content (bytes):
                The audio data bytes encoded as specified in
                [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig].
                As with all bytes fields, proto buffers use a pure
                binary representation, whereas JSON representations use
                base64.

                This corresponds to the ``content`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            uri (str):
                URI that points to a file that contains audio data bytes
                as specified in
                [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig].
                The file must not be compressed (for example, gzip).
                Currently, only Google Cloud Storage URIs are supported,
                which must be specified in the following format:
                ``gs://bucket_name/object_name`` (other URI formats
                return
                [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
                For more information, see `Request
                URIs <https://cloud.google.com/storage/docs/reference-uris>`__.

                This corresponds to the ``uri`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.RecognizeResponse:
                Response message for the
                   [Recognize][google.cloud.speech.v2.Speech.Recognize]
                   method.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z*SpeechClient.recognize.<locals>.<listcomp>r   Nr	  r   r
  )r   rO   r   r   RecognizeRequestr   r6  r7  r8  r9  r[   r  	recognizer  r   r  r  r   )r]   r  r   r6  r7  r8  r9  r   r   r   r  r  r  r  r1   r1   r2   r;  Y  sD    


zSpeechClient.recognizer
  requestsc                C   s,   | j j| j j }|   |||||d}|S )a  Performs bidirectional streaming speech recognition:
        receive results while sending audio. This method is only
        available via the gRPC API (not REST).

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_streaming_recognize():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.StreamingRecognizeRequest(
                    recognizer="recognizer_value",
                )

                # This method expects an iterator which contains
                # 'speech_v2.StreamingRecognizeRequest' objects
                # Here we create a generator that yields a single `request` for
                # demonstrative purposes.
                requests = [request]

                def request_generator():
                    for request in requests:
                        yield request

                # Make the request
                stream = client.streaming_recognize(requests=request_generator())

                # Handle the response
                for response in stream:
                    print(response)

        Args:
            requests (Iterator[google.cloud.speech_v2.types.StreamingRecognizeRequest]):
                The request object iterator. Request message for the
                [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize]
                method. Multiple
                [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest]
                messages are sent in one call.

                If the [Recognizer][google.cloud.speech.v2.Recognizer]
                referenced by
                [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer]
                contains a fully specified request configuration then
                the stream may only contain messages with only
                [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]
                set.

                Otherwise the first message must contain a
                [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer]
                and a
                [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
                message that together fully specify the request
                configuration and must not contain
                [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio].
                All subsequent messages must only have
                [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]
                set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            Iterable[google.cloud.speech_v2.types.StreamingRecognizeResponse]:
                StreamingRecognizeResponse is the only message returned to the client by
                   StreamingRecognize. A series of zero or more
                   StreamingRecognizeResponse messages are streamed back
                   to the client. If there is no recognizable audio then
                   no messages are streamed back to the client.

                   Here are some examples of
                   \`StreamingRecognizeResponse`s that might be returned
                   while processing audio:

                   1. results { alternatives { transcript: "tube" }
                      stability: 0.01 }

                   2. results { alternatives { transcript: "to be a" }
                      stability: 0.01 }

                   3. results { alternatives { transcript: "to be" }
                      stability: 0.9 } results { alternatives {
                      transcript: " or not to be" } stability: 0.01 }

                   4.

                      results { alternatives { transcript: "to be or not to be"
                         confidence: 0.92 } alternatives { transcript:
                         "to bee or not to bee" } is_final: true }

                   5. results { alternatives { transcript: " that's" }
                      stability: 0.01 }

                   6. results { alternatives { transcript: " that is" }
                      stability: 0.9 } results { alternatives {
                      transcript: " the question" } stability: 0.01 }

                   7.

                      results { alternatives { transcript: " that is the question"
                         confidence: 0.98 } alternatives { transcript: "
                         that was the question" } is_final: true }

                   Notes:

                   - Only two of the above responses #4 and #7 contain
                     final results; they are indicated by is_final:
                     true. Concatenating these together generates the
                     full transcript: "to be or not to be that is the
                     question".

                   - The others contain interim results. #3 and #6
                     contain two interim \`results\`: the first portion
                     has a high stability and is less likely to change;
                     the second portion has a low stability and is very
                     likely to change. A UI designer might choose to
                     show only high stability results.

                   - The specific stability and confidence values shown
                     above are only for illustrative purposes. Actual
                     values may vary.

                   -

                     In each response, only one of these fields will be set:
                        error, speech_event_type, or one or more
                        (repeated) results.

        r
  )r[   r  streaming_recognizer   )r]   r<  r   r   r   r  r  r1   r1   r2   r=    s    z SpeechClient.streaming_recognize)r   r6  r7  filesr   r   r   r>  c                C   s   ||||g}	t dd |	D dk}
|dur|
rtdt|tjsBt|}|dur-||_|dur4||_|dur;||_|durB||_| j	j
| j	j }t|tjd|jfff }|   |||||d}tj|| j	jtjtjd}|S )	aI  Performs batch asynchronous speech recognition: send
        a request with N audio files and receive a long running
        operation that can be polled to see when the
        transcriptions are finished.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_batch_recognize():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.BatchRecognizeRequest(
                    recognizer="recognizer_value",
                )

                # Make the request
                operation = client.batch_recognize(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.BatchRecognizeRequest, dict]):
                The request object. Request message for the
                [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
                method.
            recognizer (str):
                Required. The name of the Recognizer to use during
                recognition. The expected format is
                ``projects/{project}/locations/{location}/recognizers/{recognizer}``.
                The {recognizer} segment may be set to ``_`` to use an
                empty implicit Recognizer.

                This corresponds to the ``recognizer`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            config (google.cloud.speech_v2.types.RecognitionConfig):
                Features and audio metadata to use for the Automatic
                Speech Recognition. This field in combination with the
                [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
                field can be used to override parts of the
                [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
                of the Recognizer resource.

                This corresponds to the ``config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            config_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields in
                [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
                that override the values in the
                [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
                of the recognizer during this recognition request. If no
                mask is provided, all given fields in
                [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
                override the values in the recognizer for this
                recognition request. If a mask is provided, only the
                fields listed in the mask override the config in the
                recognizer for this recognition request. If a wildcard
                (``*``) is provided,
                [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
                completely overrides and replaces the config in the
                recognizer for this recognition request.

                This corresponds to the ``config_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            files (MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]):
                Audio files with file metadata for
                ASR. The maximum number of files allowed
                to be specified is 15.

                This corresponds to the ``files`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.BatchRecognizeResponse` Response message for
                   [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
                   that is packaged into a longrunning
                   [Operation][google.longrunning.Operation].

        c                 S   r  r4   r1   r  r1   r1   r2   r  >  r  z0SpeechClient.batch_recognize.<locals>.<listcomp>r   Nr	  r   r
  r  )r   rO   r   r   BatchRecognizeRequestr   r6  r7  r>  r[   r  batch_recognizer  r   r  r  r   r  r  r  BatchRecognizeResponser  )r]   r  r   r6  r7  r>  r   r   r   r  r  r  r  r1   r1   r2   r@    sJ   |

zSpeechClient.batch_recognizec          
      C   r%  )a7
  Returns the requested [Config][google.cloud.speech.v2.Config].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_get_config():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.GetConfigRequest(
                    name="name_value",
                )

                # Make the request
                response = client.get_config(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.GetConfigRequest, dict]):
                The request object. Request message for the
                [GetConfig][google.cloud.speech.v2.Speech.GetConfig]
                method.
            name (str):
                Required. The name of the config to retrieve. There is
                exactly one config resource per project per location.
                The expected format is
                ``projects/{project}/locations/{location}/config``.

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.Config:
                Message representing the config for the Speech-to-Text API. This includes an
                   optional [KMS
                   key](https://cloud.google.com/kms/docs/resource-hierarchy#keys)
                   with which incoming data will be encrypted.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z+SpeechClient.get_config.<locals>.<listcomp>r   Nr	  rC   r
  )r   rO   r   r   GetConfigRequestrC   r[   r  
get_configr  r   r  r  r   r(  r1   r1   r2   rC  w  r)  zSpeechClient.get_config)r6  r*  r   r   r   c                C   s   ||g}t dd |D dk}|dur|rtdt|tjs2t|}|dur+||_|dur2||_| jj| jj	 }	t
|tjd|jjfff }|   |	||||d}
|
S )a_  Updates the [Config][google.cloud.speech.v2.Config].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_update_config():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UpdateConfigRequest(
                )

                # Make the request
                response = client.update_config(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UpdateConfigRequest, dict]):
                The request object. Request message for the
                [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig]
                method.
            config (google.cloud.speech_v2.types.Config):
                Required. The config to update.

                The config's ``name`` field is used to identify the
                config to be updated. The expected format is
                ``projects/{project}/locations/{location}/config``.

                This corresponds to the ``config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            update_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields to be updated.
                This corresponds to the ``update_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.Config:
                Message representing the config for the Speech-to-Text API. This includes an
                   optional [KMS
                   key](https://cloud.google.com/kms/docs/resource-hierarchy#keys)
                   with which incoming data will be encrypted.

        c                 S   r  r4   r1   r  r1   r1   r2   r  6	  r  z.SpeechClient.update_config.<locals>.<listcomp>r   Nr	  zconfig.namer
  )r   rO   r   r   UpdateConfigRequestr6  r*  r[   r  update_configr  r   r  r  rC   r   )r]   r  r6  r*  r   r   r   r  r  r  r  r1   r1   r2   rE    s6   L
zSpeechClient.update_config)r   rw   custom_class_idr   r   r   rF  c                C   r  )	aG  Creates a [CustomClass][google.cloud.speech.v2.CustomClass].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_create_custom_class():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.CreateCustomClassRequest(
                    parent="parent_value",
                )

                # Make the request
                operation = client.create_custom_class(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.CreateCustomClassRequest, dict]):
                The request object. Request message for the
                [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass]
                method.
            parent (str):
                Required. The project and location where this
                CustomClass will be created. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            custom_class (google.cloud.speech_v2.types.CustomClass):
                Required. The CustomClass to create.
                This corresponds to the ``custom_class`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            custom_class_id (str):
                The ID to use for the CustomClass, which will become the
                final component of the CustomClass's resource name.

                This value should be 4-63 characters, and valid
                characters are /[a-z][0-9]-/.

                This corresponds to the ``custom_class_id`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.CustomClass` CustomClass for biasing in speech recognition. Used to define a set of words
                   or phrases that represents a common concept or theme
                   likely to appear in your audio, for example a list of
                   passenger ship names.

        c                 S   r  r4   r1   r  r1   r1   r2   r  	  r  z4SpeechClient.create_custom_class.<locals>.<listcomp>r   Nr	  r   r
  r  )r   rO   r   r   CreateCustomClassRequestr   rw   rF  r[   r  create_custom_classr  r   r  r  r   r  r  r  CustomClassr  )r]   r  r   rw   rF  r   r   r   r  r  r  r  r1   r1   r2   rH  c	  r  z SpeechClient.create_custom_classc          
      C   r  )	ad
  Lists CustomClasses.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_list_custom_classes():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.ListCustomClassesRequest(
                    parent="parent_value",
                )

                # Make the request
                page_result = client.list_custom_classes(request=request)

                # Handle the response
                for response in page_result:
                    print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.ListCustomClassesRequest, dict]):
                The request object. Request message for the
                [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses]
                method.
            parent (str):
                Required. The project and location of CustomClass
                resources to list. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.services.speech.pagers.ListCustomClassesPager:
                Response message for the
                   [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses]
                   method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        c                 S   r  r4   r1   r  r1   r1   r2   r  @
  r  z4SpeechClient.list_custom_classes.<locals>.<listcomp>r   Nr	  r   r
  r  )r   rO   r   r   ListCustomClassesRequestr   r[   r  list_custom_classesr  r   r  r  r   r   ListCustomClassesPagerr#  r1   r1   r2   rK  	  r$  z SpeechClient.list_custom_classesc          
      C   r%  )aX
  Returns the requested
        [CustomClass][google.cloud.speech.v2.CustomClass].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_get_custom_class():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.GetCustomClassRequest(
                    name="name_value",
                )

                # Make the request
                response = client.get_custom_class(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.GetCustomClassRequest, dict]):
                The request object. Request message for the
                [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass]
                method.
            name (str):
                Required. The name of the CustomClass to retrieve. The
                expected format is
                ``projects/{project}/locations/{location}/customClasses/{custom_class}``.

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.CustomClass:
                CustomClass for biasing in speech
                recognition. Used to define a set of
                words or phrases that represents a
                common concept or theme likely to appear
                in your audio, for example a list of
                passenger ship names.

        c                 S   r  r4   r1   r  r1   r1   r2   r  
  r  z1SpeechClient.get_custom_class.<locals>.<listcomp>r   Nr	  rC   r
  )r   rO   r   r   GetCustomClassRequestrC   r[   r  get_custom_classr  r   r  r  r   r(  r1   r1   r2   rN  t
  s.   H
zSpeechClient.get_custom_class)rw   r*  r   r   r   c                C   r+  )	a  Updates the [CustomClass][google.cloud.speech.v2.CustomClass].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_update_custom_class():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UpdateCustomClassRequest(
                )

                # Make the request
                operation = client.update_custom_class(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UpdateCustomClassRequest, dict]):
                The request object. Request message for the
                [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass]
                method.
            custom_class (google.cloud.speech_v2.types.CustomClass):
                Required. The CustomClass to update.

                The CustomClass's ``name`` field is used to identify the
                CustomClass to update. Format:
                ``projects/{project}/locations/{location}/customClasses/{custom_class}``.

                This corresponds to the ``custom_class`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            update_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields to be updated. If
                empty, all fields are considered for
                update.

                This corresponds to the ``update_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.CustomClass` CustomClass for biasing in speech recognition. Used to define a set of words
                   or phrases that represents a common concept or theme
                   likely to appear in your audio, for example a list of
                   passenger ship names.

        c                 S   r  r4   r1   r  r1   r1   r2   r  >  r  z4SpeechClient.update_custom_class.<locals>.<listcomp>r   Nr	  zcustom_class.namer
  r  )r   rO   r   r   UpdateCustomClassRequestrw   r*  r[   r  update_custom_classr  r   r  r  rC   r   r  r  r  rI  r  )r]   r  rw   r*  r   r   r   r  r  r  r  r1   r1   r2   rP  
  r.  z SpeechClient.update_custom_classc          
      C   r/  )	a'  Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_delete_custom_class():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.DeleteCustomClassRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.delete_custom_class(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.DeleteCustomClassRequest, dict]):
                The request object. Request message for the
                [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass]
                method.
            name (str):
                Required. The name of the CustomClass to delete. Format:
                ``projects/{project}/locations/{location}/customClasses/{custom_class}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.CustomClass` CustomClass for biasing in speech recognition. Used to define a set of words
                   or phrases that represents a common concept or theme
                   likely to appear in your audio, for example a list of
                   passenger ship names.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z4SpeechClient.delete_custom_class.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   DeleteCustomClassRequestrC   r[   r  delete_custom_classr  r   r  r  r   r  r  r  rI  r  r(  r1   r1   r2   rR  s  r2  z SpeechClient.delete_custom_classc          
      C   r/  )	aG  Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_undelete_custom_class():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UndeleteCustomClassRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.undelete_custom_class(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UndeleteCustomClassRequest, dict]):
                The request object. Request message for the
                [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass]
                method.
            name (str):
                Required. The name of the CustomClass to undelete.
                Format:
                ``projects/{project}/locations/{location}/customClasses/{custom_class}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.CustomClass` CustomClass for biasing in speech recognition. Used to define a set of words
                   or phrases that represents a common concept or theme
                   likely to appear in your audio, for example a list of
                   passenger ship names.

        c                 S   r  r4   r1   r  r1   r1   r2   r  =  r  z6SpeechClient.undelete_custom_class.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   UndeleteCustomClassRequestrC   r[   r  undelete_custom_classr  r   r  r  r   r  r  r  rI  r  r(  r1   r1   r2   rT    r5  z"SpeechClient.undelete_custom_class)r   r}   phrase_set_idr   r   r   rU  c                C   r  )	a  Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_create_phrase_set():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.CreatePhraseSetRequest(
                    parent="parent_value",
                )

                # Make the request
                operation = client.create_phrase_set(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.CreatePhraseSetRequest, dict]):
                The request object. Request message for the
                [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet]
                method.
            parent (str):
                Required. The project and location where this PhraseSet
                will be created. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            phrase_set (google.cloud.speech_v2.types.PhraseSet):
                Required. The PhraseSet to create.
                This corresponds to the ``phrase_set`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            phrase_set_id (str):
                The ID to use for the PhraseSet, which will become the
                final component of the PhraseSet's resource name.

                This value should be 4-63 characters, and valid
                characters are /[a-z][0-9]-/.

                This corresponds to the ``phrase_set_id`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.PhraseSet` PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
                   "hints" to the speech recognizer to favor specific
                   words and phrases in the results.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z2SpeechClient.create_phrase_set.<locals>.<listcomp>r   Nr	  r   r
  r  )r   rO   r   r   CreatePhraseSetRequestr   r}   rU  r[   r  create_phrase_setr  r   r  r  r   r  r  r  	PhraseSetr  )r]   r  r   r}   rU  r   r   r   r  r  r  r  r1   r1   r2   rW  n  sB   
[
zSpeechClient.create_phrase_setc          
      C   r  )	aD
  Lists PhraseSets.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_list_phrase_sets():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.ListPhraseSetsRequest(
                    parent="parent_value",
                )

                # Make the request
                page_result = client.list_phrase_sets(request=request)

                # Handle the response
                for response in page_result:
                    print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.ListPhraseSetsRequest, dict]):
                The request object. Request message for the
                [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets]
                method.
            parent (str):
                Required. The project and location of PhraseSet
                resources to list. The expected format is
                ``projects/{project}/locations/{location}``.

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.services.speech.pagers.ListPhraseSetsPager:
                Response message for the
                   [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets]
                   method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        c                 S   r  r4   r1   r  r1   r1   r2   r  J  r  z1SpeechClient.list_phrase_sets.<locals>.<listcomp>r   Nr	  r   r
  r  )r   rO   r   r   ListPhraseSetsRequestr   r[   r  list_phrase_setsr  r   r  r  r   r   ListPhraseSetsPagerr#  r1   r1   r2   rZ     r$  zSpeechClient.list_phrase_setsc          
      C   r%  )a
  Returns the requested
        [PhraseSet][google.cloud.speech.v2.PhraseSet].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_get_phrase_set():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.GetPhraseSetRequest(
                    name="name_value",
                )

                # Make the request
                response = client.get_phrase_set(request=request)

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.GetPhraseSetRequest, dict]):
                The request object. Request message for the
                [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet]
                method.
            name (str):
                Required. The name of the PhraseSet to retrieve. The
                expected format is
                ``projects/{project}/locations/{location}/phraseSets/{phrase_set}``.

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.cloud.speech_v2.types.PhraseSet:
                PhraseSet for biasing in speech
                recognition. A PhraseSet is used to
                provide "hints" to the speech recognizer
                to favor specific words and phrases in
                the results.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z/SpeechClient.get_phrase_set.<locals>.<listcomp>r   Nr	  rC   r
  )r   rO   r   r   GetPhraseSetRequestrC   r[   r  get_phrase_setr  r   r  r  r   r(  r1   r1   r2   r]  ~  s.   G
zSpeechClient.get_phrase_set)r}   r*  r   r   r   c                C   r+  )	a  Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_update_phrase_set():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UpdatePhraseSetRequest(
                )

                # Make the request
                operation = client.update_phrase_set(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UpdatePhraseSetRequest, dict]):
                The request object. Request message for the
                [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet]
                method.
            phrase_set (google.cloud.speech_v2.types.PhraseSet):
                Required. The PhraseSet to update.

                The PhraseSet's ``name`` field is used to identify the
                PhraseSet to update. Format:
                ``projects/{project}/locations/{location}/phraseSets/{phrase_set}``.

                This corresponds to the ``phrase_set`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            update_mask (google.protobuf.field_mask_pb2.FieldMask):
                The list of fields to update. If empty, all non-default
                valued fields are considered for update. Use ``*`` to
                update the entire PhraseSet resource.

                This corresponds to the ``update_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.PhraseSet` PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
                   "hints" to the speech recognizer to favor specific
                   words and phrases in the results.

        c                 S   r  r4   r1   r  r1   r1   r2   r  F  r  z2SpeechClient.update_phrase_set.<locals>.<listcomp>r   Nr	  zphrase_set.namer
  r  )r   rO   r   r   UpdatePhraseSetRequestr}   r*  r[   r  update_phrase_setr  r   r  r  rC   r   r  r  r  rX  r  )r]   r  r}   r*  r   r   r   r  r  r  r  r1   r1   r2   r_    sB   T
zSpeechClient.update_phrase_setc          
      C   r/  )	a
  Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_delete_phrase_set():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.DeletePhraseSetRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.delete_phrase_set(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.DeletePhraseSetRequest, dict]):
                The request object. Request message for the
                [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet]
                method.
            name (str):
                Required. The name of the PhraseSet to delete. Format:
                ``projects/{project}/locations/{location}/phraseSets/{phrase_set}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.PhraseSet` PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
                   "hints" to the speech recognizer to favor specific
                   words and phrases in the results.

        c                 S   r  r4   r1   r  r1   r1   r2   r    r  z2SpeechClient.delete_phrase_set.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   DeletePhraseSetRequestrC   r[   r  delete_phrase_setr  r   r  r  r   r  r  r  rX  r  r(  r1   r1   r2   ra  {  :   I
zSpeechClient.delete_phrase_setc          
      C   r/  )	a
  Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google.cloud import speech_v2

            def sample_undelete_phrase_set():
                # Create a client
                client = speech_v2.SpeechClient()

                # Initialize request argument(s)
                request = speech_v2.UndeletePhraseSetRequest(
                    name="name_value",
                )

                # Make the request
                operation = client.undelete_phrase_set(request=request)

                print("Waiting for operation to complete...")

                response = operation.result()

                # Handle the response
                print(response)

        Args:
            request (Union[google.cloud.speech_v2.types.UndeletePhraseSetRequest, dict]):
                The request object. Request message for the
                [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet]
                method.
            name (str):
                Required. The name of the PhraseSet to undelete. Format:
                ``projects/{project}/locations/{location}/phraseSets/{phrase_set}``

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.speech_v2.types.PhraseSet` PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
                   "hints" to the speech recognizer to favor specific
                   words and phrases in the results.

        c                 S   r  r4   r1   r  r1   r1   r2   r  B  r  z4SpeechClient.undelete_phrase_set.<locals>.<listcomp>r   Nr	  rC   r
  r  )r   rO   r   r   UndeletePhraseSetRequestrC   r[   r  undelete_phrase_setr  r   r  r  r   r  r  r  rX  r  r(  r1   r1   r2   rd    rb  z SpeechClient.undelete_phrase_setc                 C   s   | S r4   r1   r\   r1   r1   r2   	__enter__s  s   zSpeechClient.__enter__c                 C   s   | j   dS )a  Releases underlying transport's resources.

        .. warning::
            ONLY use as a context manager if the transport is NOT shared
            with other clients! Exiting the with block will CLOSE the transport
            and may cause errors in other clients!
        N)r^   close)r]   r   value	tracebackr1   r1   r2   __exit__v  s   zSpeechClient.__exit__c             
   C      t |trtjdi |}| jj| jj }t|tj	
d|jfff }|   z|||||d}|W S  tjyG } z| | |d}~ww )a  Lists operations that match the specified filter in the request.

        Args:
            request (:class:`~.operations_pb2.ListOperationsRequest`):
                The request object. Request message for
                `ListOperations` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                    if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            ~.operations_pb2.ListOperationsResponse:
                Response message for ``ListOperations`` method.
        rC   r
  Nr1   )r   r   r   ListOperationsRequestr[   r  list_operationsr  r   r  r  rC   r   core_exceptionsGoogleAPICallErrorr   r]   r  r   r   r   r  r  er1   r1   r2   rl    (   

zSpeechClient.list_operationsc             
   C   rj  )aS  Gets the latest state of a long-running operation.

        Args:
            request (:class:`~.operations_pb2.GetOperationRequest`):
                The request object. Request message for
                `GetOperation` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                    if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            ~.operations_pb2.Operation:
                An ``Operation`` object.
        rC   r
  Nr1   )r   r   r   GetOperationRequestr[   r  get_operationr  r   r  r  rC   r   rm  rn  r   ro  r1   r1   r2   rs    rq  zSpeechClient.get_operationc                C   d   t |trtjdi |}| jj| jj }t|tj	
d|jfff }|   |||||d dS )a  Deletes a long-running operation.

        This method indicates that the client is no longer interested
        in the operation result. It does not cancel the operation.
        If the server doesn't support this method, it returns
        `google.rpc.Code.UNIMPLEMENTED`.

        Args:
            request (:class:`~.operations_pb2.DeleteOperationRequest`):
                The request object. Request message for
                `DeleteOperation` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                    if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            None
        rC   r
  Nr1   )r   r   r   DeleteOperationRequestr[   r  delete_operationr  r   r  r  rC   r   r]   r  r   r   r   r  r1   r1   r2   rv    s   
 
zSpeechClient.delete_operationc                C   rt  )a  Starts asynchronous cancellation on a long-running operation.

        The server makes a best effort to cancel the operation, but success
        is not guaranteed.  If the server doesn't support this method, it returns
        `google.rpc.Code.UNIMPLEMENTED`.

        Args:
            request (:class:`~.operations_pb2.CancelOperationRequest`):
                The request object. Request message for
                `CancelOperation` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                    if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            None
        rC   r
  Nr1   )r   r   r   CancelOperationRequestr[   r  cancel_operationr  r   r  r  rC   r   rw  r1   r1   r2   ry  .  s   

zSpeechClient.cancel_operationc             
   C   rj  )a1  Gets information about a location.

        Args:
            request (:class:`~.location_pb2.GetLocationRequest`):
                The request object. Request message for
                `GetLocation` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                 if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            ~.location_pb2.Location:
                Location object.
        rC   r
  Nr1   )r   r   r   GetLocationRequestr[   r  get_locationr  r   r  r  rC   r   rm  rn  r   ro  r1   r1   r2   r{  e  rq  zSpeechClient.get_locationc             
   C   rj  )a  Lists information about the supported locations for this service.

        Args:
            request (:class:`~.location_pb2.ListLocationsRequest`):
                The request object. Request message for
                `ListLocations` method.
            retry (google.api_core.retry.Retry): Designation of what errors,
                 if any, should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
                sent along with the request as metadata. Normally, each value must be of type `str`,
                but for metadata keys ending with the suffix `-bin`, the corresponding values must
                be of type `bytes`.
        Returns:
            ~.location_pb2.ListLocationsResponse:
                Response message for ``ListLocations`` method.
        rC   r
  Nr1   )r   r   r   ListLocationsRequestr[   r  list_locationsr  r   r  r  rC   r   rm  rn  r   ro  r1   r1   r2   r}    rq  zSpeechClient.list_locationsr4   )r+   r:   )r5   r6   r7   r8   staticmethodrF   r   __func__r   r   r   rQ   classmethodr   rU   r9   rY   from_service_account_jsonpropertyr"   r^   re   r   rl   rp   rq   ru   rv   rz   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rm  rn  r   r@   r   r!   ga_credentialsrT   r   r   r   r   
ClientInfor   r  DEFAULTr   r  r  OptionalRetryfloatobjectr   r   bytesr  	Operationr  r   r   r"  r!  r&  r'  r,  field_mask_pb2	FieldMaskr-  r0  r1  r3  r4  r:  RecognitionConfigRecognizeResponser;  r   StreamingRecognizeRequestr   StreamingRecognizeResponser=  r?  r
   BatchRecognizeFileMetadatar@  rB  ConfigrC  rD  rE  rG  rI  rH  rJ  rL  rK  rM  rN  rO  rP  rQ  rR  rS  rT  rV  rX  rW  rY  r[  rZ  r\  r]  r^  r_  r`  ra  rc  rd  re  ri  r   rk  ListOperationsResponserl  rr  rs  ru  rv  rx  ry  r   rz  Locationr{  r|  ListLocationsResponser}  r1   r1   r1   r2   r:   v   s   

	

C


!

	
 /
	

 

 

s
	
 



 	


 A

 ,


 :

s
	
}
	

 

 

u
	
 



 
	

 

 

t
	
 

~


|

=

=

:

9

=
r:   )	metaclassprotobuf_runtime_version)r:   )br   loggingr   rL   r;   r   collectionsr   httpr   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   google.protobufr   google.api_corer   r   r   rm  r   r   retriesgoogle.authr   r  google.auth.exceptionsr   google.auth.transportr   google.auth.transport.grpcr   google.oauth2r   google.cloud.speech_v2r   package_versionRetryr  _MethodDefaultr  AttributeErrorr  r   r   ImportError	getLoggerr5   r   google.api_core.operationapi_corer  google.api_core.operation_asyncoperation_asyncgoogle.protobuf.duration_pb2protobufduration_pb2google.protobuf.field_mask_pb2r  google.protobuf.timestamp_pb2timestamp_pb2google.cloud.locationr   google.longrunningr   &google.cloud.speech_v2.services.speechr   google.cloud.speech_v2.typesr   transports.baser!   r"   transports.grpcr#   transports.grpc_asyncior$   transports.restr%   r   r&   r:   r   r  __version__rK   r  __all__r1   r1   r1   r2   <module>   s   <
#                                 
