Repository navigation
MgFigure.data is Any, because its shape follows figure_type - #372
Merged
Merged
Conversation
#350's tail: mypy 45 to 34. Half of it is one declaration. `MgFigure.data` was declared `dict`, and two call sites store a tuple in it --- the motiongram and videogram SSMs keep the pair of grams there. Widening it to `dict | tuple` made things WORSE, 40 errors to 48, because every read then had two ways to fail rather than none. The shape genuinely follows `figure_type`: most figures hold a dict of named series, the gram SSMs hold a tuple, some hold an array. `Any` is what that is, and the docstring now says so instead of naming one of the three. Also here: `_videoadjust.py` names `musicalgestures` in a return annotation and never imports it. Inert at runtime, since the annotation is a string that nothing evaluates, and wrong for anything that resolves type hints. `audio_descriptors` arrives at `mg_motion` as a bool flag and is then overwritten with `self`, the video to read audio from, which is what `save_analysis` expects of it. Two meanings in one name. The second meaning has its own name now; the behaviour is unchanged. `mg_ssm` falls off its end when the feature name is not recognised. Its annotation already admitted None; mypy wants that said rather than implied. Five more subprocess streams that are Optional in the stubs and never None in practice, since they were opened with `stdout=PIPE`. 682 tests pass, 4 skipped. Checked by hand that `motion()` still runs through the audio-descriptors branch and that a tempo figure's `.data` is still the dict its readers expect. 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 45 → 34, 682 tests pass.
Half of it is one declaration.
MgFigure.datawas declareddict, and two call sites store a tuple in it — the motiongram and videogram SSMs keep the pair of grams there. Widening todict | tuplemade things worse, 40 → 48, because every read then had two ways to fail rather than none. The shape genuinely followsfigure_type: most figures hold a dict of named series, the gram SSMs a tuple, some an array.Anyis what that is, and the docstring says so rather than naming one of the three.Also here:
_videoadjust.pynamesmusicalgesturesin a return annotation and never imports it. Inert at runtime, since the annotation is a string nothing evaluates, and wrong for anything resolving type hints.audio_descriptorsarrives as aboolflag and is overwritten withself, the video to read audio from, which is whatsave_analysisexpects of it. Two meanings in one name; the second now has its own. Behaviour unchanged.mg_ssmfalls off its end on an unrecognised feature name. The annotation already admittedNone; mypy wants it stated.Nonein practice.Checked by hand, since some of this touches real paths:
motion()still runs through the audio-descriptors branch, and a tempo figure.datais still the dict its readers expect.Remaining after this: 34.
🤖 Generated with Claude Code