Re: [PATCH 09/26] rv/rvgen: replace inline NotImplemented with decorator

From: Wander Lairson Costa

Date: Wed Jan 21 2026 - 12:49:42 EST


On Wed, Jan 21, 2026 at 02:43:59PM +0100, Gabriele Monaco wrote:
> On Mon, 2026-01-19 at 17:45 -0300, Wander Lairson Costa wrote:
> >
> [...]
> > +    @not_implemented
> > +    def fill_tracepoint_detach_helper(self): ... 
> [...] 
> > +    @not_implemented
> >      def normalize(self):
> > -        raise NotImplementedError
> > +        ... 
>
> Is there a reason why you didn't collapse it all on the same line here (like you
> did above)?
>
> @not_implemented
> def normalize(self): ...
>
> I see it's probably better to break the line if there is a type annotation
> making the line longer. Did you keep it separated because you will add
> annotation in a separate patch?
>

I did review the commit before sending to make this coeherent among the
changes. This might be have scaped my review.

> Anyway this is minor and the change is good, thanks.
>
> Reviewed-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
>
> > diff --git a/tools/verification/rvgen/rvgen/utils.py
> > b/tools/verification/rvgen/rvgen/utils.py
> > new file mode 100644
> > index 0000000000000..e09c943693edf
> > --- /dev/null
> > +++ b/tools/verification/rvgen/rvgen/utils.py
> > @@ -0,0 +1,36 @@
> > +#!/usr/bin/env python3
> > +# SPDX-License-Identifier: GPL-2.0-only
> > +
> > +
> > +def not_implemented(func):
> > +    """
> > +    Decorator to mark functions as not yet implemented.
> > +
> > +    This decorator wraps a function and raises a NotImplementedError when the
> > +    function is called, rather than executing the function body. This is
> > useful
> > +    for defining interface methods or placeholder functions that need to be
> > +    implemented later.
> > +
> > +    Args:
> > +        func: The function to be wrapped.
> > +
> > +    Returns:
> > +        A wrapper function that raises NotImplementedError when called.
> > +
> > +    Raises:
> > +        NotImplementedError: Always raised when the decorated function is
> > called.
> > +            The exception includes the function name and any arguments that
> > were
> > +            passed to the function.
> > +
> > +    Example:
> > +        @not_implemented
> > +        def future_feature(arg1, arg2):
> > +            pass
> > +
> > +        # Calling future_feature will raise:
> > +        # NotImplementedError('future_feature', arg1_value, arg2_value)
> > +    """
> > +    def inner(*args, **kwargs):
> > +        raise NotImplementedError(func.__name__, *args, **kwargs)
> > +
> > +    return inner
>