# 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/_retry.py
# _DEFAULT_INITIAL_DELAY = 1.0  # seconds
# _DEFAULT_MAXIMUM_DELAY = 60.0  # seconds
# _DEFAULT_DELAY_MULTIPLIER = 2.0
# _DEFAULT_RETRIES = 3
# TRANSIENT_ERRORS = (
#     core_exceptions.ServiceUnavailable,
#     core_exceptions.InternalServerError,
#     core_exceptions.Aborted,
#     core_exceptions.Unknown,
# )
# def wraps_safely(obj, attr_names=functools.WRAPPER_ASSIGNMENTS):
# def retry_async(callback, retries=_DEFAULT_RETRIES):
#     def retry_wrapper(*args, **kwargs):
# def is_transient_error(error):
# 
# Path: google/cloud/ndb/tasklets.py
# class Future(object):
# class _TaskletFuture(Future):
# class _MultiFuture(Future):
# class Return(Exception):
# class QueueFuture(object):
# class ReducingFuture(object):
# class SerialQueueFuture(object):
#     def __init__(self, info="Unknown"):
#     def __repr__(self):
#     def done(self):
#     def running(self):
#     def wait(self):
#     def check_success(self):
#     def set_result(self, result):
#     def set_exception(self, exception):
#     def _finish(self):
#     def result(self):
#     def exception(self):
#     def get_traceback(self):
#     def add_done_callback(self, callback):
#     def cancel(self):
#     def cancelled(self):
#     def wait_any(futures):
#     def wait_all(futures):
#     def __init__(self, generator, context, info="Unknown"):
#     def _advance_tasklet(self, send_value=None, error=None):
#         def done_callback(yielded):
#     def cancel(self):
# def _get_return_value(stop):
#     def __init__(self, dependencies):
#     def __repr__(self):
#     def _dependency_done(self, dependency):
#     def cancel(self):
# def tasklet(wrapped):
#     def tasklet_wrapper(*args, **kwargs):
# def wait_any(futures):
# def wait_all(futures):
# def sleep(seconds):
# def add_flow_exception(*args, **kwargs):
# def make_context(*args, **kwargs):
# def make_default_context(*args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
# def set_context(*args, **kwargs):
# def synctasklet(wrapped):
#     def synctasklet_wrapper(*args, **kwargs):
# def toplevel(wrapped):
#     def toplevel_wrapper(*args, **kwargs):
# 
# Path: google/cloud/ndb/utils.py
# TRUTHY_STRINGS = {"t", "true", "y", "yes", "on", "1"}
# DEBUG = asbool(os.environ.get("NDB_DEBUG", False))
# def asbool(value):
# def code_info(*args, **kwargs):
# def decorator(*args, **kwargs):
# def frame_info(*args, **kwargs):
# def func_info(*args, **kwargs):
# def gen_info(*args, **kwargs):
# def get_stack(*args, **kwargs):
# def logging_debug(log, message, *args, **kwargs):
#     def __init__(self, **kwargs):
#     def __call__(self, wrapped):
#         def wrapper(*args, **kwargs):
# def positional(max_pos_args):
#     def positional_decorator(wrapped):
#         def positional_wrapper(*args, **kwds):
# def tweak_logging(*args, **kwargs):
# def wrapping(*args, **kwargs):
# class keyword_only(object):


import functools
import logging
from google.cloud.ndb import exceptions
from google.cloud.ndb import _retry
from google.cloud.ndb import tasklets
from google.cloud.ndb import utils
        from google.cloud.ndb import context as context_module
            from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import _datastore_api
            from google.cloud.ndb import context as context_module
            according to the propagation option but no warning is emitted.
    """

    def __init__(self, propagation, join=None):
        # Avoid circular import in Python 2.7

        propagation_options = context_module.TransactionOptions._PROPAGATION
        if propagation is None or propagation in propagation_options:
            self.propagation = propagation
        else:
            raise ValueError(
                "Unexpected value for propagation. Got: {}. Expected one of: "
                "{}".format(propagation, propagation_options)
            )

        propagation_names = context_module.TransactionOptions._INT_TO_NAME
        self.propagation_name = propagation_names.get(self.propagation)

        self.join = join
        joinable_options = context_module.TransactionOptions._JOINABLE
        self.joinable = propagation in joinable_options

    def _handle_nested(self):
        """The NESTED propagation policy would commit all changes in the outer
        and inner transactions together when the outer policy commits. However,
        if an exception is thrown in the inner transaction all changes there
        would get thrown out but allow the outer transaction to optionally
        recover and continue. The NESTED policy is not supported. If you use
        this policy, your code will throw a BadRequestError exception.
        """

# 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/_retry.py
# _DEFAULT_INITIAL_DELAY = 1.0  # seconds
# _DEFAULT_MAXIMUM_DELAY = 60.0  # seconds
# _DEFAULT_DELAY_MULTIPLIER = 2.0
# _DEFAULT_RETRIES = 3
# TRANSIENT_ERRORS = (
#     core_exceptions.ServiceUnavailable,
#     core_exceptions.InternalServerError,
#     core_exceptions.Aborted,
#     core_exceptions.Unknown,
# )
# def wraps_safely(obj, attr_names=functools.WRAPPER_ASSIGNMENTS):
# def retry_async(callback, retries=_DEFAULT_RETRIES):
#     def retry_wrapper(*args, **kwargs):
# def is_transient_error(error):
# 
# Path: google/cloud/ndb/tasklets.py
# class Future(object):
# class _TaskletFuture(Future):
# class _MultiFuture(Future):
# class Return(Exception):
# class QueueFuture(object):
# class ReducingFuture(object):
# class SerialQueueFuture(object):
#     def __init__(self, info="Unknown"):
#     def __repr__(self):
#     def done(self):
#     def running(self):
#     def wait(self):
#     def check_success(self):
#     def set_result(self, result):
#     def set_exception(self, exception):
#     def _finish(self):
#     def result(self):
#     def exception(self):
#     def get_traceback(self):
#     def add_done_callback(self, callback):
#     def cancel(self):
#     def cancelled(self):
#     def wait_any(futures):
#     def wait_all(futures):
#     def __init__(self, generator, context, info="Unknown"):
#     def _advance_tasklet(self, send_value=None, error=None):
#         def done_callback(yielded):
#     def cancel(self):
# def _get_return_value(stop):
#     def __init__(self, dependencies):
#     def __repr__(self):
#     def _dependency_done(self, dependency):
#     def cancel(self):
# def tasklet(wrapped):
#     def tasklet_wrapper(*args, **kwargs):
# def wait_any(futures):
# def wait_all(futures):
# def sleep(seconds):
# def add_flow_exception(*args, **kwargs):
# def make_context(*args, **kwargs):
# def make_default_context(*args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
# def set_context(*args, **kwargs):
# def synctasklet(wrapped):
#     def synctasklet_wrapper(*args, **kwargs):
# def toplevel(wrapped):
#     def toplevel_wrapper(*args, **kwargs):
# 
# Path: google/cloud/ndb/utils.py
# TRUTHY_STRINGS = {"t", "true", "y", "yes", "on", "1"}
# DEBUG = asbool(os.environ.get("NDB_DEBUG", False))
# def asbool(value):
# def code_info(*args, **kwargs):
# def decorator(*args, **kwargs):
# def frame_info(*args, **kwargs):
# def func_info(*args, **kwargs):
# def gen_info(*args, **kwargs):
# def get_stack(*args, **kwargs):
# def logging_debug(log, message, *args, **kwargs):
#     def __init__(self, **kwargs):
#     def __call__(self, wrapped):
#         def wrapper(*args, **kwargs):
# def positional(max_pos_args):
#     def positional_decorator(wrapped):
#         def positional_wrapper(*args, **kwds):
# def tweak_logging(*args, **kwargs):
# def wrapping(*args, **kwargs):
# class keyword_only(object):


# Path: google/cloud/ndb/_transaction.py
import functools
import logging
from google.cloud.ndb import exceptions
from google.cloud.ndb import _retry
from google.cloud.ndb import tasklets
from google.cloud.ndb import utils
        from google.cloud.ndb import context as context_module
            from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import context as context_module
    from google.cloud.ndb import _datastore_api
            from google.cloud.ndb import context as context_module

            according to the propagation option but no warning is emitted.
    """

    def __init__(self, propagation, join=None):
        # Avoid circular import in Python 2.7

        propagation_options = context_module.TransactionOptions._PROPAGATION
        if propagation is None or propagation in propagation_options:
            self.propagation = propagation
        else:
            raise ValueError(
                "Unexpected value for propagation. Got: {}. Expected one of: "
                "{}".format(propagation, propagation_options)
            )

        propagation_names = context_module.TransactionOptions._INT_TO_NAME
        self.propagation_name = propagation_names.get(self.propagation)

        self.join = join
        joinable_options = context_module.TransactionOptions._JOINABLE
        self.joinable = propagation in joinable_options

    def _handle_nested(self):
        """The NESTED propagation policy would commit all changes in the outer
        and inner transactions together when the outer policy commits. However,
        if an exception is thrown in the inner transaction all changes there
        would get thrown out but allow the outer transaction to optionally
        recover and continue. The NESTED policy is not supported. If you use
        this policy, your code will throw a BadRequestError exception.
        """

        raise exceptions.BadRequestError("Nested transactions are not supported.")