[py] Fix type annotation error and raise clearer error message#16174
[py] Fix type annotation error and raise clearer error message#16174navin772 merged 8 commits intoSeleniumHQ:trunkfrom
Conversation
…er.py (partially addresses SeleniumHQ#15697)
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
|
@olleolleolle hello sir |
|
will try to do more better ! |
36b08cd to
4b60710
Compare
…sh-0007/selenium into fix-python-type-annotations
Type Annotation Improvements@cgoldberg @navin772, I have incorporated the changes as you have said |
|
should i apply formating using ruff ? |
|
@Paresh-0007 Yes, you can run |
…sh-0007/selenium into fix-python-type-annotations
|
done ! |
User description
🔗 Related Issues
Partially addresses #15697
💥 What does this PR do?
Fixes specific mypy type annotation errors in:
selenium/webdriver/common/virtual_authenticator.pyrpIdis missing inCredential.from_dict, ensuringrp_idis always a string.selenium/webdriver/remote/errorhandler.py.geton possibly-None values, so.getis only used on dictionaries.🔧 Implementation Notes
isinstance(value, dict)before using.getto resolve mypy union-attr errors.from_dictto requirerpIdand raise a clear error if missing, as discussed in project guidelines.💡 Additional Considerations
🔄 Types of changes
PR Type
Other
Description
Fix mypy type annotation errors in virtual authenticator
Add type checks before dictionary operations in error handler
Ensure required
rpIdfield validation with clear error messageDiagram Walkthrough
File Walkthrough
virtual_authenticator.py
Validate required rpId field in Credential.from_dictpy/selenium/webdriver/common/virtual_authenticator.py
rpIdretrieval with required field validationrpIdis missing from credential datarp_idis always a string typeerrorhandler.py
Add type checks before dictionary operationspy/selenium/webdriver/remote/errorhandler.py