# 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):


import itertools
    import mock
import pytest
    from unittest import mock
from google.api_core import exceptions as core_exceptions
from google.cloud.ndb import _retry
from google.cloud.ndb import tasklets
from . import utils
#
#     https://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.


try:
except ImportError:  # pragma: NO PY3 COVER





def mock_sleep(seconds):
    future = tasklets.Future()
    future.set_result(None)
    return future


class Test_retry:
    @staticmethod
    @pytest.mark.usefixtures("in_context")
    def test_success():
        def callback():
            return "foo"


# 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: tests/unit/test__retry.py
import itertools
    import mock
import pytest
    from unittest import mock
from google.api_core import exceptions as core_exceptions
from google.cloud.ndb import _retry
from google.cloud.ndb import tasklets
from . import utils

#
#     https://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.


try:
except ImportError:  # pragma: NO PY3 COVER





def mock_sleep(seconds):
    future = tasklets.Future()
    future.set_result(None)
    return future


class Test_retry:
    @staticmethod
    @pytest.mark.usefixtures("in_context")
    def test_success():
        def callback():
            return "foo"


        retry = _retry.retry_async(callback)