-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 package import enhancement #14283
base: trunk
Are you sure you want to change the base?
[py] Typing package import enhancement #14283
Conversation
PR Reviewer Guide 🔍(Review updated until commit 597f8f9)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 597f8f9
Previous suggestionsSuggestions up to commit d792fcf
|
Hi, can you resolve the conflicts due to recently changes? |
yepp . i'll do it until tomorrow morning |
d792fcf
to
d0070af
Compare
I decided to start again from the trunk's HEAD 🙏 |
@VietND96 cc |
Persistent review updated to latest commit 597f8f9 |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
In this pull request, I have standardized the imports from the typing package to only include the necessary types for type hints.
Motivation and Context
I believe this approach makes the imports more decomposed, readable, and correct. From the changes, you can see that in some files, the entire package was imported as well as specific types.
I consider this coding style inconsistent.
Initially, I started adding type hints and discovered such imports. I will add type hints in one of the following pull requests.
Types of changes
Checklist
PR Type
enhancement
Description
typing
package across multiple files to improve readability and consistency.typing
imports with specific type imports such asOptional
,List
,Dict
,Union
, etc.Changes walkthrough 📝
21 files
generate.py
Refactor typing imports for generate.py
py/generate.py
typing
imports with specific type imports.Optional
,List
, etc.cast
fromtyping
directly.types.py
Refactor typing imports for types.py
py/selenium/types.py
typing
imports with specific type imports.Union
,Iterable
, etc.service.py
Refactor typing imports for chrome service
py/selenium/webdriver/chrome/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.service.py
Refactor typing imports for chromium service
py/selenium/webdriver/chromium/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.pointer_input.py
Refactor typing imports for pointer input
py/selenium/webdriver/common/actions/pointer_input.py
typing
imports with specific type imports.Optional
,Dict
, andAny
.cdp.py
Refactor typing imports for bidi cdp
py/selenium/webdriver/common/bidi/cdp.py
typing
imports with specific type imports.AsyncGenerator
,Generator
, andTypeVar
.script.py
Refactor typing imports for bidi script
py/selenium/webdriver/common/bidi/script.py
typing
imports with specific type imports.List
.options.py
Refactor typing imports for common options
py/selenium/webdriver/common/options.py
typing
imports with specific type imports.Optional
.service.py
Refactor typing imports for common service
py/selenium/webdriver/common/service.py
typing
imports with specific type imports.Optional
,Mapping
, andUnion
.virtual_authenticator.py
Refactor typing imports for virtual authenticator
py/selenium/webdriver/common/virtual_authenticator.py
typing
imports with specific type imports.Optional
,Dict
, andUnion
.service.py
Refactor typing imports for edge service
py/selenium/webdriver/edge/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.service.py
Refactor typing imports for firefox service
py/selenium/webdriver/firefox/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.service.py
Refactor typing imports for IE service
py/selenium/webdriver/ie/service.py
typing
imports with specific type imports.Optional
andList
.webdriver.py
Refactor typing imports for remote webdriver
py/selenium/webdriver/remote/webdriver.py
typing
imports with specific type imports.Optional
,Dict
, andType
.options.py
Refactor typing imports for safari options
py/selenium/webdriver/safari/options.py
typing
imports with specific type imports.Dict
.service.py
Refactor typing imports for safari service
py/selenium/webdriver/safari/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.event_firing_webdriver.py
Refactor typing imports for event firing webdriver
py/selenium/webdriver/support/event_firing_webdriver.py
typing
imports with specific type imports.List
,Tuple
, andAny
.wait.py
Refactor typing imports for support wait
py/selenium/webdriver/support/wait.py
typing
imports with specific type imports.Optional
,Tuple
, andType
.service.py
Refactor typing imports for webkitgtk service
py/selenium/webdriver/webkitgtk/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.options.py
Refactor typing imports for wpewebkit options
py/selenium/webdriver/wpewebkit/options.py
typing
imports with specific type imports.Dict
.service.py
Refactor typing imports for wpewebkit service
py/selenium/webdriver/wpewebkit/service.py
typing
imports with specific type imports.Optional
,List
, andMapping
.