Skip to content

Commit 59e6351

Browse files
authored
chore(lint): added isort for import sorting (#75)
1 parent 91c54d9 commit 59e6351

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+135
-114
lines changed

.github/workflows/ci.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ jobs:
2121
pip install -r local-requirements.txt
2222
pip install .
2323
- name: Lint
24-
run: |
25-
black --check .
26-
mypy .
27-
flake8 playwright tests
24+
run: pre-commit run --all-files
2825
build:
2926
timeout-minutes: 30
3027
strategy:

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ repos:
2020
rev: 'a7be77f761a4c29121d6bb6f61c11902281f9105'
2121
hooks:
2222
- id: flake8
23+
- repo: https://github.com/pre-commit/mirrors-isort
24+
rev: v5.1.3
25+
hooks:
26+
- id: isort

SECURITY.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
1414

1515
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
1616

17-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
1818

1919
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
2020

@@ -38,4 +38,4 @@ We prefer all communications to be in English.
3838

3939
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
4040

41-
<!-- END MICROSOFT SECURITY.MD BLOCK -->
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

playwright/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import playwright.helper as helper
1516
from playwright._repo_version import version as __version__ # noqa:F401
1617
from playwright.main import playwright_object
17-
import playwright.helper as helper
1818

1919
chromium = playwright_object.chromium
2020
firefox = playwright_object.firefox

playwright/accessibility.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Dict
16+
1517
from playwright.connection import Channel
1618
from playwright.element_handle import ElementHandle
17-
from typing import Dict
1819

1920

2021
class Accessibility:

playwright/browser.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
# limitations under the License.
1414

1515
import sys
16+
from types import SimpleNamespace
17+
from typing import Dict, List, Union
18+
1619
from playwright.browser_context import BrowserContext
1720
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
18-
from playwright.helper import locals_to_params, ColorScheme
21+
from playwright.helper import ColorScheme, locals_to_params
1922
from playwright.network import serialize_headers
2023
from playwright.page import Page
21-
from types import SimpleNamespace
22-
from typing import Dict, List, Union
2324

2425
if sys.version_info >= (3, 8): # pragma: no cover
2526
from typing import Literal

playwright/browser_context.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
from playwright.connection import (
17-
ChannelOwner,
18-
ConnectionScope,
19-
from_channel,
20-
)
16+
from types import SimpleNamespace
17+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
18+
19+
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
2120
from playwright.helper import (
2221
Cookie,
2322
Error,
@@ -31,8 +30,6 @@
3130
)
3231
from playwright.network import Request, Route, serialize_headers
3332
from playwright.page import BindingCall, Page, wait_for_event
34-
from types import SimpleNamespace
35-
from typing import Any, Callable, Dict, List, Optional, Union, TYPE_CHECKING
3633

3734
if TYPE_CHECKING: # pragma: no cover
3835
from playwright.browser import Browser

playwright/browser_server.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from playwright.connection import ChannelOwner, ConnectionScope
1615
from types import SimpleNamespace
1716
from typing import Dict
1817

18+
from playwright.connection import ChannelOwner, ConnectionScope
19+
1920

2021
class BrowserServer(ChannelOwner):
2122

playwright/browser_type.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
15+
from typing import Dict, List
16+
1617
from playwright.browser import Browser
1718
from playwright.browser_context import BrowserContext
18-
from playwright.helper import locals_to_params, ColorScheme
19-
from typing import Dict, List
19+
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
20+
from playwright.helper import ColorScheme, locals_to_params
2021

2122

2223
class BrowserType(ChannelOwner):

playwright/connection.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
import asyncio
1616
import sys
1717
import traceback
18-
from playwright.helper import parse_error, ParsedMessagePayload
19-
from playwright.transport import Transport
20-
from pyee import BaseEventEmitter
2118
from typing import Any, Dict, List, Optional
2219

20+
from pyee import BaseEventEmitter
21+
22+
from playwright.helper import ParsedMessagePayload, parse_error
23+
from playwright.transport import Transport
24+
2325

2426
class Channel(BaseEventEmitter):
2527
def __init__(self, scope: "ConnectionScope", guid: str) -> None:

playwright/console_message.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Dict, List
16+
1517
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
1618
from playwright.helper import ConsoleMessageLocation
1719
from playwright.js_handle import JSHandle
18-
from typing import Dict, List
1920

2021

2122
class ConsoleMessage(ChannelOwner):

playwright/dialog.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Dict
16+
1517
from playwright.connection import ChannelOwner, ConnectionScope
1618
from playwright.helper import locals_to_params
17-
from typing import Dict
1819

1920

2021
class Dialog(ChannelOwner):

playwright/download.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from playwright.connection import ChannelOwner, ConnectionScope
1615
from typing import Dict, Optional
1716

17+
from playwright.connection import ChannelOwner, ConnectionScope
18+
1819

1920
class Download(ChannelOwner):
2021
def __init__(self, scope: ConnectionScope, guid: str, initializer: Dict) -> None:

playwright/drivers/browsers.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
"revision": "1308"
1515
}
1616
]
17-
}
17+
}

playwright/element_handle.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,17 @@
1616
import mimetypes
1717
import os
1818
import sys
19-
from playwright.connection import (
20-
ConnectionScope,
21-
from_nullable_channel,
22-
)
19+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union, cast
20+
21+
from playwright.connection import ConnectionScope, from_nullable_channel
2322
from playwright.helper import (
2423
FilePayload,
2524
KeyboardModifier,
2625
MouseButton,
2726
SelectOption,
2827
locals_to_params,
2928
)
30-
from playwright.js_handle import parse_result, serialize_argument, JSHandle
31-
32-
from typing import (
33-
Any,
34-
Callable,
35-
Dict,
36-
List,
37-
Optional,
38-
Union,
39-
TYPE_CHECKING,
40-
cast,
41-
)
29+
from playwright.js_handle import JSHandle, parse_result, serialize_argument
4230

4331
if sys.version_info >= (3, 8): # pragma: no cover
4432
from typing import Literal

playwright/file_chooser.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from playwright.helper import FilePayload
15+
from typing import TYPE_CHECKING, List, Union
1616

17-
from typing import List, Union, TYPE_CHECKING
17+
from playwright.helper import FilePayload
1818

1919
if TYPE_CHECKING: # pragma: no cover
20-
from playwright.page import Page
2120
from playwright.element_handle import ElementHandle
21+
from playwright.page import Page
2222

2323

2424
class FileChooser:

playwright/frame.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
from pyee import BaseEventEmitter
1716
import sys
17+
from typing import TYPE_CHECKING, Any, Awaitable, Dict, List, Optional, Set, Union, cast
18+
19+
from pyee import BaseEventEmitter
20+
1821
from playwright.connection import (
1922
ChannelOwner,
2023
ConnectionScope,
@@ -28,16 +31,15 @@
2831
normalize_file_payloads,
2932
)
3033
from playwright.helper import (
34+
DocumentLoadState,
3135
FilePayload,
32-
is_function_body,
33-
locals_to_params,
3436
KeyboardModifier,
3537
MouseButton,
36-
DocumentLoadState,
38+
is_function_body,
39+
locals_to_params,
3740
)
3841
from playwright.js_handle import JSHandle, parse_result, serialize_argument
3942
from playwright.network import Response
40-
from typing import Any, Awaitable, Dict, List, Optional, Set, Union, TYPE_CHECKING, cast
4143

4244
if sys.version_info >= (3, 8): # pragma: no cover
4345
from typing import Literal

playwright/helper.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,29 @@
1515
import asyncio
1616
import fnmatch
1717
import re
18+
import sys
1819
import traceback
1920
from types import TracebackType
20-
2121
from typing import (
22+
TYPE_CHECKING,
2223
Any,
2324
Callable,
2425
Dict,
2526
List,
2627
Optional,
27-
Union,
28-
TYPE_CHECKING,
2928
Pattern,
29+
Union,
3030
cast,
3131
)
3232

33-
import sys
34-
3533
if sys.version_info >= (3, 8): # pragma: no cover
3634
from typing import Literal, TypedDict
3735
else: # pragma: no cover
3836
from typing_extensions import Literal, TypedDict
3937

4038

4139
if TYPE_CHECKING: # pragma: no cover
42-
from playwright.network import Route, Request
40+
from playwright.network import Request, Route
4341

4442
Cookie = List[Dict[str, Union[str, int, bool]]]
4543
URLMatch = Union[str, Pattern, Callable[[str], bool]]

playwright/input.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from playwright.connection import Channel
16-
from playwright.helper import locals_to_params, MouseButton
16+
from playwright.helper import MouseButton, locals_to_params
1717

1818

1919
class Keyboard:

playwright/js_handle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# limitations under the License.
1414

1515
import math
16-
1716
from datetime import datetime
17+
from typing import TYPE_CHECKING, Any, Dict, List, Optional
18+
1819
from playwright.connection import ChannelOwner, ConnectionScope, from_channel
1920
from playwright.helper import Error, is_function_body
20-
from typing import Any, Dict, List, Optional, TYPE_CHECKING
2121

2222
if TYPE_CHECKING: # pragma: no cover
2323
from playwright.element_handle import ElementHandle

playwright/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import os
1818
import shutil
1919
import stat
20-
import sys
2120
import subprocess
21+
import sys
2222

2323
from playwright.connection import Connection
2424
from playwright.object_factory import create_remote_object

playwright/network.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414

1515
import base64
1616
import json
17+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, cast
18+
1719
from playwright.connection import (
1820
ChannelOwner,
1921
ConnectionScope,
20-
from_nullable_channel,
2122
from_channel,
23+
from_nullable_channel,
2224
)
23-
from playwright.helper import Error, ContinueParameters, Header
24-
from typing import Any, Dict, List, Optional, Union, TYPE_CHECKING, cast
25+
from playwright.helper import ContinueParameters, Error, Header
2526

2627
if TYPE_CHECKING: # pragma: no cover
2728
from playwright.frame import Frame

playwright/object_factory.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Any, Dict
16+
1517
from playwright.browser import Browser
1618
from playwright.browser_context import BrowserContext
1719
from playwright.browser_server import BrowserServer
@@ -27,7 +29,6 @@
2729
from playwright.page import BindingCall, Page
2830
from playwright.playwright import Playwright
2931
from playwright.worker import Worker
30-
from typing import Any, Dict
3132

3233

3334
class DummyObject(ChannelOwner):

0 commit comments

Comments
 (0)