Deprecate import of Commands directly from speech module in favour of speech.commands #12126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Implements deprecation announced in: #11049, #10371, #10885
Part of: #12123
Summary of the issue:
Commands from the module
speech.commands
were being imported asfrom .commands import *
inspeech\__init__.py
andspeech\manager.py
.As a result, commands were often being imported as
import speech; speech.ExampleCommand()
orimport speech.manager; speech.manager.ExampleCommand()
.Description of how this pull request fixes the issue:
The deprecated behaviour is removed and commands must be imported explicitly as
from speech.commands import ExampleCommand
Testing strategy:
Check code correctness by the following process. Do the following using an unchanged repository based on the latest master commit (db664be), so code can be compared properly.
Using git bash tools find & sed (may be also included in Windows Subsystem Linux)
[a-zA-Z_][a-zA-Z0-9_]*
is the regex for valid python variable name prefixesDo the following to confirm commands aren't being imported directly from speech or speech.manager
Compare the current code to this branch: nvda/dep-11049, note the only changes are:
Known issues with pull request:
None
Change log entry:
Dev Changes
Code Review Checklist: