Skip to content

Commit 4c4e13c

Browse files
authored
fix: add missing annotation (#1483)
1 parent ab6bea1 commit 4c4e13c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

playwright/_impl/_sync_base.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@
1616
import inspect
1717
import traceback
1818
from types import TracebackType
19-
from typing import Any, Awaitable, Callable, Dict, Generic, List, Type, TypeVar, cast
19+
from typing import (
20+
Any,
21+
Callable,
22+
Coroutine,
23+
Dict,
24+
Generator,
25+
Generic,
26+
List,
27+
Type,
28+
TypeVar,
29+
Union,
30+
cast,
31+
)
2032

2133
import greenlet
2234

@@ -75,10 +87,13 @@ def __init__(self, impl_obj: Any) -> None:
7587
def __str__(self) -> str:
7688
return self._impl_obj.__str__()
7789

78-
def _sync(self, coro: Awaitable) -> Any:
90+
def _sync(
91+
self,
92+
coro: Union[Coroutine[Any, Any, Any], Generator[Any, Any, Any]],
93+
) -> Any:
7994
__tracebackhide__ = True
8095
g_self = greenlet.getcurrent()
81-
task = self._loop.create_task(coro)
96+
task: asyncio.tasks.Task[Any] = self._loop.create_task(coro)
8297
setattr(task, "__pw_stack__", inspect.stack())
8398
setattr(task, "__pw_stack_trace__", traceback.extract_stack())
8499

0 commit comments

Comments
 (0)