# Path: google/cloud/ndb/exceptions.py
# class Error(Exception):
# class ContextError(Error):
# class BadValueError(Error):
# class BadArgumentError(Error):
# class BadRequestError(Error):
# class Rollback(Error):
# class BadQueryError(Error):
# class BadFilterError(Error):
# class NoLongerImplementedError(NotImplementedError):
# class Cancelled(Error):
# class NestedRetryException(Error):
#     def __init__(self):
#     def __init__(self, filter):
#     def __init__(self):


import grpc
import time
from google.cloud.ndb import exceptions

    Arguments:
        future (Union[grpc.Future, tasklets.Future]): The future handed back
            from initiating the call.
        info (str): Helpful human readable string about the call. This string
            will be handed back verbatim by calls to :meth:`__repr__`.
    """

    def __init__(self, future, info):
        self.future = future
        self.info = info
        self.start_time = time.time()
        self.elapsed_time = 0

        def record_time(future):
            self.elapsed_time = time.time() - self.start_time

        future.add_done_callback(record_time)

    def __repr__(self):
        return self.info

    def exception(self):
        """Calls :meth:`grpc.Future.exception` on :attr:`future`."""
        # GRPC will actually raise FutureCancelledError.
        # We'll translate that to our own Cancelled exception and *return* it,
        # which is far more polite for a method that *returns exceptions*.
        try:
            return self.future.exception()
        except grpc.FutureCancelledError:

# Path: google/cloud/ndb/exceptions.py
# class Error(Exception):
# class ContextError(Error):
# class BadValueError(Error):
# class BadArgumentError(Error):
# class BadRequestError(Error):
# class Rollback(Error):
# class BadQueryError(Error):
# class BadFilterError(Error):
# class NoLongerImplementedError(NotImplementedError):
# class Cancelled(Error):
# class NestedRetryException(Error):
#     def __init__(self):
#     def __init__(self, filter):
#     def __init__(self):


# Path: google/cloud/ndb/_remote.py
import grpc
import time
from google.cloud.ndb import exceptions


    Arguments:
        future (Union[grpc.Future, tasklets.Future]): The future handed back
            from initiating the call.
        info (str): Helpful human readable string about the call. This string
            will be handed back verbatim by calls to :meth:`__repr__`.
    """

    def __init__(self, future, info):
        self.future = future
        self.info = info
        self.start_time = time.time()
        self.elapsed_time = 0

        def record_time(future):
            self.elapsed_time = time.time() - self.start_time

        future.add_done_callback(record_time)

    def __repr__(self):
        return self.info

    def exception(self):
        """Calls :meth:`grpc.Future.exception` on :attr:`future`."""
        # GRPC will actually raise FutureCancelledError.
        # We'll translate that to our own Cancelled exception and *return* it,
        # which is far more polite for a method that *returns exceptions*.
        try:
            return self.future.exception()
        except grpc.FutureCancelledError:

            return exceptions.Cancelled()