def __new__(cls, name, bases, attrs):

        # don't muck with the base class
        if name == 'CustomViewer':
            return type.__new__(cls, name, bases, attrs)

        # Build UI Form
        ui = {}
        for key, value in list(attrs.items()):
            if key.startswith('_') or key in CustomViewer.__dict__:
                continue

            if not isinstance(value, (MethodType, FunctionType)):
                ui[key] = attrs.pop(key)

        attrs['ui'] = ui
        attrs.setdefault('name', name)

        # collect the UDFs
        udfs = {}

        for nm, value in list(attrs.items()):
            dscr = CustomViewer.__dict__.get(nm, None)

            if isinstance(dscr, UserDefinedFunction):
                # remove them as class method
                # register them below instead
                udfs[nm] = attrs.pop(nm)

        result = type.__new__(cls, name, bases, attrs)

        # now wrap the custom UDFs using the descriptors
        for k, v in udfs.items():
            # register UDF by mimicing the decorator syntax
            udf_decorator = getattr(result, k)
            udf_decorator(v)

        result._build_widget_subclass()

        return result
dataset/ETHPy150Open glue-viz/glue/glue/viewers/custom/qt/custom_viewer.py/CustomViewerMeta.__new__/original