def wrapComponent(comp):
    """Wraps a StimulusComponent with a class containing methods 
    for painting and editing. Class will in fact, be the same as
    the component provided, but will also be a subclass of 
    QStimulusComponent

    :param comp: Component to wrap
    :type comp: subclass of AbstractStimulusComponent
    :returns: sublass of AbstractStimulusComponent and QStimulusComponent
    """
    # if already wrapped, return object
    if hasattr(comp, 'paint'):
        return comp
    # to avoid manually creating a mapping, get all classes in 
    # this module, assume they are the class name appended with Q
    current_module = sys.modules[__name__]
    module_classes = {name[1:]: obj for name, obj in inspect.getmembers(sys.modules[__name__], inspect.isclass) if
                      obj.__module__ == __name__}
    # print __name__, module_classes
    stimclass = comp.__class__.__name__
    qclass = module_classes.get(stimclass, QStimulusComponent)
    return qclass(comp)
def wrapComponent ( comp ) : if hasattr ( comp , 'paint' ) : return comp current_module = sys . modules [ __name__ ] module_classes = { name [ 1 : ] : obj for name , obj in inspect . getmembers ( sys . modules [ __name__ ] , inspect . isclass ) if obj . __module__ == __name__ } stimclass = comp . __class__ . __name__ qclass = module_classes . get ( stimclass , QStimulusComponent ) return qclass ( comp )
Wraps a StimulusComponent with a class containing methods 
    for painting and editing. Class will in fact, be the same as
    the component provided, but will also be a subclass of 
    QStimulusComponent

    :param comp: Component to wrap
    :type comp: subclass of AbstractStimulusComponent
    :returns: sublass of AbstractStimulusComponent and QStimulusComponent