diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e559b1e7c..88ffe9ae7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -14,20 +14,20 @@ repos: - id: check-executables-have-shebangs - id: check-merge-conflict - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 21.12b0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910-1 + rev: v0.931 hooks: - id: mypy - additional_dependencies: [types-pyOpenSSL==20.0.6] + additional_dependencies: [types-pyOpenSSL==21.0.3] - repo: https://github.com/pycqa/flake8 rev: 4.0.1 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.9.3 + rev: 5.10.1 hooks: - id: isort - repo: local @@ -38,4 +38,4 @@ repos: language: node pass_filenames: false types: [python] - additional_dependencies: ["pyright@1.1.181"] + additional_dependencies: ["pyright@1.1.210"] diff --git a/local-requirements.txt b/local-requirements.txt index 6ecd260c4..9ccbde1af 100644 --- a/local-requirements.txt +++ b/local-requirements.txt @@ -1,25 +1,25 @@ -auditwheel==5.0.0 -autobahn==21.3.1 -black==21.9b0 -flake8==3.9.2 +auditwheel==5.1.2 +autobahn==21.11.1 +black==21.12b0 +flake8==4.0.1 flaky==3.7.0 -mypy==0.910 +mypy==0.931 objgraph==3.5.0 Pillow==9.0.0 -pixelmatch==0.2.3 -pre-commit==2.15.0 -pyOpenSSL==20.0.1 +pixelmatch==0.2.4 +pre-commit==2.16.0 +pyOpenSSL==21.0.0 pytest==6.2.5 -pytest-asyncio==0.15.1 -pytest-cov==2.12.1 +pytest-asyncio==0.17.1 +pytest-cov==3.0.0 pytest-repeat==0.9.1 pytest-sugar==0.9.4 -pytest-timeout==1.4.2 -pytest-xdist==2.4.0 -requests==2.26.0 +pytest-timeout==2.0.2 +pytest-xdist==2.5.0 +requests==2.27.1 service_identity==21.1.0 -setuptools==58.1.0 -twine==3.4.2 +setuptools==60.5.0 +twine==3.7.1 twisted==21.7.0 -types-pyOpenSSL==20.0.6 -wheel==0.37.0 +types-pyOpenSSL==21.0.3 +wheel==0.37.1 diff --git a/playwright/_impl/_impl_to_api_mapping.py b/playwright/_impl/_impl_to_api_mapping.py index 0e5e8bcd2..a9afff31f 100644 --- a/playwright/_impl/_impl_to_api_mapping.py +++ b/playwright/_impl/_impl_to_api_mapping.py @@ -13,8 +13,7 @@ # limitations under the License. import inspect -from types import MethodType -from typing import Any, Callable, Dict, List, Optional, cast +from typing import Any, Callable, Dict, List, Optional from playwright._impl._api_types import Error @@ -91,13 +90,11 @@ def wrapper_func(*args: Any) -> Any: ) if inspect.ismethod(handler): - wrapper = getattr( - cast(MethodType, handler).__self__, IMPL_ATTR + handler.__name__, None - ) + wrapper = getattr(handler.__self__, IMPL_ATTR + handler.__name__, None) if not wrapper: wrapper = wrapper_func setattr( - cast(MethodType, handler).__self__, + handler.__self__, IMPL_ATTR + handler.__name__, wrapper, ) diff --git a/playwright/_impl/_network.py b/playwright/_impl/_network.py index 7d1db29ff..86ebf275e 100644 --- a/playwright/_impl/_network.py +++ b/playwright/_impl/_network.py @@ -388,7 +388,7 @@ def expect_event( timeout = cast(Any, self._parent)._timeout_settings.timeout() wait_helper = WaitHelper(self, f"web_socket.expect_event({event})") wait_helper.reject_on_timeout( - timeout, f'Timeout while waiting for event "{event}"' + cast(float, timeout), f'Timeout while waiting for event "{event}"' ) if event != WebSocket.Events.Close: wait_helper.reject_on_event( diff --git a/tests/sync/test_accessibility.py b/tests/sync/test_accessibility.py index 9ce2ac5c7..856e8bcce 100644 --- a/tests/sync/test_accessibility.py +++ b/tests/sync/test_accessibility.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Any, Dict + import pytest from playwright.sync_api import Page @@ -220,6 +222,7 @@ def test_accessibility_filtering_children_of_leaf_nodes_rich_text_editable_field Edit this image: my fake image """ ) + golden: Dict[str, Any] if is_firefox: golden = { "role": "textbox",