Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/trame_common/decorators/klass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import inspect
import logging
from collections.abc import Callable
from typing import Any, TypeVar
from typing import Any, ParamSpec, TypeVar

F = TypeVar("F", bound=Callable[..., Any])
P = ParamSpec("P")
R = TypeVar("R")

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -128,9 +130,11 @@ def decorate(f: F) -> F:
return decorate


def controller_decorator(method):
def decorator(*args):
def decorate(f):
def controller_decorator(
method: str,
) -> Callable[..., Callable[[Callable[P, R]], Callable[P, R]]]:
def decorator(*args: str) -> Callable[[Callable[P, R]], Callable[P, R]]:
def decorate(f: Callable[P, R]) -> Callable[P, R]:
if not hasattr(f, "_trame_controller"):
f._trame_controller = []
for name in args:
Expand Down
Loading