# Path: auxlib/compat.py
# def isiterable(obj):
# 
# Path: auxlib/exceptions.py
# class InitializationError(AuxlibError, EnvironmentError):
#     pass


from .compat import with_metaclass
from .exceptions import InitializationError
"""A python implementation of the factory design pattern.  It's designed for use as a base class
for various types of data gateways.
"""
from __future__ import absolute_import, division, print_function


__all__ = ['Factory']


class FactoryBase(object):

    @classmethod
    def initialize(cls, context, default_provider):
        cls.context = context
        cls._default_provider = (default_provider.__name__ if isinstance(default_provider, type)
                                 else str(default_provider))
        if not cls.is_registered_provider(cls._default_provider):
            raise RuntimeError("{0} is not a registered provider for "
                               "{1}".format(cls._default_provider, cls.__name__))

    @classmethod
    def get_instance(cls, provider=None):
        if not hasattr(cls, 'context'):

# Path: auxlib/compat.py
# def isiterable(obj):
# 
# Path: auxlib/exceptions.py
# class InitializationError(AuxlibError, EnvironmentError):
#     pass


# Path: auxlib/factory.py
from .compat import with_metaclass
from .exceptions import InitializationError

"""A python implementation of the factory design pattern.  It's designed for use as a base class
for various types of data gateways.
"""
from __future__ import absolute_import, division, print_function


__all__ = ['Factory']


class FactoryBase(object):

    @classmethod
    def initialize(cls, context, default_provider):
        cls.context = context
        cls._default_provider = (default_provider.__name__ if isinstance(default_provider, type)
                                 else str(default_provider))
        if not cls.is_registered_provider(cls._default_provider):
            raise RuntimeError("{0} is not a registered provider for "
                               "{1}".format(cls._default_provider, cls.__name__))

    @classmethod
    def get_instance(cls, provider=None):
        if not hasattr(cls, 'context'):

            raise InitializationError("RecordRepoFactory has not been initialized.")