Fix mypy type error in validate_batch_audio_files return type#2
Merged
Fix mypy type error in validate_batch_audio_files return type#2
validate_batch_audio_files return type#2Conversation
… return type Co-authored-by: ajprice16 <101230575+ajprice16@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CI errors and ensure successful CI run
Fix mypy type error in Feb 19, 2026
validate_batch_audio_files return type
ajprice16
approved these changes
Feb 19, 2026
ajprice16
approved these changes
Feb 19, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes a mypy type error in validate_batch_audio_files by making the invalid_files return type accurately reflect the (None, str) early-return case when the target directory doesn’t exist.
Changes:
- Updated
invalid_filesreturn type toList[Tuple[Optional[Path], str]]to match actual behavior. - Added explicit local type annotations for
valid_files/invalid_filesto keep mypy from narrowing types based onappend()usage.
Comment on lines
+90
to
92
| ) -> Tuple[List[Path], List[Tuple[Optional[Path], str]]]: | ||
| """ | ||
| Validate all audio files in a directory. |
There was a problem hiding this comment.
The docstring below still describes invalid_files as containing (Path, message) tuples, but the function now returns List[Tuple[Optional[Path], str]] (and can return (None, ...) when the directory is missing). Please update the docstring lines that mention (Path, ...) so it matches the actual return type and behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CI was failing due to a mypy type error: the function signature declared
List[Tuple[Path, str]]forinvalid_files, but the early-return path yields(None, str)when the directory doesn't exist.Changes
aiaa/audio_validation.pyList[Tuple[Path, str]]→List[Tuple[Optional[Path], str]]valid_filesandinvalid_fileslocals — required so mypy doesn't re-infer a narrower type from theappendcalls and re-flag the returnOriginal prompt
Created from VS Code.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.