-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmeow.py
More file actions
34 lines (22 loc) · 617 Bytes
/
meow.py
File metadata and controls
34 lines (22 loc) · 617 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import asyncio
from dataclasses import dataclass
from typing import Annotated, TypeVar
from rich.prompt import IntPrompt
import cappa
from cappa import ValueFrom
T = TypeVar("T")
async def test() -> list[int]:
return [1]
async def gen() -> int:
ids = await test()
business = IntPrompt.ask("choices a business", choices=[str(_id) for _id in ids])
return business
@dataclass
class Test:
business: Annotated[
int,
cappa.Arg(default=ValueFrom(gen), help="Business ID"),
]
async def __call__(self):
print(self.business)
asyncio.run(cappa.invoke_async(Test))