Skip to content

Commit fb7f0f1

Browse files
committed
[py] Add import sorting
1 parent b244b2c commit fb7f0f1

File tree

76 files changed

+244
-389
lines changed

Some content is hidden

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

76 files changed

+244
-389
lines changed

py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ respect-gitignore = true
141141
target-version = "py39"
142142

143143
[tool.ruff.lint]
144-
extend-select = ["E4", "E7", "E9", "F", "E501"]
144+
extend-select = ["E4", "E7", "E9", "F", "I", "E501", "RUF022"]
145145
fixable = ["ALL"]
146146

147147
[tool.ruff.format]

py/selenium/common/__init__.py

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,74 +15,76 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from .exceptions import DetachedShadowRootException
19-
from .exceptions import ElementClickInterceptedException
20-
from .exceptions import ElementNotInteractableException
21-
from .exceptions import ElementNotSelectableException
22-
from .exceptions import ElementNotVisibleException
23-
from .exceptions import ImeActivationFailedException
24-
from .exceptions import ImeNotAvailableException
25-
from .exceptions import InsecureCertificateException
26-
from .exceptions import InvalidArgumentException
27-
from .exceptions import InvalidCookieDomainException
28-
from .exceptions import InvalidCoordinatesException
29-
from .exceptions import InvalidElementStateException
30-
from .exceptions import InvalidSelectorException
31-
from .exceptions import InvalidSessionIdException
32-
from .exceptions import InvalidSwitchToTargetException
33-
from .exceptions import JavascriptException
34-
from .exceptions import MoveTargetOutOfBoundsException
35-
from .exceptions import NoAlertPresentException
36-
from .exceptions import NoSuchAttributeException
37-
from .exceptions import NoSuchCookieException
38-
from .exceptions import NoSuchDriverException
39-
from .exceptions import NoSuchElementException
40-
from .exceptions import NoSuchFrameException
41-
from .exceptions import NoSuchShadowRootException
42-
from .exceptions import NoSuchWindowException
43-
from .exceptions import ScreenshotException
44-
from .exceptions import SessionNotCreatedException
45-
from .exceptions import StaleElementReferenceException
46-
from .exceptions import TimeoutException
47-
from .exceptions import UnableToSetCookieException
48-
from .exceptions import UnexpectedAlertPresentException
49-
from .exceptions import UnexpectedTagNameException
50-
from .exceptions import UnknownMethodException
51-
from .exceptions import WebDriverException
18+
from .exceptions import (
19+
DetachedShadowRootException,
20+
ElementClickInterceptedException,
21+
ElementNotInteractableException,
22+
ElementNotSelectableException,
23+
ElementNotVisibleException,
24+
ImeActivationFailedException,
25+
ImeNotAvailableException,
26+
InsecureCertificateException,
27+
InvalidArgumentException,
28+
InvalidCookieDomainException,
29+
InvalidCoordinatesException,
30+
InvalidElementStateException,
31+
InvalidSelectorException,
32+
InvalidSessionIdException,
33+
InvalidSwitchToTargetException,
34+
JavascriptException,
35+
MoveTargetOutOfBoundsException,
36+
NoAlertPresentException,
37+
NoSuchAttributeException,
38+
NoSuchCookieException,
39+
NoSuchDriverException,
40+
NoSuchElementException,
41+
NoSuchFrameException,
42+
NoSuchShadowRootException,
43+
NoSuchWindowException,
44+
ScreenshotException,
45+
SessionNotCreatedException,
46+
StaleElementReferenceException,
47+
TimeoutException,
48+
UnableToSetCookieException,
49+
UnexpectedAlertPresentException,
50+
UnexpectedTagNameException,
51+
UnknownMethodException,
52+
WebDriverException,
53+
)
5254

5355
__all__ = [
54-
"WebDriverException",
55-
"InvalidSwitchToTargetException",
56-
"NoSuchFrameException",
57-
"NoSuchWindowException",
58-
"NoSuchElementException",
59-
"NoSuchAttributeException",
60-
"NoSuchDriverException",
61-
"NoSuchShadowRootException",
62-
"StaleElementReferenceException",
63-
"InvalidElementStateException",
64-
"UnexpectedAlertPresentException",
65-
"NoAlertPresentException",
66-
"ElementNotVisibleException",
56+
"DetachedShadowRootException",
57+
"ElementClickInterceptedException",
6758
"ElementNotInteractableException",
6859
"ElementNotSelectableException",
69-
"InvalidCookieDomainException",
70-
"UnableToSetCookieException",
71-
"TimeoutException",
72-
"MoveTargetOutOfBoundsException",
73-
"UnexpectedTagNameException",
74-
"InvalidSelectorException",
75-
"ImeNotAvailableException",
60+
"ElementNotVisibleException",
7661
"ImeActivationFailedException",
62+
"ImeNotAvailableException",
63+
"InsecureCertificateException",
7764
"InvalidArgumentException",
65+
"InvalidCookieDomainException",
66+
"InvalidCoordinatesException",
67+
"InvalidElementStateException",
68+
"InvalidSelectorException",
69+
"InvalidSessionIdException",
70+
"InvalidSwitchToTargetException",
7871
"JavascriptException",
72+
"MoveTargetOutOfBoundsException",
73+
"NoAlertPresentException",
74+
"NoSuchAttributeException",
7975
"NoSuchCookieException",
76+
"NoSuchDriverException",
77+
"NoSuchElementException",
78+
"NoSuchFrameException",
79+
"NoSuchShadowRootException",
80+
"NoSuchWindowException",
8081
"ScreenshotException",
81-
"ElementClickInterceptedException",
82-
"InsecureCertificateException",
83-
"InvalidCoordinatesException",
84-
"InvalidSessionIdException",
8582
"SessionNotCreatedException",
83+
"StaleElementReferenceException",
84+
"TimeoutException",
85+
"UnableToSetCookieException",
86+
"UnexpectedAlertPresentException",
87+
"UnexpectedTagNameException",
8688
"UnknownMethodException",
87-
"DetachedShadowRootException",
89+
"WebDriverException",
8890
]

py/selenium/common/exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
# under the License.
1717
"""Exceptions that may happen in all the webdriver code."""
1818

19-
from typing import Optional
20-
from typing import Sequence
19+
from typing import Optional, Sequence
2120

2221
SUPPORT_MSG = "For documentation on this error, please visit:"
2322
ERROR_URL = "https://www.selenium.dev/documentation/webdriver/troubleshooting/errors"

py/selenium/types.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
# under the License.
1717
"""Selenium type definitions."""
1818

19-
from typing import IO
20-
from typing import Any
21-
from typing import Iterable
22-
from typing import Type
23-
from typing import Union
19+
from typing import IO, Any, Iterable, Type, Union
2420

2521
AnyKey = Union[str, int, float]
2622
WaitExcTypes = Iterable[Type[Exception]]

py/selenium/webdriver/__init__.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,32 @@
4848

4949
# We need an explicit __all__ because the above won't otherwise be exported.
5050
__all__ = [
51-
"Firefox",
52-
"FirefoxProfile",
53-
"FirefoxOptions",
54-
"FirefoxService",
51+
"ActionChains",
5552
"Chrome",
5653
"ChromeOptions",
5754
"ChromeService",
58-
"Ie",
59-
"IeOptions",
60-
"IeService",
61-
"Edge",
6255
"ChromiumEdge",
56+
"DesiredCapabilities",
57+
"Edge",
6358
"EdgeOptions",
6459
"EdgeService",
60+
"Firefox",
61+
"FirefoxOptions",
62+
"FirefoxProfile",
63+
"FirefoxService",
64+
"Ie",
65+
"IeOptions",
66+
"IeService",
67+
"Keys",
68+
"Proxy",
69+
"Remote",
6570
"Safari",
6671
"SafariOptions",
6772
"SafariService",
68-
"WebKitGTK",
69-
"WebKitGTKOptions",
70-
"WebKitGTKService",
7173
"WPEWebKit",
7274
"WPEWebKitOptions",
7375
"WPEWebKitService",
74-
"Remote",
75-
"DesiredCapabilities",
76-
"ActionChains",
77-
"Proxy",
78-
"Keys",
76+
"WebKitGTK",
77+
"WebKitGTKOptions",
78+
"WebKitGTKService",
7979
]

py/selenium/webdriver/chrome/service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
# under the License.
1717

1818

19-
from typing import List
20-
from typing import Mapping
21-
from typing import Optional
19+
from typing import List, Mapping, Optional
2220

2321
from selenium.types import SubprocessStdAlias
2422
from selenium.webdriver.chromium import service

py/selenium/webdriver/chromium/options.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717

1818
import base64
1919
import os
20-
from typing import BinaryIO
21-
from typing import Dict
22-
from typing import List
23-
from typing import Optional
24-
from typing import Union
20+
from typing import BinaryIO, Dict, List, Optional, Union
2521

2622
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2723
from selenium.webdriver.common.options import ArgOptions

py/selenium/webdriver/chromium/service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
from io import IOBase
18-
from typing import List
19-
from typing import Mapping
20-
from typing import Optional
18+
from typing import List, Mapping, Optional
2119

2220
from selenium.types import SubprocessStdAlias
2321
from selenium.webdriver.common import service

py/selenium/webdriver/common/action_chains.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@
1818

1919
from __future__ import annotations
2020

21-
from typing import TYPE_CHECKING
22-
from typing import Union
21+
from typing import TYPE_CHECKING, Union
2322

2423
from selenium.webdriver.remote.webelement import WebElement
2524

2625
from .actions.action_builder import ActionBuilder
2726
from .actions.key_input import KeyInput
2827
from .actions.pointer_input import PointerInput
29-
from .actions.wheel_input import ScrollOrigin
30-
from .actions.wheel_input import WheelInput
28+
from .actions.wheel_input import ScrollOrigin, WheelInput
3129
from .utils import keys_to_typing
3230

3331
if TYPE_CHECKING:

py/selenium/webdriver/common/actions/action_builder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from typing import List
19-
from typing import Optional
20-
from typing import Union
18+
from typing import List, Optional, Union
2119

2220
from selenium.webdriver.remote.command import Command
2321

0 commit comments

Comments
 (0)