-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Upgrade type hints #15784
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] Upgrade type hints #15784
Conversation
|
Thank you, @cgoldberg for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Reviewer Guide 🔍(Review updated until commit 9b86e7e)Here are some key observations to aid the review process:
|
|
nice try @selenium-ci |
User description
💥 What does this PR do?
This PR fixes many type hint issues and upgrades them to be Python 3.9+ syntax compliant (moving many data types to use
collections.abc)🔄 Types of changes
PR Type
Bug fix, Enhancement
Description
Upgrade type hints to Python 3.9+ syntax throughout codebase
Replace legacy
List,Dict,Tuple, etc. with built-in generics (e.g.,list,dict,tuple)Move type hints to use
collections.abcwhere appropriateRemove unused or redundant imports for cleaner code
Changes walkthrough 📝
48 files
Update Sequence import to use collections.abcUse collections.abc.Iterable and update type hintsUse built-in generics and collections.abc.MappingReplace List/Dict with list/dict in type hintsUse collections.abc.Mapping and update type hintsReplace List with list in type hintsUse list instead of List for actions attributeUse dict instead of Dict for encode methodUse dict instead of Dict for _convert_keysRemove unused imports and update type hints to list/dictReplace Dict/List with dict/list in type hintsUse collections.abc for async generators and iteratorsUse dict instead of Dict for command_builderUse list instead of List for args type hintReplace Dict/List with dict/list in type hintsUse dict instead of Dict in type hintsUse dict instead of Dict for _custom_findersUse list instead of List for get_accounts return typeUse collections.abc.AsyncGenerator and update type hintsUse list instead of List for _argumentsUse list/dict instead of List/Dict/Tuple in type hintsUse list instead of List for args and log_itemsUse collections.abc.Mapping and update type hintsUse dict instead of Dict for JSONTimeoutsUse collections.abc.Iterable and list for keys_to_typingUse dict instead of Dict for to_dict methodsUse collections.abc.Mapping and update type hintsUse dict instead of Dict for optsUse collections.abc.Mapping and update type hintsUse dict instead of Dict for _options and _additionalUse list instead of List for service_argsUse dict instead of Dict for check_responseUse list instead of List for account_listUse list/dict instead of List/Dict in type hintsUse list instead of List for find_elementsUse dict instead of Dict for default_capabilitiesUse collections.abc.Mapping and update type hintsUse collections.abc.Sequence and update Match importUse list and tuple built-ins in type hintsUse built-in generics for tuple/list in type hintsUse dict/list instead of Dict/List for LocatorType and filtersUse list instead of List for options and all_selected_optionsUse tuple instead of Tuple for IGNORED_EXCEPTIONSUse collections.abc.Mapping and update type hintsUse dict instead of Dict for default_capabilitiesUse collections.abc.Mapping and update type hintsUse list instead of List for credential_id type hintUse tuple instead of Tuple for data fixture1 files
Remove redundant pytest import formatting1 files
Remove explicit encoding in open for text file