text:
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from collections import OrderedDict
import os
import re
from typing import (
    Dict,
    Mapping,
    MutableMapping,
    MutableSequence,
    Optional,
    Sequence,
    Tuple,
    Type,
    Union,
    cast,
)

from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.auth import credentials as ga_credentials  # type: ignore
from google.auth.exceptions import MutualTLSChannelError  # type: ignore
from google.auth.transport import mtls  # type: ignore
from google.auth.transport.grpc import SslCredentials  # type: ignore
from google.oauth2 import service_account  # type: ignore
import pkg_resources

try:
    OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
except AttributeError:  # pragma: NO COVER
    OptionalRetry = Union[retries.Retry, object]  # type: ignore

from google.protobuf import field_mask_pb2  # type: ignore

from google.area120.tables_v1alpha1.services.tables_service import pagers
from google.area120.tables_v1alpha1.types import tables

from .transports.base import DEFAULT_CLIENT_INFO, TablesServiceTransport
from .transports.grpc import TablesServiceGrpcTransport
from .transports.grpc_asyncio import TablesServiceGrpcAsyncIOTransport
from .transports.rest import TablesServiceRestTransport

class TablesServiceClientMeta(type):
    """Metaclass for the TablesService client.

    This provides class-level methods for building and retrieving
    support objects (e.g. transport) without polluting the client instance
    objects.
    """

    _transport_registry = OrderedDict()  # type: Dict[str, Type[TablesServiceTransport]]
    _transport_registry["grpc"] = TablesServiceGrpcTransport
    _transport_registry["grpc_asyncio"] = TablesServiceGrpcAsyncIOTransport
    _transport_registry["rest"] = TablesServiceRestTransport

    def get_transport_class(
        cls,
        label: Optional[str] = None,
    ) -> Type[TablesServiceTransport]:
        """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.
        """
        # If a specific transport is requested, return that one.
        if label:
            return cls._transport_registry[label]

        # No transport is requested; return the default (that is, the first one
        # in the dictionary).
        return next(iter(cls._transport_registry.values()))

class TablesServiceClient(metaclass=TablesServiceClientMeta):
    """The Tables Service provides an API for reading and updating tables.
    It defines the following resource model:

    -  The API has a collection of
       [Table][google.area120.tables.v1alpha1.Table] resources, named
       ``tables/*``

    -  Each Table has a collection of
       [Row][google.area120.tables.v1alpha1.Row] resources, named
       ``tables/*/rows/*``

    -  The API has a collection of
       [Workspace][google.area120.tables.v1alpha1.Workspace] resources,
       named ``workspaces/*``.
    """

    @staticmethod
    def _get_default_mtls_endpoint(api_endpoint):
        """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.
        """
        if not api_endpoint:
            return api_endpoint

        mtls_endpoint_re = re.compile(
            r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
        )

        m = mtls_endpoint_re.match(api_endpoint)
        name, mtls, sandbox, googledomain = m.groups()
        if mtls or not googledomain:
            return api_endpoint

        if sandbox:
            return api_endpoint.replace(
                "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
            )

        return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")

    DEFAULT_ENDPOINT = "area120tables.googleapis.com"
    DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__(  # type: ignore
        DEFAULT_ENDPOINT
    )

    @classmethod
    def from_service_account_info(cls, info: dict, *args, **kwargs):
        """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:
            TablesServiceClient: The constructed client.
        """
        credentials = service_account.Credentials.from_service_account_info(info)
        kwargs["credentials"] = credentials
        return cls(*args, **kwargs)

    @classmethod
    def from_service_account_file(cls, filename: str, *args, **kwargs):
        """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:
            TablesServiceClient: The constructed client.
        """
        credentials = service_account.Credentials.from_service_account_file(filename)
        kwargs["credentials"] = credentials
        return cls(*args, **kwargs)

    from_service_account_json = from_service_account_file

    @property
    def transport(self) -> TablesServiceTransport:
        """Returns the transport used by the client instance.

        Returns:
            TablesServiceTransport: The transport used by the client
                instance.
        """
        return self._transport

    @staticmethod
    def row_path(
        table: str,
        row: str,
    ) -> str:
        """Returns a fully-qualified row string."""
        return "tables/{table}/rows/{row}".format(
            table=table,
            row=row,
        )

    @staticmethod
    def parse_row_path(path: str) -> Dict[str, str]:
        """Parses a row path into its component segments."""
        m = re.match(r"^tables/(?P<table>.+?)/rows/(?P<row>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def table_path(
        table: str,
    ) -> str:
        """Returns a fully-qualified table string."""
        return "tables/{table}".format(
            table=table,
        )

    @staticmethod
    def parse_table_path(path: str) -> Dict[str, str]:
        """Parses a table path into its component segments."""
        m = re.match(r"^tables/(?P<table>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def workspace_path(
        workspace: str,
    ) -> str:
        """Returns a fully-qualified workspace string."""
        return "workspaces/{workspace}".format(
            workspace=workspace,
        )

    @staticmethod
    def parse_workspace_path(path: str) -> Dict[str, str]:
        """Parses a workspace path into its component segments."""
        m = re.match(r"^workspaces/(?P<workspace>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def common_billing_account_path(
        billing_account: str,
    ) -> str:
        """Returns a fully-qualified billing_account string."""
        return "billingAccounts/{billing_account}".format(
            billing_account=billing_account,
        )

    @staticmethod
    def parse_common_billing_account_path(path: str) -> Dict[str, str]:
        """Parse a billing_account path into its component segments."""
        m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def common_folder_path(
        folder: str,
    ) -> str:
        """Returns a fully-qualified folder string."""
        return "folders/{folder}".format(
            folder=folder,
        )

    @staticmethod
    def parse_common_folder_path(path: str) -> Dict[str, str]:
        """Parse a folder path into its component segments."""
        m = re.match(r"^folders/(?P<folder>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def common_organization_path(
        organization: str,
    ) -> str:
        """Returns a fully-qualified organization string."""
        return "organizations/{organization}".format(
            organization=organization,
        )

    @staticmethod
    def parse_common_organization_path(path: str) -> Dict[str, str]:
        """Parse a organization path into its component segments."""
        m = re.match(r"^organizations/(?P<organization>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def common_project_path(
        project: str,
    ) -> str:
        """Returns a fully-qualified project string."""
        return "projects/{project}".format(
            project=project,
        )

    @staticmethod
    def parse_common_project_path(path: str) -> Dict[str, str]:
        """Parse a project path into its component segments."""
        m = re.match(r"^projects/(?P<project>.+?)$", path)
        return m.groupdict() if m else {}

    @staticmethod
    def common_location_path(
        project: str,
        location: str,
    ) -> str:
        """Returns a fully-qualified location string."""
        return "projects/{project}/locations/{location}".format(
            project=project,
            location=location,
        )

    @staticmethod
    def parse_common_location_path(path: str) -> Dict[str, str]:
        """Parse a location path into its component segments."""
        m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
        return m.groupdict() if m else {}

    @classmethod
    def get_mtls_endpoint_and_cert_source(
        cls, client_options: Optional[client_options_lib.ClientOptions] = None
    ):
        """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 variabel 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.
        """
        if client_options is None:
            client_options = client_options_lib.ClientOptions()
        use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
        use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
        if use_client_cert not in ("true", "false"):
            raise ValueError(
                "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
            )
        if use_mtls_endpoint not in ("auto", "never", "always"):
            raise MutualTLSChannelError(
                "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
            )

        # Figure out the client cert source to use.
        client_cert_source = None
        if use_client_cert == "true":
            if client_options.client_cert_source:
                client_cert_source = client_options.client_cert_source
            elif mtls.has_default_client_cert_source():
                client_cert_source = mtls.default_client_cert_source()

        # Figure out which api endpoint to use.
        if client_options.api_endpoint is not None:
            api_endpoint = client_options.api_endpoint
        elif use_mtls_endpoint == "always" or (
            use_mtls_endpoint == "auto" and client_cert_source
        ):
            api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
        else:
            api_endpoint = cls.DEFAULT_ENDPOINT

        return api_endpoint, client_cert_source

    def __init__(
        self,
        *,
        credentials: Optional[ga_credentials.Credentials] = None,
        transport: Optional[Union[str, TablesServiceTransport]] = None,
        client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
        client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
    ) -> None:
        """Instantiates the tables service 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 (Union[str, TablesServiceTransport]): The
                transport to use. If set to None, a transport is chosen
                automatically.
                NOTE: "rest" transport functionality is currently in a
                beta state (preview). We welcome your feedback via an
                issue in this library's source repository.
            client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
                client. It won't take effect if a ``transport`` instance is provided.
                (1) The ``api_endpoint`` property can be used to override the
                default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
                environment variable can also be used to override the endpoint:
                "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). However, the ``api_endpoint`` property takes
                precedence if provided.
                (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
                is "true", then the ``client_cert_source`` property can be used
                to provide client certificate for mutual TLS 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.
            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.
        """
        if isinstance(client_options, dict):
            client_options = client_options_lib.from_dict(client_options)
        if client_options is None:
            client_options = client_options_lib.ClientOptions()
        client_options = cast(client_options_lib.ClientOptions, client_options)

        api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
            client_options
        )

        api_key_value = getattr(client_options, "api_key", None)
        if api_key_value and credentials:
            raise ValueError(
                "client_options.api_key and credentials are mutually exclusive"
            )

        # Save or instantiate the transport.
        # Ordinarily, we provide the transport, but allowing a custom transport
        # instance provides an extensibility point for unusual situations.
        if isinstance(transport, TablesServiceTransport):
            # transport is a TablesServiceTransport instance.
            if credentials or client_options.credentials_file or api_key_value:
                raise ValueError(
                    "When providing a transport instance, "
                    "provide its credentials directly."
                )
            if client_options.scopes:
                raise ValueError(
                    "When providing a transport instance, provide its scopes "
                    "directly."
                )
            self._transport = transport
        else:
            import google.auth._default  # type: ignore

            if api_key_value and hasattr(
                google.auth._default, "get_api_key_credentials"
            ):
                credentials = google.auth._default.get_api_key_credentials(
                    api_key_value
                )

            Transport = type(self).get_transport_class(transport)
            self._transport = Transport(
                credentials=credentials,
                credentials_file=client_options.credentials_file,
                host=api_endpoint,
                scopes=client_options.scopes,
                client_cert_source_for_mtls=client_cert_source_func,
                quota_project_id=client_options.quota_project_id,
                client_info=client_info,
                always_use_jwt_access=True,
                api_audience=client_options.api_audience,
            )

    def get_table(
        self,
        request: Optional[Union[tables.GetTableRequest, dict]] = None,
        *,
        name: Optional[str] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.Table:
        r"""Gets a table. Returns NOT_FOUND if the table does not 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.area120 import tables_v1alpha1

            def sample_get_table():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.GetTableRequest(
                    name="name_value",
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.GetTableRequest, dict]):
                The request object. Request message for
                TablesService.GetTable.
            name (str):
                Required. The name of the table to
                retrieve. Format: tables/{table}

                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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.Table:
                A single table.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([name])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.GetTableRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.GetTableRequest):
            request = tables.GetTableRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if name is not None:
                request.name = name

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.get_table]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def list_tables(
        self,
        request: Optional[Union[tables.ListTablesRequest, dict]] = None,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> pagers.ListTablesPager:
        r"""Lists tables for the user.

        .. 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.area120 import tables_v1alpha1

            def sample_list_tables():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.ListTablesRequest(
                )

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

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

        Args:
            request (Union[google.area120.tables_v1alpha1.types.ListTablesRequest, dict]):
                The request object. Request message for
                TablesService.ListTables.
            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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.services.tables_service.pagers.ListTablesPager:
                Response message for
                TablesService.ListTables.
                Iterating over this object will yield
                results and resolve additional pages
                automatically.

        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a tables.ListTablesRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.ListTablesRequest):
            request = tables.ListTablesRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.list_tables]

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # This method is paged; wrap the response in a pager, which provides
        # an `__iter__` convenience method.
        response = pagers.ListTablesPager(
            method=rpc,
            request=request,
            response=response,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def get_workspace(
        self,
        request: Optional[Union[tables.GetWorkspaceRequest, dict]] = None,
        *,
        name: Optional[str] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.Workspace:
        r"""Gets a workspace. Returns NOT_FOUND if the workspace does not
        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.area120 import tables_v1alpha1

            def sample_get_workspace():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.GetWorkspaceRequest(
                    name="name_value",
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.GetWorkspaceRequest, dict]):
                The request object. Request message for
                TablesService.GetWorkspace.
            name (str):
                Required. The name of the workspace
                to retrieve. Format:
                workspaces/{workspace}

                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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.Workspace:
                A single workspace.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([name])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.GetWorkspaceRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.GetWorkspaceRequest):
            request = tables.GetWorkspaceRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if name is not None:
                request.name = name

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.get_workspace]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def list_workspaces(
        self,
        request: Optional[Union[tables.ListWorkspacesRequest, dict]] = None,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> pagers.ListWorkspacesPager:
        r"""Lists workspaces for the user.

        .. 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.area120 import tables_v1alpha1

            def sample_list_workspaces():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.ListWorkspacesRequest(
                )

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

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

        Args:
            request (Union[google.area120.tables_v1alpha1.types.ListWorkspacesRequest, dict]):
                The request object. Request message for
                TablesService.ListWorkspaces.
            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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.services.tables_service.pagers.ListWorkspacesPager:
                Response message for
                TablesService.ListWorkspaces.
                Iterating over this object will yield
                results and resolve additional pages
                automatically.

        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a tables.ListWorkspacesRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.ListWorkspacesRequest):
            request = tables.ListWorkspacesRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.list_workspaces]

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # This method is paged; wrap the response in a pager, which provides
        # an `__iter__` convenience method.
        response = pagers.ListWorkspacesPager(
            method=rpc,
            request=request,
            response=response,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def get_row(
        self,
        request: Optional[Union[tables.GetRowRequest, dict]] = None,
        *,
        name: Optional[str] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.Row:
        r"""Gets a row. Returns NOT_FOUND if the row does not exist in the
        table.

        .. 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.area120 import tables_v1alpha1

            def sample_get_row():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.GetRowRequest(
                    name="name_value",
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.GetRowRequest, dict]):
                The request object. Request message for
                TablesService.GetRow.
            name (str):
                Required. The name of the row to
                retrieve. Format:
                tables/{table}/rows/{row}

                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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.Row:
                A single row in a table.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([name])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.GetRowRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.GetRowRequest):
            request = tables.GetRowRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if name is not None:
                request.name = name

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.get_row]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def list_rows(
        self,
        request: Optional[Union[tables.ListRowsRequest, dict]] = None,
        *,
        parent: Optional[str] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> pagers.ListRowsPager:
        r"""Lists rows in a table. Returns NOT_FOUND if the table does not
        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.area120 import tables_v1alpha1

            def sample_list_rows():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.ListRowsRequest(
                    parent="parent_value",
                )

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

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

        Args:
            request (Union[google.area120.tables_v1alpha1.types.ListRowsRequest, dict]):
                The request object. Request message for
                TablesService.ListRows.
            parent (str):
                Required. The parent table.
                Format: tables/{table}

                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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.services.tables_service.pagers.ListRowsPager:
                Response message for
                TablesService.ListRows.
                Iterating over this object will yield
                results and resolve additional pages
                automatically.

        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([parent])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.ListRowsRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.ListRowsRequest):
            request = tables.ListRowsRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if parent is not None:
                request.parent = parent

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.list_rows]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # This method is paged; wrap the response in a pager, which provides
        # an `__iter__` convenience method.
        response = pagers.ListRowsPager(
            method=rpc,
            request=request,
            response=response,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def create_row(
        self,
        request: Optional[Union[tables.CreateRowRequest, dict]] = None,
        *,
        parent: Optional[str] = None,
        row: Optional[tables.Row] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.Row:
        r"""Creates a row.

        .. 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.area120 import tables_v1alpha1

            def sample_create_row():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.CreateRowRequest(
                    parent="parent_value",
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.CreateRowRequest, dict]):
                The request object. Request message for
                TablesService.CreateRow.
            parent (str):
                Required. The parent table where this
                row will be created. Format:
                tables/{table}

                This corresponds to the ``parent`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            row (google.area120.tables_v1alpha1.types.Row):
                Required. The row to create.
                This corresponds to the ``row`` 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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.Row:
                A single row in a table.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([parent, row])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.CreateRowRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.CreateRowRequest):
            request = tables.CreateRowRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if parent is not None:
                request.parent = parent
            if row is not None:
                request.row = row

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.create_row]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def batch_create_rows(
        self,
        request: Optional[Union[tables.BatchCreateRowsRequest, dict]] = None,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.BatchCreateRowsResponse:
        r"""Creates multiple rows.

        .. 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.area120 import tables_v1alpha1

            def sample_batch_create_rows():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                requests = tables_v1alpha1.CreateRowRequest()
                requests.parent = "parent_value"

                request = tables_v1alpha1.BatchCreateRowsRequest(
                    parent="parent_value",
                    requests=requests,
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.BatchCreateRowsRequest, dict]):
                The request object. Request message for
                TablesService.BatchCreateRows.
            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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.BatchCreateRowsResponse:
                Response message for
                TablesService.BatchCreateRows.

        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a tables.BatchCreateRowsRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.BatchCreateRowsRequest):
            request = tables.BatchCreateRowsRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.batch_create_rows]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def update_row(
        self,
        request: Optional[Union[tables.UpdateRowRequest, dict]] = None,
        *,
        row: Optional[tables.Row] = None,
        update_mask: Optional[field_mask_pb2.FieldMask] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.Row:
        r"""Updates a row.

        .. 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.area120 import tables_v1alpha1

            def sample_update_row():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.UpdateRowRequest(
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.UpdateRowRequest, dict]):
                The request object. Request message for
                TablesService.UpdateRow.
            row (google.area120.tables_v1alpha1.types.Row):
                Required. The row to update.
                This corresponds to the ``row`` 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.
                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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.Row:
                A single row in a table.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([row, update_mask])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.UpdateRowRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.UpdateRowRequest):
            request = tables.UpdateRowRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if row is not None:
                request.row = row
            if update_mask is not None:
                request.update_mask = update_mask

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.update_row]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("row.name", request.row.name),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def batch_update_rows(
        self,
        request: Optional[Union[tables.BatchUpdateRowsRequest, dict]] = None,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> tables.BatchUpdateRowsResponse:
        r"""Updates multiple rows.

        .. 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.area120 import tables_v1alpha1

            def sample_batch_update_rows():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.BatchUpdateRowsRequest(
                    parent="parent_value",
                )

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

                # Handle the response
                print(response)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.BatchUpdateRowsRequest, dict]):
                The request object. Request message for
                TablesService.BatchUpdateRows.
            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, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.area120.tables_v1alpha1.types.BatchUpdateRowsResponse:
                Response message for
                TablesService.BatchUpdateRows.

        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a tables.BatchUpdateRowsRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.BatchUpdateRowsRequest):
            request = tables.BatchUpdateRowsRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.batch_update_rows]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
        )

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Done; return the response.
        return response

    def delete_row(
        self,
        request: Optional[Union[tables.DeleteRowRequest, dict]] = None,
        *,
        name: Optional[str] = None,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> None:
        r"""Deletes a row.

        .. 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.area120 import tables_v1alpha1

            def sample_delete_row():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.DeleteRowRequest(
                    name="name_value",
                )

                # Make the request
                client.delete_row(request=request)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.DeleteRowRequest, dict]):
                The request object. Request message for
                TablesService.DeleteRow
            name (str):
                Required. The name of the row to
                delete. Format:
                tables/{table}/rows/{row}

                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, str]]): Strings which should be
                sent along with the request as metadata.
        """
        # Create or coerce a protobuf request object.
        # Quick check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        has_flattened_params = any([name])
        if request is not None and has_flattened_params:
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        # Minor optimization to avoid making a copy if the user passes
        # in a tables.DeleteRowRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.DeleteRowRequest):
            request = tables.DeleteRowRequest(request)
            # If we have keyword arguments corresponding to fields on the
            # request, apply these.
            if name is not None:
                request.name = name

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.delete_row]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
        )

        # Send the request.
        rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

    def batch_delete_rows(
        self,
        request: Optional[Union[tables.BatchDeleteRowsRequest, dict]] = None,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> None:
        r"""Deletes multiple rows.

        .. 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.area120 import tables_v1alpha1

            def sample_batch_delete_rows():
                # Create a client
                client = tables_v1alpha1.TablesServiceClient()

                # Initialize request argument(s)
                request = tables_v1alpha1.BatchDeleteRowsRequest(
                    parent="parent_value",
                    names=['names_value1', 'names_value2'],
                )

                # Make the request
                client.batch_delete_rows(request=request)

        Args:
            request (Union[google.area120.tables_v1alpha1.types.BatchDeleteRowsRequest, dict]):
                The request object. Request message for
                TablesService.BatchDeleteRows
            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, str]]): Strings which should be
                sent along with the request as metadata.
        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a tables.BatchDeleteRowsRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, tables.BatchDeleteRowsRequest):
            request = tables.BatchDeleteRowsRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.batch_delete_rows]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
        )

        # Send the request.
        rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

    def __enter__(self):
        return self

    def __exit__(self, type, value, traceback):
        """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!
        """
        self.transport.close()

try:
    DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
        gapic_version=pkg_resources.get_distribution(
            "google-area120-tables",
        ).version,
    )
except pkg_resources.DistributionNotFound:
    DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

__all__ = ("TablesServiceClient",)


text:
export interface DeadPeopleProps {
  id: string;
}

export interface DeadPeopleState {
  retrieved: boolean;
  results?: any;
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

const assert   = require('assert');
const Embedza  = require('..');
const nock     = require('nock');

describe('API', function () {

  it('.addFetcher()', async function () {
    let embedza = new Embedza();

    embedza.addFetcher({
      id: 'test-fetcher',
      priority: -999,
      fn: () => Promise.reject('test fetcher error')
    });

    embedza.addDomain('example.org');

    await assert.rejects(
      embedza.render('http://example.org/12345', 'block'),
      /test fetcher error/
    );
  });

  it('.addMixin()', async function () {
    let embedza = new Embedza();

    embedza.addMixin({
      id: 'test-mixin',
      fn: () => Promise.reject('test mixin error')
    });

    // Mock `.request`
    embedza.request = () => Promise.resolve({
      statusCode: 200,
      body: '{}'
    });

    await assert.rejects(
      embedza.render('https://vimeo.com/channels/staffpicks/135373919', 'block'),
      /test mixin error/
    );
  });

  it('.addMixinAfter()', async function () {
    let embedza = new Embedza();

    embedza.addMixinAfter({
      id: 'test-mixin-after',
      fn: () => Promise.reject('test mixin after error')
    });

    // Mock `.request`
    embedza.request = () => Promise.resolve({
      statusCode: 200,
      body: '{}'
    });

    await assert.rejects(
      embedza.render('https://vimeo.com/channels/staffpicks/135373919', 'block'),
      /test mixin after error/
    );
  });

  it('.rule()', function () {
    let embedza = new Embedza();

    embedza.addDomain('test.com');

    let rule = embedza.rule('test.com');

    assert.ok(rule.enabled);
    assert.strictEqual(rule.id, 'test.com');
  });

  it('.forEach() - disable domain', async function () {
    let embedza = new Embedza();

    embedza.forEach(function (domain) {
      if (domain.id === 'youtube.com') {
        domain.enabled = false;
      }
    });

    // Mock `.request`
    embedza.request = () => Promise.resolve({
      statusCode: 200,
      body: '{}'
    });

    let res = await embedza.info('https://www.youtube.com/watch?v=jNQXAC9IVRw');
    assert.strictEqual(res, null);
    res = await embedza.info('https://vimeo.com/channels/staffpicks/135373919');
    assert.strictEqual(res.src, 'https://vimeo.com/channels/staffpicks/135373919');
  });

  it('Default user agent', async function () {
    let embedza = new Embedza();
    let server = nock('https://example.com')
      .get('/asd')
      .reply(function () {
        if (/^embedza/.test(this.req.headers['user-agent'])) return [ 200, '' ];
        return [ 503, '' ];
      });

    await embedza.request('https://example.com/asd');
    server.done();
  });

  it('Custom user agent', async function () {
    let embedza = new Embedza({
      request: {
        headers: {
          'user-agent': 'foobar'
        }
      }
    });
    let server = nock('https://example.com')
      .get('/asd')
      .reply(function () {
        if (/^foo/.test(this.req.headers['user-agent'])) return [ 200, '' ];
        return [ 503, '' ];
      });

    await embedza.request('https://example.com/asd');
    server.done();
  });

  describe('.addDomain()', function () {

    it('.addDomain() with domain name', async function () {
      let embedza = new Embedza();

      // Mock `.request`
      embedza.request = () => Promise.resolve({
        statusCode: 200,
        body: ''
      });

      let res = await embedza.info('https://example.com/');
      assert.strictEqual(res, null);

      embedza.addDomain('example.com');

      res = await embedza.info('https://example.com/');
      assert.strictEqual(res.src, 'https://example.com/');
    });

    it('.addDomain() disabled', async function () {
      let embedza = new Embedza({ enabledProviders: [ 'test.com', 'youtube.com' ] });

      embedza.addDomain('example.com');

      const res = await embedza.info('https://example.com/asd');
      assert.strictEqual(res, null);
    });

    it('.addDomain() with options', async function () {
      let embedza = new Embedza();
      let server = nock('https://example.com')
        .get('/asd')
        .reply(200, `

            <meta name="twitter:image" content="https://example.com/123.jpg">
            <meta name="twitter:image:width" content="222">
            <meta name="twitter:image:height" content="333">

        `);

      embedza.addDomain({
        id: 'example.com',
        match: /^https?:\/\/example.com\/.*/,
        fetchers: [
          'meta',
          env => {
            env.result.fetchersExtraTest1 = true;
            return Promise.resolve();
          },
          {
            fn: env => {
              env.result.fetchersExtraTest2 = true;
              return Promise.resolve();
            },
            priority: 0
          }
        ],
        mixins: [
          'twitter-thumbnail',
          env => {
            env.result.mixinsExtraTest = true;
            return Promise.resolve();
          }
        ],
        mixinsAfter: [
          'ssl-force',
          env => {
            env.result.mixinsAfterExtraTest = true;
            return Promise.resolve();
          },
          'convert-str-int'
        ]
      });

      const res = await embedza.info('https://example.com/asd');
      assert.deepStrictEqual(res.snippets, [ {
        type: 'image',
        href: 'https://example.com/123.jpg',
        tags: [ 'thumbnail', 'twitter', 'ssl' ],
        media: { width: 222, height: 333 }
      } ]);

      assert.ok(res.fetchersExtraTest1);
      assert.ok(res.fetchersExtraTest2);
      assert.ok(res.mixinsExtraTest);
      assert.ok(res.mixinsAfterExtraTest);

      server.done();
    });
  });

  describe('.info()', function () {
    it('from cache', async function () {
      let embedza = new Embedza({
        cache: {
          get: () => Promise.resolve({ info: { foo: 'bar' } })
        },
        enabledProviders: [ 'test.com' ]
      });

      const res = await embedza.info('http://test.com/bla');
      assert.deepStrictEqual(res, { foo: 'bar' });
    });

    it('from cache with error', async function () {
      let embedza = new Embedza({
        cache: {
          get: () => Promise.reject('err')
        },
        enabledProviders: [ 'test.com' ]
      });

      await assert.rejects(
        embedza.info('http://test.com/bla'),
        /err/
      );
    });

    it('bad url', async function () {
      let embedza = new Embedza();

      const res = await embedza.info('badurl');
      assert.ok(!res);
    });
  });

  describe('.render()', function () {
    it('inline', async function () {
      let embedza = new Embedza({ enabledProviders: [ 'example.com' ] });
      let server = nock('https://example.com')
        .get('/asd')
        .reply(200, '<meta name="title" value="test">');

      const res = await embedza.render('https://example.com/asd', 'inline');

      server.done();

      assert.strictEqual(
        res.html,
        'test'
      );
    });

    it('not enough data', async function () {
      let embedza = new Embedza({ enabledProviders: [ 'example.com' ] });
      let server = nock('https://example.com')
        .get('/asd')
        .reply(200, '');

      const res = await embedza.render('https://example.com/asd', [ 'player', 'rich', 'test' ]);
      assert.ok(!res);
      server.done();
    });

    it('inline with info', async function () {
      let embedza = new Embedza();

      const res = await embedza.render({ domain: 'a', src: 'b', meta: { title: 'c' } }, 'inline');

      assert.strictEqual(
        res.html,
        'c'
      );
    });

    it('bad url', async function () {
      let embedza = new Embedza({ enabledProviders: [ 'badurl.badurl' ] });

      await assert.rejects(
        embedza.render('http://badurl.badurl/asd', 'inline'),
        /getaddrinfo ENOTFOUND badurl[.]badurl/
      );
    });

    it('bad url', async function () {
      let embedza = new Embedza({ enabledProviders: [ 'badurl.badurl' ] });

      await assert.rejects(
        embedza.render('http://badurl.badurl/asd', 'inline'),
        /getaddrinfo ENOTFOUND badurl[.]badurl/
      );
    });

    // coverage
    it('input that prodices no data', async function () {
      let embedza = new Embedza();

      const res = await embedza.render(null);
      assert.strictEqual(res, null);
    });
  });
});


text:
// This file implements unit tests for class Function and FunctionEval.

#include "core/cross/client.h"
#include "tests/common/win/testing_common.h"
#include "core/cross/function.h"

namespace o3d {

class FunctionTest : public testing::Test {
 protected:

  FunctionTest()
      : object_manager_(g_service_locator),
        error_status_(g_service_locator) {
  }

  virtual void SetUp();
  virtual void TearDown();

  Pack* pack() { return pack_; }

 private:

  ServiceDependency<ObjectManager> object_manager_;
  ErrorStatus error_status_;
  Pack* pack_;
};

void FunctionTest::SetUp() {
  pack_ = object_manager_->CreatePack();
}

void FunctionTest::TearDown() {
  pack_->Destroy();
}

namespace {

// Just multiplies the input by 2.0f
class TestFunction : public Function {
 public:
  explicit TestFunction(ServiceLocator* service_locator)
      : Function(service_locator) {
  }

  // overridden from Function
  virtual float Evaluate(float input, FunctionContext* context) const {
    return input * 2.0f;
  }

  // overridden from Function
  virtual FunctionContext* CreateFunctionContext() const {
    return NULL;
  }

  // overridden from Function
  virtual const ObjectBase::Class* GetFunctionContextClass() const {
    return NULL;
  }

 private:
  O3D_DECL_CLASS(TestFunction, Function);
  DISALLOW_COPY_AND_ASSIGN(TestFunction);
};

O3D_DEFN_CLASS(TestFunction, Function);

}  // anonymous namespace.

// Tests Function.
TEST_F(FunctionTest, Basic) {
  Function::Ref function = Function::Ref(new TestFunction(g_service_locator));
  // Check that it got created.
  ASSERT_FALSE(function.IsNull());
  // Check that it derives from NamedObject
  EXPECT_TRUE(function->IsA(NamedObject::GetApparentClass()));
}

// Tests Evaluate.
TEST_F(FunctionTest, Evaluate) {
  Function::Ref function = Function::Ref(new TestFunction(g_service_locator));
  // Check that it got created.
  ASSERT_FALSE(function.IsNull());

  EXPECT_EQ(function->Evaluate(2.0f, NULL), 2.0f * 2.0f);
  EXPECT_EQ(function->Evaluate(4.0f, NULL), 4.0f * 2.0f);
  EXPECT_EQ(function->Evaluate(-4.0f, NULL), -4.0f * 2.0f);
}

class FunctionEvalTest : public testing::Test {
 protected:

  FunctionEvalTest()
      : object_manager_(g_service_locator),
        error_status_(g_service_locator) {
  }

  virtual void SetUp();
  virtual void TearDown();

  Pack* pack() { return pack_; }

 private:

  ServiceDependency<ObjectManager> object_manager_;
  ErrorStatus error_status_;
  Pack* pack_;
};

void FunctionEvalTest::SetUp() {
  pack_ = object_manager_->CreatePack();
}

void FunctionEvalTest::TearDown() {
  pack_->Destroy();
}

// Tests FunctionEval.
TEST_F(FunctionEvalTest, Basic) {
  FunctionEval* function_eval = pack()->Create<FunctionEval>();
  // Check that it got created.
  ASSERT_TRUE(function_eval != NULL);
  // Check that it derives from ParamObject
  EXPECT_TRUE(function_eval->IsA(ParamObject::GetApparentClass()));
}

// Tests UpdateOutputs (indirectly)
TEST_F(FunctionEvalTest, Evaluate) {
  FunctionEval* function_eval = pack()->Create<FunctionEval>();
  // Check that it got created.
  ASSERT_TRUE(function_eval != NULL);

  // Check that the correct params got created.
  EXPECT_TRUE(function_eval->GetParam<ParamFloat>(
                  FunctionEval::kInputParamName) != NULL);
  EXPECT_TRUE(function_eval->GetParam<ParamFunction>(
                  FunctionEval::kFunctionObjectParamName) != NULL);
  EXPECT_TRUE(function_eval->GetParam<ParamFloat>(
                  FunctionEval::kOutputParamName) != NULL);

  // Check that with no function the input just gets passed through.
  function_eval->set_input(2.0f);
  EXPECT_EQ(function_eval->input(), 2.0f);
  EXPECT_EQ(function_eval->output(), 2.0f);
  function_eval->set_input(4.0f);
  EXPECT_EQ(function_eval->input(), 4.0f);
  EXPECT_EQ(function_eval->output(), 4.0f);

  // Attach a function
  Function::Ref function = Function::Ref(new TestFunction(g_service_locator));
  // Check that it got created.
  ASSERT_FALSE(function.IsNull());

  function_eval->set_function_object(function);
  EXPECT_EQ(function_eval->function_object(), function);

  function_eval->set_input(2.0f);
  EXPECT_EQ(function_eval->output(), 4.0f);
  function_eval->set_input(4.0f);
  EXPECT_EQ(function_eval->output(), 8.0f);
}

}  // namespace o3d


text:
<?php
return array (
  'Could not access task!' => 'Nie można uzyskać dostępu do zadań! ',
);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Mallotium mairei Werner & M. Choisy

### Remarks
null


text:
package org.hibernate.loader.collection;
import java.io.Serializable;

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;

/**
 * An interface for collection loaders
 * @see BasicCollectionLoader
 * @see OneToManyLoader
 * @author Gavin King
 */
public interface CollectionInitializer {
	/**
	 * Initialize the given collection
	 */
	public void initialize(Serializable id, SessionImplementor session) throws HibernateException;
}


text:
package authorizer

import (
	"context"

	"github.com/influxdata/influxdb/v2"
)

var _ influxdb.SourceService = (*SourceService)(nil)

// SourceService wraps a influxdb.SourceService and authorizes actions
// against it appropriately.
type SourceService struct {
	s influxdb.SourceService
}

// NewSourceService constructs an instance of an authorizing source service.
func NewSourceService(s influxdb.SourceService) *SourceService {
	return &SourceService{
		s: s,
	}
}

// DefaultSource checks to see if the authorizer on context has read access to the default source.
func (s *SourceService) DefaultSource(ctx context.Context) (*influxdb.Source, error) {
	src, err := s.s.DefaultSource(ctx)
	if err != nil {
		return nil, err
	}
	if _, _, err := AuthorizeRead(ctx, influxdb.SourcesResourceType, src.ID, src.OrganizationID); err != nil {
		return nil, err
	}
	return src, nil
}

// FindSourceByID checks to see if the authorizer on context has read access to the id provided.
func (s *SourceService) FindSourceByID(ctx context.Context, id influxdb.ID) (*influxdb.Source, error) {
	src, err := s.s.FindSourceByID(ctx, id)
	if err != nil {
		return nil, err
	}
	if _, _, err := AuthorizeRead(ctx, influxdb.SourcesResourceType, src.ID, src.OrganizationID); err != nil {
		return nil, err
	}
	return src, nil
}

// FindSources retrieves all sources that match the provided options and then filters the list down to only the resources that are authorized.
func (s *SourceService) FindSources(ctx context.Context, opts influxdb.FindOptions) ([]*influxdb.Source, int, error) {
	// TODO: we'll likely want to push this operation into the database since fetching the whole list of data will likely be expensive.
	ss, _, err := s.s.FindSources(ctx, opts)
	if err != nil {
		return nil, 0, err
	}
	return AuthorizeFindSources(ctx, ss)
}

// CreateSource checks to see if the authorizer on context has write access to the global source resource.
func (s *SourceService) CreateSource(ctx context.Context, src *influxdb.Source) error {
	if _, _, err := AuthorizeCreate(ctx, influxdb.SourcesResourceType, src.OrganizationID); err != nil {
		return err
	}
	return s.s.CreateSource(ctx, src)
}

// UpdateSource checks to see if the authorizer on context has write access to the source provided.
func (s *SourceService) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error) {
	src, err := s.s.FindSourceByID(ctx, id)
	if err != nil {
		return nil, err
	}
	if _, _, err := AuthorizeWrite(ctx, influxdb.SourcesResourceType, src.ID, src.OrganizationID); err != nil {
		return nil, err
	}
	return s.s.UpdateSource(ctx, id, upd)
}

// DeleteSource checks to see if the authorizer on context has write access to the source provided.
func (s *SourceService) DeleteSource(ctx context.Context, id influxdb.ID) error {
	src, err := s.s.FindSourceByID(ctx, id)
	if err != nil {
		return err
	}
	if _, _, err := AuthorizeWrite(ctx, influxdb.SourcesResourceType, src.ID, src.OrganizationID); err != nil {
		return err
	}
	return s.s.DeleteSource(ctx, id)
}


text:
from __future__ import division, print_function

import pytest
import numpy as np

from george import kernels, GP

def test_dtype(seed=123):
    np.random.seed(seed)
    kernel = 0.1 * kernels.ExpSquaredKernel(1.5)
    kernel.pars = [1, 2]
    gp = GP(kernel)
    x = np.random.rand(100)
    gp.compute(x, 1e-2)

kernels_to_test = [
    kernels.ConstantKernel(log_constant=0.1),
    kernels.ConstantKernel(log_constant=10.0, ndim=2),
    kernels.ConstantKernel(log_constant=5.0, ndim=5),

    kernels.DotProductKernel(),
    kernels.DotProductKernel(ndim=2),
    kernels.DotProductKernel(ndim=5, axes=0),

    kernels.CosineKernel(log_period=1.0),
    kernels.CosineKernel(log_period=0.5, ndim=2),
    kernels.CosineKernel(log_period=0.5, ndim=2, axes=1),
    kernels.CosineKernel(log_period=0.75, ndim=5, axes=[2, 3]),

    kernels.ExpSine2Kernel(gamma=0.4, log_period=1.0),
    kernels.ExpSine2Kernel(gamma=12., log_period=0.5, ndim=2),
    kernels.ExpSine2Kernel(gamma=17., log_period=0.5, ndim=2, axes=1),
    kernels.ExpSine2Kernel(gamma=13.7, log_period=-0.75, ndim=5, axes=[2, 3]),
    kernels.ExpSine2Kernel(gamma=-0.7, log_period=0.75, ndim=5, axes=[2, 3]),
    kernels.ExpSine2Kernel(gamma=-10, log_period=0.75),

    kernels.LocalGaussianKernel(log_width=0.5, location=1.0),
    kernels.LocalGaussianKernel(log_width=0.1, location=0.5, ndim=2),
    kernels.LocalGaussianKernel(log_width=1.5, location=-0.5, ndim=2, axes=1),
    kernels.LocalGaussianKernel(log_width=2.0, location=0.75, ndim=5,
                                axes=[2, 3]),

    kernels.LinearKernel(order=0, log_gamma2=0.0),
    kernels.LinearKernel(order=2, log_gamma2=0.0),
    kernels.LinearKernel(order=2, log_gamma2=0.0),
    kernels.LinearKernel(order=5, log_gamma2=1.0, ndim=2),
    kernels.LinearKernel(order=3, log_gamma2=-1.0, ndim=5, axes=2),
    kernels.LinearKernel(order=0, log_gamma2=0.0) +
    kernels.LinearKernel(order=1, log_gamma2=-1.0) +
    kernels.LinearKernel(order=2, log_gamma2=-2.0),

    kernels.PolynomialKernel(order=0, log_sigma2=-10.0),
    kernels.PolynomialKernel(order=2, log_sigma2=-10.0),
    kernels.PolynomialKernel(order=2, log_sigma2=0.0),
    kernels.PolynomialKernel(order=5, log_sigma2=1.0, ndim=2),
    kernels.PolynomialKernel(order=3, log_sigma2=-1.0, ndim=5, axes=2),

    12. * kernels.ExpSine2Kernel(gamma=0.4, log_period=1.0, ndim=5),
    12. * kernels.ExpSquaredKernel(0.4, ndim=3) + 0.1,
]

@pytest.mark.parametrize("kernel", kernels_to_test)
def test_kernel(kernel, N=20, seed=123, eps=1.32e-6):
    np.random.seed(seed)
    t1 = np.random.randn(N, kernel.ndim)
    kernel.test_gradient(t1, eps=eps)
    kernel.test_gradient(t1, t1[:1], eps=eps)

@pytest.mark.parametrize("kernel", kernels_to_test)
def test_x_gradient_kernel(kernel, N=20, seed=123, eps=1.32e-6):
    np.random.seed(seed)
    t1 = np.random.randn(N, kernel.ndim)
    kernel.test_x1_gradient(t1, eps=eps)
    kernel.test_x1_gradient(t1, np.array(t1[:1]), eps=eps)
    kernel.test_x2_gradient(t1, eps=eps)
    kernel.test_x2_gradient(np.array(t1[:1]), t1, eps=eps)

stationary_kernels = [
    (kernels.ExpKernel, {}),
    (kernels.ExpSquaredKernel, {}),
    (kernels.Matern32Kernel, {}),
    (kernels.Matern52Kernel, {}),
    (kernels.RationalQuadraticKernel, dict(log_alpha=np.log(1.0))),
    (kernels.RationalQuadraticKernel, dict(log_alpha=np.log(0.1))),
    (kernels.RationalQuadraticKernel, dict(log_alpha=np.log(10.0))),
]

@pytest.mark.parametrize("kernel_type,kwargs", stationary_kernels)
def test_stationary(kernel_type, kwargs):
    def build_kernel(metric, **more):
        kws = dict(kwargs, **more)
        return kernel_type(metric=metric, **kws)

    kernel = build_kernel(0.1)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    kernel = build_kernel(1.0)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    kernel = build_kernel(10.0)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    kernel = build_kernel([1.0, 0.1, 10.0], ndim=3)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    kernel = build_kernel(1.0, ndim=3)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    with pytest.raises(ValueError):
        kernel = build_kernel([1.0, 0.1, 10.0, 500], ndim=3)

    kernel = build_kernel(1.0, ndim=3, axes=2)
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)

    kernel = build_kernel(1.0, ndim=3, axes=2, block=(-0.1, 0.1))
    test_kernel(kernel)
    test_x_gradient_kernel(kernel)


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { TagsService } from './tags.service';
import { TagsSort } from './tags-sort'
import { TagsActionService } from './tags-action/tags-action.service';
import { CommonTagService } from './edit-common-tags/common-tag.service';

import { TagsComponent } from './tags.component';
import { TagComponent } from './tag.component';
import { TagsActionComponent } from './tags-action/tags-action.component';
import { EditCommonTagsComponent } from './edit-common-tags/edit-common-tags.component';

@NgModule({
  imports: [
    CommonModule,
    FormsModule
  ],
  declarations: [
    TagsComponent,
    TagComponent,
    TagsActionComponent,
    EditCommonTagsComponent
  ],
  providers: [
    TagsService,
    TagsSort,
    TagsActionService,
    CommonTagService
  ],
  exports: [TagsComponent]
})
export class TagsModule { }