fix: incorrect type hints in a few places #33104
Merged
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.
Description
As part of my Core Contributor role, I have been working on rolling out type hint declarations and checking in more parts of the codebase. I am about to "turn on" type hints for opaque-keys, but before I can do so I need to fix some minor type errors that exist in
learning_sequences
. These weren't detected before because all opaque keys were being type-checked asAny
, but once openedx/opaque-keys#259 merges, opaque-keys become distinct types and mypy will catch errors like this.The errors:
Note that in this case these aren't runtime bugs, just errors with the type annotations.
Supporting information
See openedx/opaque-keys#259 , openedx/opaque-keys#256 , #32591 for more context.
Testing instructions
The CI should be sufficient, but if you really want:
mypy
for edx-platform without this change. No errors, but that's because opaque key types are not really being checked.pip install -e .
to install the newer type hints into your virtual env.mypy
for edx-platform again - you see the errors I mentioned.mypy
one final time - the errors are gone.Deadline
None
Other information
This needs to merge before the corresponding opaque-keys PR.
Private-ref: MNG-3826