# 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 os
import tempfile
import futurist
import tooz
from testtools import testcase
from tooz import utils
# -*- coding: utf-8 -*-

# Copyright (c) 2015 OpenStack Foundation
# All Rights Reserved.
#
#    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.





class TestProxyExecutor(testcase.TestCase):
    def test_fetch_check_executor(self):
        try_options = [
            ({'executor': 'sync'}, futurist.SynchronousExecutor),
            ({'executor': 'thread'}, futurist.ThreadPoolExecutor),
        ]
        for options, expected_cls in try_options:

# 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/tests/test_utils.py
import os
import tempfile
import futurist
import tooz
from testtools import testcase
from tooz import utils

# -*- coding: utf-8 -*-

# Copyright (c) 2015 OpenStack Foundation
# All Rights Reserved.
#
#    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.





class TestProxyExecutor(testcase.TestCase):
    def test_fetch_check_executor(self):
        try_options = [
            ({'executor': 'sync'}, futurist.SynchronousExecutor),
            ({'executor': 'thread'}, futurist.ThreadPoolExecutor),
        ]
        for options, expected_cls in try_options:

            executor = utils.ProxyExecutor.build("test", options)