Skip to content
Closed
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions crates/ty_python_semantic/resources/mdtest/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
async def retrieve() -> int:
return 42


async def main():
result = await retrieve()

Expand All @@ -19,9 +20,11 @@ from typing import TypeVar

T = TypeVar("T")


async def persist(x: T) -> T:
return x


async def f(x: int):
result = await persist(x)

Expand All @@ -36,9 +39,11 @@ async def f(x: int):
import asyncio
import concurrent.futures


def blocking_function() -> int:
return 42


async def main():
loop = asyncio.get_event_loop()
with concurrent.futures.ThreadPoolExecutor() as pool:
Expand All @@ -51,9 +56,11 @@ async def main():
```py
import asyncio


async def f() -> int:
return 1


async def main():
task = asyncio.create_task(f())

Expand All @@ -67,9 +74,11 @@ async def main():
```py
import asyncio


async def task(name: str) -> int:
return len(name)


async def main():
a, b = await asyncio.gather(
task("A"),
Expand Down Expand Up @@ -113,6 +122,7 @@ final type of the `await` expression, we retrieve that third argument of the `Ge
```py
from typing import Generator


def _():
result = yield from retrieve().__await__()
reveal_type(result) # revealed: int
Expand All @@ -127,5 +137,6 @@ not just `Unknown`:
async def f():
pass


reveal_type(f()) # revealed: CoroutineType[Any, Any, Unknown]
```
Loading
Loading