# Path: taipan/_compat.py
# IS_PY26 = sys.version_info[:2] == (2, 6)
# IS_PY3 = sys.version_info[0] == 3
# class MetaclassDecorator(object):
#     def __init__(self, meta):
#     def __call__(self, cls):
# 
# Path: taipan/objective/classes.py
# def ensure_class(arg):
# def is_direct_subclass(class_, of):
# def ensure_direct_subclass(class_, of):
# def is_indirect_subclass(class_, of):
# def ensure_indirect_subclass(class_, of):
# def iter_subclasses(class_):
#     def descend(class_):
# def iter_superclasses(class_):
#     def ascend(class_):
# def is_metaclass(obj):
# def ensure_metaclass(arg):
# 
# Path: taipan/objective/methods.py
# def is_method(arg):
#     """Checks whether given object is a method."""
#     if inspect.ismethod(arg):
#         return True
#     if isinstance(arg, NonInstanceMethod):
#         return True
# 
#     # Unfortunately, there is no disctinction between instance methods
#     # that are yet to become part of a class, and regular functions.
#     # We attempt to evade this little gray zone by relying on extremely strong
#     # convention (which is nevertheless _not_ enforced by the intepreter)
#     # that first argument of an instance method must be always named ``self``.
#     if inspect.isfunction(arg):
#         return _get_first_arg_name(arg) == 'self'
# 
#     return False


import abc
import functools
import inspect
import sys
from taipan._compat import ifilter, xrange
from taipan.objective.classes import is_class, metaclass
from taipan.objective.methods import is_method
        from taipan.objective.modifiers import _WrappedMethod
        from taipan.objective.modifiers import _OverriddenMethod
    def _ensure_concrete_class(meta, cls):
        """Check if given class is non-abstract."""
        if getattr(cls, '__abstract__', False):
            raise AbstractError(
                "cannot instantiate abstract class %s" % cls.__name__)


class _ABCObjectMetaclass(ObjectMetaclass, _ABCMetaclass):
    """Specialized version of :class:`ObjectMetaclass` for ``@abstract``
    subclassess of :class:`Object`.

    Do not use this metaclass directly; it can be only applied through
    the ``@abstract`` decorator.
    """
    def __new__(meta, name, bases, dict_):
        """Creates a new class using this metaclass.

        Usually this means the class is inheriting from :class:`Object`
        and has the ``@abstract`` modifier applied.
        """
        try:
            return super(_ABCObjectMetaclass, meta).__new__(
                meta, name, bases, dict_)
        except ClassError as e:
            # creating class failed; unfortunately, the ephemeral class
            # might have been already registered as implementation of some
            # abstract base classes residing up the inheritance chain;
            # we go up and de-register it manually
            if e.class_:
                for base in bases:

# Path: taipan/_compat.py
# IS_PY26 = sys.version_info[:2] == (2, 6)
# IS_PY3 = sys.version_info[0] == 3
# class MetaclassDecorator(object):
#     def __init__(self, meta):
#     def __call__(self, cls):
# 
# Path: taipan/objective/classes.py
# def ensure_class(arg):
# def is_direct_subclass(class_, of):
# def ensure_direct_subclass(class_, of):
# def is_indirect_subclass(class_, of):
# def ensure_indirect_subclass(class_, of):
# def iter_subclasses(class_):
#     def descend(class_):
# def iter_superclasses(class_):
#     def ascend(class_):
# def is_metaclass(obj):
# def ensure_metaclass(arg):
# 
# Path: taipan/objective/methods.py
# def is_method(arg):
#     """Checks whether given object is a method."""
#     if inspect.ismethod(arg):
#         return True
#     if isinstance(arg, NonInstanceMethod):
#         return True
# 
#     # Unfortunately, there is no disctinction between instance methods
#     # that are yet to become part of a class, and regular functions.
#     # We attempt to evade this little gray zone by relying on extremely strong
#     # convention (which is nevertheless _not_ enforced by the intepreter)
#     # that first argument of an instance method must be always named ``self``.
#     if inspect.isfunction(arg):
#         return _get_first_arg_name(arg) == 'self'
# 
#     return False


# Path: taipan/objective/base.py
import abc
import functools
import inspect
import sys
from taipan._compat import ifilter, xrange
from taipan.objective.classes import is_class, metaclass
from taipan.objective.methods import is_method
        from taipan.objective.modifiers import _WrappedMethod
        from taipan.objective.modifiers import _OverriddenMethod

    def _ensure_concrete_class(meta, cls):
        """Check if given class is non-abstract."""
        if getattr(cls, '__abstract__', False):
            raise AbstractError(
                "cannot instantiate abstract class %s" % cls.__name__)


class _ABCObjectMetaclass(ObjectMetaclass, _ABCMetaclass):
    """Specialized version of :class:`ObjectMetaclass` for ``@abstract``
    subclassess of :class:`Object`.

    Do not use this metaclass directly; it can be only applied through
    the ``@abstract`` decorator.
    """
    def __new__(meta, name, bases, dict_):
        """Creates a new class using this metaclass.

        Usually this means the class is inheriting from :class:`Object`
        and has the ``@abstract`` modifier applied.
        """
        try:
            return super(_ABCObjectMetaclass, meta).__new__(
                meta, name, bases, dict_)
        except ClassError as e:
            # creating class failed; unfortunately, the ephemeral class
            # might have been already registered as implementation of some
            # abstract base classes residing up the inheritance chain;
            # we go up and de-register it manually
            if e.class_:
                for base in bases:

                    abclasses = ifilter(meta._is_abc, base.__mro__)