Download Python/train/3.13/param-spec/modern_01.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 474 Bytes
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/param-spec/modern_01.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/train/3.13/param-spec/modern_01.py
-
curl -L -o modern_01.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/param-spec/modern_01.py
474 Bytes
| from typing import Awaitable, Callable, ParamSpec, TypeVar | |
| P = ParamSpec("P") | |
| R = TypeVar("R") | |
| def add_logging(f: Callable[P, R]) -> Callable[P, Awaitable[R]]: | |
| async def inner(*args: P.args, **kwargs: P.kwargs) -> R: | |
| await log_to_database() | |
| return f(*args, **kwargs) | |
| return inner | |
| def takes_int_str(x: int, y: str) -> int: | |
| return x + 7 | |
| await takes_int_str(1, "A") # Accepted | |
| await takes_int_str("B", 2) # Correctly rejected by the type checker | |