Skip to content

Commit

Permalink
chore: bump PyPi dependencies (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Sep 30, 2020
1 parent fd3f33f commit 385cd69
Show file tree
Hide file tree
Showing 32 changed files with 281 additions and 112 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^playwright/drivers/browsers.json$
- id: check-yaml
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
hooks:
- id: mypy
- repo: https://gitlab.com/pycqa/flake8
rev: 'a7be77f761a4c29121d6bb6f61c11902281f9105'
rev: '3.8.3'
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.1.3
rev: v5.5.4
hooks:
- id: isort
3 changes: 2 additions & 1 deletion build_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
node_modules_playwright = driver_path / "node_modules" / "playwright"

shutil.copyfile(
node_modules_playwright / "browsers.json", drivers_path / "browsers.json",
node_modules_playwright / "browsers.json",
drivers_path / "browsers.json",
)

upstream_readme = (node_modules_playwright / "README.md").read_text()
Expand Down
14 changes: 7 additions & 7 deletions local-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
pytest==5.4.3
pytest==6.1.0
pytest-asyncio==0.14.0
pytest-cov==2.10.0
pytest-cov==2.10.1
pytest-sugar==0.9.4
pytest-xdist==1.33.0
pytest-xdist==2.1.0
pytest-timeout==1.4.2
pixelmatch==0.2.1
Pillow==7.2.0
mypy==0.782
setuptools==49.1.0
setuptools==50.3.0
twisted==20.3.0
wheel==0.34.2
black==19.10b0
pre-commit==2.6.0
wheel==0.35.1
black==20.8b1
pre-commit==2.7.1
flake8==3.8.3
twine==3.2.0
pyOpenSSL==19.1.0
Expand Down
3 changes: 1 addition & 2 deletions playwright/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3042,8 +3042,7 @@ async def accept(self, promptText: str = None) -> NoneType:
)

async def dismiss(self) -> NoneType:
"""Dialog.dismiss
"""
"""Dialog.dismiss"""
return mapping.from_maybe_impl(await self._impl_obj.dismiss())


Expand Down
4 changes: 3 additions & 1 deletion playwright/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@

class Browser(ChannelOwner):

Events = SimpleNamespace(Disconnected="disconnected",)
Events = SimpleNamespace(
Disconnected="disconnected",
)

def __init__(
self, parent: "BrowserType", type: str, guid: str, initializer: Dict
Expand Down
14 changes: 11 additions & 3 deletions playwright/browser_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@

class BrowserContext(ChannelOwner):

Events = SimpleNamespace(Close="close", Page="page",)
Events = SimpleNamespace(
Close="close",
Page="page",
)

def __init__(
self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
Expand Down Expand Up @@ -219,11 +222,16 @@ async def close(self) -> None:
await self._channel.send("close")

def expect_event(
self, event: str, predicate: Callable[[Any], bool] = None, timeout: int = None,
self,
event: str,
predicate: Callable[[Any], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl:
return EventContextManagerImpl(self.waitForEvent(event, predicate, timeout))

def expect_page(
self, predicate: Callable[[Page], bool] = None, timeout: int = None,
self,
predicate: Callable[[Page], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl[Page]:
return EventContextManagerImpl(self.waitForEvent("page", predicate, timeout))
3 changes: 2 additions & 1 deletion playwright/chromium_browser_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
class ChromiumBrowserContext(BrowserContext):

Events = SimpleNamespace(
BackgroundPage="backgroundpage", ServiceWorker="serviceworker",
BackgroundPage="backgroundpage",
ServiceWorker="serviceworker",
)

def __init__(
Expand Down
12 changes: 6 additions & 6 deletions playwright/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def __init__(
self._loop: asyncio.AbstractEventLoop = parent._loop
self._type = type
self._guid = guid
self._connection: Connection = parent._connection if isinstance(
parent, ChannelOwner
) else parent
self._parent: Optional[ChannelOwner] = parent if isinstance(
parent, ChannelOwner
) else None
self._connection: Connection = (
parent._connection if isinstance(parent, ChannelOwner) else parent
)
self._parent: Optional[ChannelOwner] = (
parent if isinstance(parent, ChannelOwner) else None
)
self._objects: Dict[str, "ChannelOwner"] = {}
self._channel = Channel(self._connection, guid)
self._channel._object = self
Expand Down
16 changes: 12 additions & 4 deletions playwright/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def __init__(
lambda params: self._on_load_state(params.get("add"), params.get("remove")),
)
self._channel.on(
"navigated", lambda params: self._on_frame_navigated(params),
"navigated",
lambda params: self._on_frame_navigated(params),
)

def _on_load_state(
Expand Down Expand Up @@ -156,7 +157,9 @@ def predicate(event: Any) -> bool:
return not matcher or matcher.matches(event["url"])

event = await wait_helper.wait_for_event(
self._event_emitter, "navigated", predicate=predicate,
self._event_emitter,
"navigated",
predicate=predicate,
)
if "error" in event:
raise Error(event["error"])
Expand Down Expand Up @@ -293,7 +296,10 @@ async def content(self) -> str:
return await self._channel.send("content")

async def setContent(
self, html: str, timeout: int = None, waitUntil: DocumentLoadState = None,
self,
html: str,
timeout: int = None,
waitUntil: DocumentLoadState = None,
) -> None:
await self._channel.send("setContent", locals_to_params(locals()))

Expand Down Expand Up @@ -484,7 +490,9 @@ async def title(self) -> str:
return await self._channel.send("title")

def expect_load_state(
self, state: DocumentLoadState = None, timeout: int = None,
self,
state: DocumentLoadState = None,
timeout: int = None,
) -> EventContextManagerImpl[Optional[Response]]:
return EventContextManagerImpl(self.waitForLoadState(state, timeout))

Expand Down
18 changes: 15 additions & 3 deletions playwright/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ def __init__(self, channel: Channel) -> None:
async def move(self, x: float, y: float, steps: int = None) -> None:
await self._channel.send("mouseMove", locals_to_params(locals()))

async def down(self, button: MouseButton = None, clickCount: int = None,) -> None:
async def down(
self,
button: MouseButton = None,
clickCount: int = None,
) -> None:
await self._channel.send("mouseDown", locals_to_params(locals()))

async def up(self, button: MouseButton = None, clickCount: int = None,) -> None:
async def up(
self,
button: MouseButton = None,
clickCount: int = None,
) -> None:
await self._channel.send("mouseUp", locals_to_params(locals()))

async def click(
Expand All @@ -62,6 +70,10 @@ async def click(
await self._channel.send("mouseClick", locals_to_params(locals()))

async def dblclick(
self, x: float, y: float, delay: int = None, button: MouseButton = None,
self,
x: float,
y: float,
delay: int = None,
button: MouseButton = None,
) -> None:
await self.click(x, y, delay=delay, button=button, clickCount=2)
54 changes: 41 additions & 13 deletions playwright/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ async def content(self) -> str:
return await self._main_frame.content()

async def setContent(
self, html: str, timeout: int = None, waitUntil: DocumentLoadState = None,
self,
html: str,
timeout: int = None,
waitUntil: DocumentLoadState = None,
) -> None:
return await self._main_frame.setContent(**locals_to_params(locals()))

Expand All @@ -410,7 +413,9 @@ async def goto(
return await self._main_frame.goto(**locals_to_params(locals()))

async def reload(
self, timeout: int = None, waitUntil: DocumentLoadState = None,
self,
timeout: int = None,
waitUntil: DocumentLoadState = None,
) -> Optional[Response]:
return from_nullable_channel(
await self._channel.send("reload", locals_to_params(locals()))
Expand Down Expand Up @@ -489,21 +494,27 @@ async def waitForEvent(
return await wait_helper.wait_for_event(self, event, predicate)

async def goBack(
self, timeout: int = None, waitUntil: DocumentLoadState = None,
self,
timeout: int = None,
waitUntil: DocumentLoadState = None,
) -> Optional[Response]:
return from_nullable_channel(
await self._channel.send("goBack", locals_to_params(locals()))
)

async def goForward(
self, timeout: int = None, waitUntil: DocumentLoadState = None,
self,
timeout: int = None,
waitUntil: DocumentLoadState = None,
) -> Optional[Response]:
return from_nullable_channel(
await self._channel.send("goForward", locals_to_params(locals()))
)

async def emulateMedia(
self, media: Literal["print", "screen"] = None, colorScheme: ColorScheme = None,
self,
media: Literal["print", "screen"] = None,
colorScheme: ColorScheme = None,
) -> None:
await self._channel.send("emulateMedia", locals_to_params(locals()))

Expand Down Expand Up @@ -760,36 +771,49 @@ async def pdf(
return decoded_binary

def expect_event(
self, event: str, predicate: Callable[[Any], bool] = None, timeout: int = None,
self,
event: str,
predicate: Callable[[Any], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl:
return EventContextManagerImpl(self.waitForEvent(event, predicate, timeout))

def expect_console_message(
self, predicate: Callable[[ConsoleMessage], bool] = None, timeout: int = None,
self,
predicate: Callable[[ConsoleMessage], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl[ConsoleMessage]:
return EventContextManagerImpl(self.waitForEvent("console", predicate, timeout))

def expect_dialog(
self, predicate: Callable[[Dialog], bool] = None, timeout: int = None,
self,
predicate: Callable[[Dialog], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl[Dialog]:
return EventContextManagerImpl(self.waitForEvent("dialog", predicate, timeout))

def expect_download(
self, predicate: Callable[[Download], bool] = None, timeout: int = None,
self,
predicate: Callable[[Download], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl[Download]:
return EventContextManagerImpl(
self.waitForEvent("download", predicate, timeout)
)

def expect_file_chooser(
self, predicate: Callable[[FileChooser], bool] = None, timeout: int = None,
self,
predicate: Callable[[FileChooser], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl[FileChooser]:
return EventContextManagerImpl(
self.waitForEvent("filechooser", predicate, timeout)
)

def expect_load_state(
self, state: DocumentLoadState = None, timeout: int = None,
self,
state: DocumentLoadState = None,
timeout: int = None,
) -> EventContextManagerImpl[Optional[Response]]:
return EventContextManagerImpl(self.waitForLoadState(state, timeout))

Expand All @@ -802,7 +826,9 @@ def expect_navigation(
return EventContextManagerImpl(self.waitForNavigation(url, waitUntil, timeout))

def expect_popup(
self, predicate: Callable[["Page"], bool] = None, timeout: int = None,
self,
predicate: Callable[["Page"], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl["Page"]:
return EventContextManagerImpl(self.waitForEvent("popup", predicate, timeout))

Expand All @@ -823,7 +849,9 @@ def expect_response(
return EventContextManagerImpl(self.waitForResponse(url, predicate, timeout))

def expect_worker(
self, predicate: Callable[["Worker"], bool] = None, timeout: int = None,
self,
predicate: Callable[["Worker"], bool] = None,
timeout: int = None,
) -> EventContextManagerImpl["Worker"]:
return EventContextManagerImpl(self.waitForEvent("worker", predicate, timeout))

Expand Down
3 changes: 1 addition & 2 deletions playwright/sync_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3170,8 +3170,7 @@ def accept(self, promptText: str = None) -> NoneType:
)

def dismiss(self) -> NoneType:
"""Dialog.dismiss
"""
"""Dialog.dismiss"""
return mapping.from_maybe_impl(self._sync(self._impl_obj.dismiss()))


Expand Down
4 changes: 3 additions & 1 deletion scripts/documentation_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def compare_types(self, value: Any, doc_value: Any, fqname: str) -> None:
return
code_type = self.serialize_python_type(value)
doc_type = self.serialize_doc_type(
doc_value["type"]["name"], fqname, doc_value["type"],
doc_value["type"]["name"],
fqname,
doc_value["type"],
)
if not doc_value["required"]:
doc_type = self.make_optional(doc_type)
Expand Down
4 changes: 3 additions & 1 deletion scripts/report_downstream_test_diffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def pytest_test_cases() -> typing.Generator[TestCase, None, None]:
matches = re.finditer(regex, p.stdout.decode(), re.MULTILINE)
for match in matches:
yield TestCase(
match.group("api"), match.group("file"), match.group("test"),
match.group("api"),
match.group("file"),
match.group("test"),
)


Expand Down
3 changes: 2 additions & 1 deletion tests/async/test_accessibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ async def test_accessibility_filtering_children_of_leaf_nodes_rich_text_editable
# WebKit rich text accessibility is iffy
@pytest.mark.skip_browser("webkit")
async def test_accessibility_filtering_children_of_leaf_nodes_rich_text_editable_fields_with_role_should_have_children(
page, is_firefox,
page,
is_firefox,
):
await page.setContent(
"""
Expand Down
Loading

0 comments on commit 385cd69

Please sign in to comment.