# Path: tooz/_retry.py
# def retry(stop_max_delay=None, **kwargs):
# 
# Path: tooz/partitioner.py
# class Partitioner(object):
#     DEFAULT_PARTITION_NUMBER = hashring.HashRing.DEFAULT_PARTITION_NUMBER
#     def __init__(self, coordinator, group_id,
#                  partitions=DEFAULT_PARTITION_NUMBER):
#     def _on_member_join(self, event):
#     def _on_member_leave(self, event):
#     def _hash_object(obj):
#     def members_for_object(self, obj, ignore_members=None, replicas=1):
#     def belongs_to_member(self, obj, member_id,
#                           ignore_members=None, replicas=1):
#     def belongs_to_self(self, obj, ignore_members=None, replicas=1):
#     def stop(self):
# 
# Path: tooz/utils.py
# class Base64LockEncoder(object):
# class ProxyExecutor(object):
# class SerializationError(tooz.ToozError):
#     def __init__(self, keyspace_url, prefix=''):
#     def check_and_encode(self, name):
#     def encode(self, name):
#     def __init__(self, driver_name, default_executor_factory):
#     def build(cls, driver_name, options):
#     def start(self):
#     def stop(self):
#     def submit(self, cb, *args, **kwargs):
# def safe_abs_path(rooted_at, *pieces):
# def convert_blocking(blocking):
# def collapse(config, exclude=None, item_selector=operator.itemgetter(-1)):
# def to_binary(text, encoding='ascii'):
# def dumps(data, excp_cls=SerializationError):
# def loads(blob, excp_cls=SerializationError):
# def millis_to_datetime(milliseconds):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     KIND_TO_FACTORY = {
#         'threaded': (lambda:
#                      futurist.ThreadPoolExecutor(max_workers=1)),
#         'synchronous': lambda: futurist.SynchronousExecutor(),
#     }
#     DEFAULT_KIND = 'threaded'


import abc
import collections
import enum
import logging
import threading
import urllib
import tenacity
import tooz
from concurrent import futures
from oslo_utils import encodeutils
from oslo_utils import netutils
from oslo_utils import timeutils
from stevedore import driver
from tooz import _retry
from tooz import partitioner
from tooz import utils

class CoordinatorResult(CoordAsyncResult):
    """Asynchronous result that references a future."""

    def __init__(self, fut, failure_translator=None):
        self._fut = fut
        self._failure_translator = failure_translator

    def get(self, timeout=None):
        try:
            if self._failure_translator:
                with self._failure_translator():
                    return self._fut.result(timeout=timeout)
            else:
                return self._fut.result(timeout=timeout)
        except futures.TimeoutError as e:
            utils.raise_with_cause(OperationTimedOut,
                                   encodeutils.exception_to_unicode(e),
                                   cause=e)

    def done(self):
        return self._fut.done()


class CoordinationDriverWithExecutor(CoordinationDriver):

    EXCLUDE_OPTIONS = None

    def __init__(self, member_id, parsed_url, options):
        self._options = utils.collapse(options, exclude=self.EXCLUDE_OPTIONS)

# Path: tooz/_retry.py
# def retry(stop_max_delay=None, **kwargs):
# 
# Path: tooz/partitioner.py
# class Partitioner(object):
#     DEFAULT_PARTITION_NUMBER = hashring.HashRing.DEFAULT_PARTITION_NUMBER
#     def __init__(self, coordinator, group_id,
#                  partitions=DEFAULT_PARTITION_NUMBER):
#     def _on_member_join(self, event):
#     def _on_member_leave(self, event):
#     def _hash_object(obj):
#     def members_for_object(self, obj, ignore_members=None, replicas=1):
#     def belongs_to_member(self, obj, member_id,
#                           ignore_members=None, replicas=1):
#     def belongs_to_self(self, obj, ignore_members=None, replicas=1):
#     def stop(self):
# 
# Path: tooz/utils.py
# class Base64LockEncoder(object):
# class ProxyExecutor(object):
# class SerializationError(tooz.ToozError):
#     def __init__(self, keyspace_url, prefix=''):
#     def check_and_encode(self, name):
#     def encode(self, name):
#     def __init__(self, driver_name, default_executor_factory):
#     def build(cls, driver_name, options):
#     def start(self):
#     def stop(self):
#     def submit(self, cb, *args, **kwargs):
# def safe_abs_path(rooted_at, *pieces):
# def convert_blocking(blocking):
# def collapse(config, exclude=None, item_selector=operator.itemgetter(-1)):
# def to_binary(text, encoding='ascii'):
# def dumps(data, excp_cls=SerializationError):
# def loads(blob, excp_cls=SerializationError):
# def millis_to_datetime(milliseconds):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     KIND_TO_FACTORY = {
#         'threaded': (lambda:
#                      futurist.ThreadPoolExecutor(max_workers=1)),
#         'synchronous': lambda: futurist.SynchronousExecutor(),
#     }
#     DEFAULT_KIND = 'threaded'


# Path: tooz/coordination.py
import abc
import collections
import enum
import logging
import threading
import urllib
import tenacity
import tooz
from concurrent import futures
from oslo_utils import encodeutils
from oslo_utils import netutils
from oslo_utils import timeutils
from stevedore import driver
from tooz import _retry
from tooz import partitioner
from tooz import utils


class CoordinatorResult(CoordAsyncResult):
    """Asynchronous result that references a future."""

    def __init__(self, fut, failure_translator=None):
        self._fut = fut
        self._failure_translator = failure_translator

    def get(self, timeout=None):
        try:
            if self._failure_translator:
                with self._failure_translator():
                    return self._fut.result(timeout=timeout)
            else:
                return self._fut.result(timeout=timeout)
        except futures.TimeoutError as e:
            utils.raise_with_cause(OperationTimedOut,
                                   encodeutils.exception_to_unicode(e),
                                   cause=e)

    def done(self):
        return self._fut.done()


class CoordinationDriverWithExecutor(CoordinationDriver):

    EXCLUDE_OPTIONS = None

    def __init__(self, member_id, parsed_url, options):
        self._options = utils.collapse(options, exclude=self.EXCLUDE_OPTIONS)

        self._executor = utils.ProxyExecutor.build(