From 10d680837db6a063a15507435a59fd5c1a5d382d Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sat, 3 Oct 2020 15:31:59 +0200 Subject: [PATCH] chore: move to EventEmitter due deprecation warning --- playwright/connection.py | 6 +++--- playwright/frame.py | 4 ++-- playwright/wait_helper.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/playwright/connection.py b/playwright/connection.py index 3b302a9cb..1170d37fe 100644 --- a/playwright/connection.py +++ b/playwright/connection.py @@ -18,14 +18,14 @@ from typing import Any, Callable, Dict, Optional, Union from greenlet import greenlet -from pyee import BaseEventEmitter +from pyee import EventEmitter from playwright.helper import ParsedMessagePayload, parse_error from playwright.sync_base import dispatcher_fiber from playwright.transport import Transport -class Channel(BaseEventEmitter): +class Channel(EventEmitter): def __init__(self, connection: "Connection", guid: str) -> None: super().__init__() self._connection: Connection = connection @@ -54,7 +54,7 @@ def send_no_reply(self, method: str, params: Dict = None) -> None: self._connection._send_message_to_server(self._guid, method, params) -class ChannelOwner(BaseEventEmitter): +class ChannelOwner(EventEmitter): def __init__( self, parent: Union["ChannelOwner", "Connection"], diff --git a/playwright/frame.py b/playwright/frame.py index 406d23be4..0f83306da 100644 --- a/playwright/frame.py +++ b/playwright/frame.py @@ -17,7 +17,7 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Union, cast -from pyee import BaseEventEmitter +from pyee import EventEmitter from playwright.connection import ChannelOwner, from_channel, from_nullable_channel from playwright.element_handle import ( @@ -73,7 +73,7 @@ def __init__( self._child_frames: List[Frame] = [] self._page: "Page" self._load_states: Set[str] = set(initializer["loadStates"]) - self._event_emitter = BaseEventEmitter() + self._event_emitter = EventEmitter() self._channel.on( "loadstate", lambda params: self._on_load_state(params.get("add"), params.get("remove")), diff --git a/playwright/wait_helper.py b/playwright/wait_helper.py index 6612619e6..795ceb22d 100644 --- a/playwright/wait_helper.py +++ b/playwright/wait_helper.py @@ -15,7 +15,7 @@ import asyncio from typing import Any, Callable, List -from pyee import BaseEventEmitter +from pyee import EventEmitter from playwright.helper import Error, TimeoutError @@ -27,7 +27,7 @@ def __init__(self, loop: asyncio.AbstractEventLoop) -> None: def reject_on_event( self, - emitter: BaseEventEmitter, + emitter: EventEmitter, event: str, error: Error, predicate: Callable[[Any], bool] = None, @@ -52,7 +52,7 @@ async def future_wrapper() -> Error: async def wait_for_event( self, - emitter: BaseEventEmitter, + emitter: EventEmitter, event: str, predicate: Callable[[Any], bool] = None, ) -> Any: @@ -75,7 +75,7 @@ async def wait_for_future(self, future: asyncio.Future) -> Any: def wait_for_event_future( - emitter: BaseEventEmitter, event: str, predicate: Callable[[Any], bool] = None + emitter: EventEmitter, event: str, predicate: Callable[[Any], bool] = None ) -> asyncio.Future: future: asyncio.Future = asyncio.Future()