def method(
    # Set this to True if it's a non-generator function returning
    # a [sync/async] generator object
    is_generator: Optional[bool] = None,
    keep_warm: Optional[int] = None,  # An optional number of containers to always keep warm.
) -> Callable[[Callable[..., Any]], _PartialFunction]:

Decorator for methods that should be transformed into a Modal Function registered against this class’s app.


class MyCls:

    def f(self):