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

Method cleanup

playwright/_impl/_connection.py:327–341  ·  view source on GitHub ↗
(self, cause: str = None)

Source from the content-addressed store, hash-verified

325 self.cleanup()
326
327 def cleanup(self, cause: str = None) -> None:
328 self._closed_error = TargetClosedError(cause) if cause else TargetClosedError()
329 if self._init_task and not self._init_task.done():
330 self._init_task.cancel()
331 for ws_connection in self._child_ws_connections:
332 ws_connection._transport.dispose()
333 for callback in self._callbacks.values():
334 # To prevent 'Future exception was never retrieved' we ignore all callbacks that are no_reply.
335 if callback.no_reply:
336 continue
337 if callback.future.cancelled():
338 continue
339 callback.future.set_exception(self._closed_error)
340 self._callbacks.clear()
341 self.emit("close")
342
343 def call_on_object_with_known_name(
344 self, guid: str, callback: Callable[[ChannelOwner], None]

Callers 3

stop_syncMethod · 0.95
stop_asyncMethod · 0.95

Calls 4

TargetClosedErrorClass · 0.90
cancelMethod · 0.45
disposeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected