Skip to content

chore: move to EventEmitter due deprecation warning #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2020
Merged
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
6 changes: 3 additions & 3 deletions playwright/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions playwright/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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")),
Expand Down
8 changes: 4 additions & 4 deletions playwright/wait_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand All @@ -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:
Expand All @@ -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()

Expand Down