# Path: support/types.py
# def is_incomplete( class_object ):
#     """
#     Test whether the template class @p class_object has any unbound parameters.
#     
#     @return    @c False if the template class is fully specialized; @c True
#                otheriwse (that is, if it has unbound parameters).
#     """
#     return getattr( class_object.__class__, "__unbound_parameters__", False )


from .types import is_incomplete
import types


def local_method_names(cls):
    """
    A class decorator that makes the function names used by the @c cProfile
    module local to the class of use (rather than the class of definition).
    
    The @c cProfile module uses the name of a function's code object as the
    profile name.  Therefore, calls to methods in subclasses that do not
    re-implement the method are counted as calls to the parent class.  In
    template classes, this makes the call profile too coarse.
    
    Use profiling_name() to get shorter class names.

    @note  The decorator copies the code objects; it "flattens" the class.
           Therefore, re-assigning methods will annihilate the decorator
           effects for the method.

    @see   The sources of rings.quotients.naive.QuotientRing for a usage
           example and support.types.template() for information about template
           classes.
    """
    if getattr( cls.__class__, "__operation_renaming__", False ):
        return cls

    original_new = cls.__class__.__new__

    def prefixing_new(meta_class, class_name, bases, class_dict, **kw_arguments):
        class_object = original_new( meta_class, class_name, bases, class_dict, **kw_arguments )


# Path: support/types.py
# def is_incomplete( class_object ):
#     """
#     Test whether the template class @p class_object has any unbound parameters.
#     
#     @return    @c False if the template class is fully specialized; @c True
#                otheriwse (that is, if it has unbound parameters).
#     """
#     return getattr( class_object.__class__, "__unbound_parameters__", False )


# Path: support/profiling.py
from .types import is_incomplete
import types



def local_method_names(cls):
    """
    A class decorator that makes the function names used by the @c cProfile
    module local to the class of use (rather than the class of definition).
    
    The @c cProfile module uses the name of a function's code object as the
    profile name.  Therefore, calls to methods in subclasses that do not
    re-implement the method are counted as calls to the parent class.  In
    template classes, this makes the call profile too coarse.
    
    Use profiling_name() to get shorter class names.

    @note  The decorator copies the code objects; it "flattens" the class.
           Therefore, re-assigning methods will annihilate the decorator
           effects for the method.

    @see   The sources of rings.quotients.naive.QuotientRing for a usage
           example and support.types.template() for information about template
           classes.
    """
    if getattr( cls.__class__, "__operation_renaming__", False ):
        return cls

    original_new = cls.__class__.__new__

    def prefixing_new(meta_class, class_name, bases, class_dict, **kw_arguments):
        class_object = original_new( meta_class, class_name, bases, class_dict, **kw_arguments )


        if is_incomplete( class_object ):