# 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
        Usually this means the class is inheriting from :class:`Object`.
        """
        meta._validate_base_classes(bases)

        class_ = super(ObjectMetaclass, meta).__new__(meta, name, bases, dict_)
        meta._validate_method_decoration(class_)

        return class_

    @classmethod
    def _validate_base_classes(meta, bases):
        """Validate the base classes of the new class to be created,
        making sure none of them are ``@final``.
        """
        for base in bases:
            if meta._is_final(base):
                raise ClassError(
                    "cannot inherit from @final class %s" % (base.__name__,))

    @classmethod
    def _validate_method_decoration(meta, class_):
        """Validate the usage of ``@override`` and ``@final`` modifiers
        on methods of the given ``class_``.
        """
        # TODO(xion): employ some code inspection tricks to serve ClassErrors
        # as if they were thrown at the offending class's/method's definition

        super_mro = class_.__mro__[1:]
        own_methods = ((name, member)
                       for name, member in class_.__dict__.items()

# 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

        Usually this means the class is inheriting from :class:`Object`.
        """
        meta._validate_base_classes(bases)

        class_ = super(ObjectMetaclass, meta).__new__(meta, name, bases, dict_)
        meta._validate_method_decoration(class_)

        return class_

    @classmethod
    def _validate_base_classes(meta, bases):
        """Validate the base classes of the new class to be created,
        making sure none of them are ``@final``.
        """
        for base in bases:
            if meta._is_final(base):
                raise ClassError(
                    "cannot inherit from @final class %s" % (base.__name__,))

    @classmethod
    def _validate_method_decoration(meta, class_):
        """Validate the usage of ``@override`` and ``@final`` modifiers
        on methods of the given ``class_``.
        """
        # TODO(xion): employ some code inspection tricks to serve ClassErrors
        # as if they were thrown at the offending class's/method's definition

        super_mro = class_.__mro__[1:]
        own_methods = ((name, member)
                       for name, member in class_.__dict__.items()

                       if is_method(member))