MCPcopy Index your code
hub / github.com/microsoft/playwright-python / _sync

Method _sync

playwright/_impl/_sync_base.py:97–115  ·  view source on GitHub ↗
(
        self,
        coro: Union[Coroutine[Any, Any, Any], Generator[Any, Any, Any]],
    )

Source from the content-addressed store, hash-verified

95 return self._impl_obj.__str__()
96
97 def _sync(
98 self,
99 coro: Union[Coroutine[Any, Any, Any], Generator[Any, Any, Any]],
100 ) -> Any:
101 __tracebackhide__ = True
102 if self._loop.is_closed():
103 coro.close()
104 raise Error("Event loop is closed! Is Playwright already stopped?")
105
106 g_self = greenlet.getcurrent()
107 task: asyncio.tasks.Task[Any] = self._loop.create_task(coro)
108 setattr(task, "__pw_stack__", inspect.stack(0))
109 setattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10))
110
111 task.add_done_callback(lambda _: g_self.switch())
112 while not task.done():
113 self._dispatcher_fiber.switch()
114 asyncio._set_running_loop(self._loop)
115 return task.result()
116
117 def _wrap_handler(
118 self, handler: Union[Callable[..., Any], Any]

Callers 15

sizesMethod · 0.45
responseMethod · 0.45
all_headersMethod · 0.45
headers_arrayMethod · 0.45
header_valueMethod · 0.45
all_headersMethod · 0.45
headers_arrayMethod · 0.45
header_valueMethod · 0.45
header_valuesMethod · 0.45
server_addrMethod · 0.45
security_detailsMethod · 0.45
http_versionMethod · 0.45

Calls 5

ErrorClass · 0.85
stackMethod · 0.80
resultMethod · 0.80
is_closedMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected