def hpcwrapclass()

in src/hpc/autoscale/codeanalysis.py [0:0]


def hpcwrapclass(cls: C) -> C:
    method: Callable

    for method_name, method in inspect.getmembers(cls):  # type: ignore

        if not hasattr(method, "__call__"):
            continue

        if method_name != "__init__" and method_name.startswith("__"):
            continue

        # C functions are missing this and can't have runtime checks
        if not hasattr(method, "__module__"):
            continue
        sig = inspect.signature(method)
        if len(sig.parameters) == 0 or (
            len(sig.parameters) == 1 and "self" in sig.parameters
        ):
            continue

        setattr(cls, method_name, hpcwrap(method))
    return cls