-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Improve type hints with union syntax and native types #16590
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] Improve type hints with union syntax and native types #16590
Conversation
navin772
left a comment
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.
LGTM!
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 |
||||||||||||||||||||||||
User description
🔗 Related Issues
#15697
💥 What does this PR do?
This PR improves Python type hints to use union types that are available in Python 3.10+:
This syntax is preferred over
OptionalandUnionin newer versions of Python.This PR also replaces several type annotations from
typingmodule with native types, and a few other modernizations.🔄 Types of changes
PR Type
Enhancement
Description
Replace
OptionalandUnionwith PEP 604 union syntax (|)Move
Callableimport fromtypingtocollections.abcReplace
typing.Listwith nativelisttype annotationRemove unused imports and clean up type hints across codebase
Diagram Walkthrough
File Walkthrough
20 files
Replace Optional/Union with PEP 604 syntaxModernize exception class type hintsUpdate WebDriver type hints to PEP 604Modernize RelativeBy class type hintsUpdate storage module type annotationsModernize emulation module type hintsUpdate input module with PEP 604 syntaxMove Callable import and modernize type hintsUpdate script module type annotationsModernize CDP generator type hintsUpdate ClientConfig type hintsModernize Firefox options type hintsUpdate authenticator type annotationsModernize action builder type hintsUpdate print options type hintsModernize pointer actions type hintsUpdate utility functions type hintsModernize Chromium options type hintsUpdate wheel input type annotationsModernize browser module type hints44 files