def __new__(cls, name, bases, attrs): parents = [base for base in bases if isinstance(base, TagMeta)] if not parents: return super(TagMeta, cls).__new__(cls, name, bases, attrs) tag_name = attrs.get('name', get_default_name(name)) def fake_func(): pass fake_func.__name__ = tag_name attrs['_decorated_function'] = fake_func attrs['name'] = tag_name return super(TagMeta, cls).__new__(cls, name, bases, attrs)
def __new__(cls, name, bases, attrs): parents = [base for base in bases if isinstance(base, TagMeta)] if not parents: return super(TagMeta, cls).__new__(cls, name, bases, attrs) tag_name = str(attrs.get('name', get_default_name(name))) def fake_func(): pass # pragma: no cover fake_func.__name__ = tag_name attrs['_decorated_function'] = fake_func attrs['name'] = str(tag_name) return super(TagMeta, cls).__new__(cls, name, bases, attrs)
def __new__(cls, name, bases, attrs): parents = [base for base in bases if isinstance(base, TagMeta)] if not parents: return super(TagMeta, cls).__new__(cls, name, bases, attrs) tag_name = str(attrs.get("name", get_default_name(name))) def fake_func(): pass # pragma: no cover fake_func.__name__ = tag_name attrs["_decorated_function"] = fake_func attrs["name"] = str(tag_name) return super(TagMeta, cls).__new__(cls, name, bases, attrs)