Skip to content

Fix mypy type error in validate_batch_audio_files return type#2

Merged
ajprice16 merged 2 commits intomainfrom
copilot/fix-ci-errors
Feb 19, 2026
Merged

Fix mypy type error in validate_batch_audio_files return type#2
ajprice16 merged 2 commits intomainfrom
copilot/fix-ci-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

CI was failing due to a mypy type error: the function signature declared List[Tuple[Path, str]] for invalid_files, but the early-return path yields (None, str) when the directory doesn't exist.

Changes

  • aiaa/audio_validation.py
    • Return type updated: List[Tuple[Path, str]]List[Tuple[Optional[Path], str]]
    • Added explicit type annotations to valid_files and invalid_files locals — required so mypy doesn't re-infer a narrower type from the append calls and re-flag the return
# Before
) -> Tuple[List[Path], List[Tuple[Path, str]]]:
    valid_files = []
    invalid_files = []
    if not directory.exists():
        return [], [(None, f"Directory does not exist: {directory}")]  # ← type error

# After
) -> Tuple[List[Path], List[Tuple[Optional[Path], str]]]:
    valid_files: List[Path] = []
    invalid_files: List[Tuple[Optional[Path], str]] = []
    if not directory.exists():
        return [], [(None, f"Directory does not exist: {directory}")]  # ← valid
Original prompt

Fix CI errors and rerun CI until it works

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md

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.

… 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 validate_batch_audio_files return type Feb 19, 2026
Copilot AI requested a review from ajprice16 February 19, 2026 20:37
@ajprice16 ajprice16 marked this pull request as ready for review February 19, 2026 20:39
Copilot AI review requested due to automatic review settings February 19, 2026 20:39
@ajprice16 ajprice16 merged commit 8eb5908 into main Feb 19, 2026
4 checks passed
Copy link
Copy Markdown
Owner

@ajprice16 ajprice16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajprice16 ajprice16 deleted the copilot/fix-ci-errors branch February 19, 2026 20:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_files return type to List[Tuple[Optional[Path], str]] to match actual behavior.
  • Added explicit local type annotations for valid_files / invalid_files to keep mypy from narrowing types based on append() usage.

Comment thread aiaa/audio_validation.py
Comment on lines +90 to 92
) -> Tuple[List[Path], List[Tuple[Optional[Path], str]]]:
"""
Validate all audio files in a directory.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants