Repository navigation
Guard three more lazily opened writers, and document what ffmpeg_cmd returns - #368
Merged
Merged
Conversation
…returns #350's tail continued: mypy goes from 64 errors in 15 files to 52. Nothing here is a new behaviour, only failures made reachable to the reader. *Three writers with the same shape as the one already fixed in `_video.py`.* `video_out = None`, opened on the first frame, and closed unconditionally after the loop. A video that decodes to no frames therefore reached `None.stdin.close()`. Guarded, with a message that says what happened rather than naming an attribute of None. *`ffmpeg_cmd` had no return annotation at all,* and returns four different things depending on its `pipe` argument: a Popen to read from, a Popen to write to, the CompletedProcess of a finished run, or nothing. Annotating that precisely would need overloads keyed on the value of a string, which would describe the signature more exactly than it deserves, so it is `Any` with a docstring naming the four cases. This closed no errors on its own and the contract was undocumented, which is reason enough. *`target_name_video` is resolved to a str under one `if save_video:` and used under a later one.* mypy does not correlate two tests of the same flag, so it still saw the declared Optional. Asserted at the use sites, pointing at where the resolution happens. *A row of pose coordinates was inferred `list[int]`* from its first element, a timestamp, and then fed floats. 682 tests pass, 4 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Continuing the tail of #350. mypy 64 → 52, 682 tests pass.
Nothing here changes behaviour on a working path; each item makes an existing failure reachable to the reader.
_video.py:video_out = None, opened on the first frame, closed unconditionally after the loop, so a video that decodes to no frames reachedNone.stdin.close(). Guarded with a message.ffmpeg_cmdhad no return annotation, and returns four different things depending onpipe: a Popen to read from, a Popen to write to, a finishedCompletedProcess, or nothing. Typing that precisely needs overloads on a string literal, which would claim more precision than the signature has, so it isAnyplus a docstring naming the four cases. Closed no errors by itself; the contract was simply undocumented.target_name_videois resolved under oneif save_video:and used under a later one. mypy does not correlate two tests of the same flag, so it still saw the declared Optional.list[int]from its leading timestamp, then fed float coordinates.Remaining after this: 52.
🤖 Generated with Claude Code