-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Fix mypy type errors in webdriver modules #16478
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] Fix mypy type errors in webdriver modules #16478
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve merge conflicts first
|
I don't think there is anything in this PR we want to merge. |
User description
🔗 Related Issues
#15697
💥 What does this PR do?
Fixes mypy type errors in Python webdriver modules:
selenium/webdriver/common/virtual_authenticator.py: Maderp_idOptional[str]to match actual usageselenium/webdriver/remote/errorhandler.py: Added type guards before.get()calls on potentially None valuesselenium/webdriver/webkitgtk/service.py: Madeexecutable_pathOptional[str]to match default valueselenium/webdriver/wpewebkit/service.py: Used separate variable for file objects to avoid type conflicts🔧 Implementation Notes
Type annotation fixes only.....no runtime behavior changes.
💡 Additional Considerations
No tests or docs needed.
🔄 Types of changes
PR Type
Bug fix, Tests
Description
Fixed mypy type errors in Python webdriver modules
Made
rp_idparameterOptional[str]in virtual authenticatorAdded type guard for dict check before
.get()call in error handlerMade
executable_pathparameterOptional[str]in service modulesRefactored file object handling to avoid type conflicts
Diagram Walkthrough
File Walkthrough
virtual_authenticator.py
Made rp_id parameter optionalpy/selenium/webdriver/common/virtual_authenticator.py
rp_idparameter type fromstrtoOptional[str]in__init__method
rp_idproperty return type toOptional[str]to match actualusage
errorhandler.py
Add type guard for dict checkpy/selenium/webdriver/remote/errorhandler.py
isinstance(message, dict)type guard before calling.get()method
service.py
Fix type annotations and refactor file handlingpy/selenium/webdriver/webkitgtk/service.py
DEFAULT_EXECUTABLE_PATHtype fromstrtoOptional[str]tomatch
shutil.which()return typeexecutable_pathparameter type toOptional[str]in__init__method
log_filevariable
eliffor clearer control flow betweenlog_pathand
log_outputIOtype import for proper type annotationservice.py
Make executable_path parameter optionalpy/selenium/webdriver/wpewebkit/service.py
executable_pathparameter type fromstrtoOptional[str]in__init__methodDEFAULT_EXECUTABLE_PATH