Closed
Description
I have a simple decorator that just sets an attribute on a function and returns it. The closest I got to checking this is creating a subclass of Callable
and adding the attribute to it:
from typing import Callable, cast
class RemoteCallable(Callable):
rpc_name: str = None
def remote(f: Callable) -> RemoteCallable:
''' Decorator marking a function as callable via the RPC system. '''
f = cast(RemoteCallable, f)
f.rpc_name = f.__name__
return f
However, this fails with rpc.py:3: error: Invalid base class
. What can I do?
Metadata
Metadata
Assignees
Labels
No labels