# 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
        # 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))

        # check that ``@override`` modifier is present where it should be
        # and absent where it shouldn't (e.g. ``@final`` methods)
        for name, method in own_methods:
            shadowed_method, base_class = next(
                ((getattr(base, name), base)
                 for base in super_mro if hasattr(base, name)),
                (None, None)
            )
            if meta._is_override(method):
                # ``@override`` is legal only when the method actually shadows
                # a method from a superclass, and that metod is not ``@final``
                if not shadowed_method:
                    raise ClassError("unnecessary @override on %s.%s" % (
                        class_.__name__, name), class_=class_)
                if meta._is_final(shadowed_method):
                    raise ClassError(
                        "illegal @override on a @final method %s.%s" % (
                            base_class.__name__, name), class_=class_)

                # if @override had parameter supplied, verify if it was
                # the same class as the base of shadowed method
                override_base = meta._get_override_base(method)
                if override_base and base_class is not override_base:

# 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

        # 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))

        # check that ``@override`` modifier is present where it should be
        # and absent where it shouldn't (e.g. ``@final`` methods)
        for name, method in own_methods:
            shadowed_method, base_class = next(
                ((getattr(base, name), base)
                 for base in super_mro if hasattr(base, name)),
                (None, None)
            )
            if meta._is_override(method):
                # ``@override`` is legal only when the method actually shadows
                # a method from a superclass, and that metod is not ``@final``
                if not shadowed_method:
                    raise ClassError("unnecessary @override on %s.%s" % (
                        class_.__name__, name), class_=class_)
                if meta._is_final(shadowed_method):
                    raise ClassError(
                        "illegal @override on a @final method %s.%s" % (
                            base_class.__name__, name), class_=class_)

                # if @override had parameter supplied, verify if it was
                # the same class as the base of shadowed method
                override_base = meta._get_override_base(method)
                if override_base and base_class is not override_base:

                    if is_class(override_base):