-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Py typing #15446
base: trunk
Are you sure you want to change the base?
Py typing #15446
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Can you remove the formatting changes in this that aren't related to the typing changes? There are spurious newlines and unrelated formating changes. (running the linting tools will re-format it for you) |
The formatting changes were automatically applied by the Black linter to ensure the code follows the PEP 8 recommendations. Which linter should I use to maintain the project's standard formatting, considering it’s a Selenium-related library? |
Here's the linters we use: Line 64 in 030f1f6
We use a 120 char line-length with black. |
- Added explicit type annotations to selenium.webdriver.remote.webdriver.py and selenium.webdriver.remote.webelement.py - Improved code clarity and static type checking - Ensured compatibility with modern type checkers like Pyright and Mypy
- Added explicit type annotations to selenium.webdriver.remote.remote_connection.py - Improved code clarity and static type checking - Ensured compatibility with modern type checkers like Pyright and Mypy
- Added explicit type annotations to selenium.webdriver.common.options.py - Improved code clarity and static type checking - Ensured compatibility with modern type checkers like Pyright and Mypy
I've made the requested changes and reverted any unrelated formatting modifications. I also ran the project's linter to ensure consistency. To facilitate the PR review, I reset the previous commits and created new ones using -f to keep the history clean. Let me know if anything else needs adjustment! |
User description
Motivation and Context
This change improves code maintainability and enhances static type checking by adding type hints to:
Files:
Types of changes
Checklist
PR Type
Enhancement, Bug fix
Description
Added type hints across multiple files for improved static type checking.
Enhanced code readability and maintainability by aligning with modern Python practices.
Fixed potential issues with type safety and compatibility with tools like MyPy and Pyright.
Refactored code for better clarity, including breaking long lines and improving formatting.
Changes walkthrough 📝
options.py
Add type hints and improve formatting in options.py
py/selenium/webdriver/common/options.py
remote_connection.py
Add type hints and refactor remote_connection.py
py/selenium/webdriver/remote/remote_connection.py
script_key.py
Add type hints to script_key.py
py/selenium/webdriver/remote/script_key.py
webdriver.py
Add type hints and refactor webdriver.py
py/selenium/webdriver/remote/webdriver.py
webelement.py
Add type hints and refactor webelement.py
py/selenium/webdriver/remote/webelement.py