Repository navigation
Copy #621's units.py into tilia_core.timemap again - #732
Merged
Merged
Conversation
Copied from tilia/timelines/beat/units.py (desktop#621 at 07cb6d4), unchanged: the file is the same blob as there. Since a17bbd8, #621 refuses a unit longer than MAX_UNIT_LENGTH (32 characters) before Fraction() reads it, so a unit reads the same on every Python, and cuts it short in the message; MeasureMeter holds tuples, so it can be hashed; beat_unit_id is str | None, with a docstring for both copies; and quarter_length is exact for an int. The new TestParseUnits cases are ported. Part of TimeLineAnnotator/project-management#247 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meters_of passes the units and beat values as tuples, as #621's _compute_measure_meters now does, so a meter can be hashed. The tests compare tuples, and check that meters hash and that quarter_length is exact for an int, as #621's do. Part of TimeLineAnnotator/project-management#247 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
azfoo
force-pushed
the
v1/247-units-copy
branch
from
October 13, 2026 12:22
be2b25e to
e2b1e6a
Compare
parse_units now refuses a unit longer than MAX_UNIT_LENGTH, so rows_of leaves such a beat unit out and the unit before it carries on. The tests of rows_of and meters_of cover it. _BeatUnit's docstring says when its units are parsed. Part of TimeLineAnnotator/project-management#247 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
azfoo
commented
Oct 14, 2026
azfoo
left a comment
Collaborator
Author
There was a problem hiding this comment.
🤖 Claude
Checked against #621 (beat units and time signatures) at 07cb6d4f: no problems found. This leaves the approval to @FelipeDefensor.
- The copy.
packages/tilia-core/src/tilia_core/timemap/units.pyand #621'stilia/timelines/beat/units.pyat07cb6d4fare the same blob (3ca97a74), andfeat/beat-unitis still at07cb6d4f. meters_ofchanges only by the twotuple()s, as #621's_compute_measure_metershas them. The_BeatUnitdocstring change is wording.- The ported tests are #621's, case for case: the three new
TestParseUnitstests,test_meters_can_be_hashedandtest_quarter_length_is_exact. The lists-to-tuples changes intest_timemap_meters.pychange no expected value. - Each commit passes on its own: 399, 402 and 404 tests at
e5337b28,e2b1e6a8andc6584d8f. - The guarantees table reproduces exactly. Neutralising each piece of code in turn gave 4, 3, 5, 11 and 1 failing tests, and 404 passed again once restored.
v1-prereleasehas moved since this branch was cut (#731, the importers' setup), and no file undertimemapchanged. Rebased locally, without pushing, it has no conflicts and 445 tests pass, so a rebase merge needs no new push.- CI is green on all three systems.
- The spec now describes this copy: a meter's
unitsandbeat_valuesare tuples, andbeat_unit_idisstr | Nonein both copies (WP9'sdata-model.md, on TimeLineAnnotator/project-management#253's branch).
#736 (time signatures in the measure table) is stacked on this branch. Once this merges, it moves to v1-prerelease.
This was referenced Oct 14, 2026
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.
🤖 Claude
Copies #621 (beat units and time signatures)'s
units.pyintotilia_core.timemapagain, so the two files stay the same. The core's first copy came in with #706 (beat-unit rules in the core).tilia_core/timemap/units.pyis feat: beat patterns, beat units, time signatures and quarter stamps #621'stilia/timelines/beat/units.pyat07cb6d4f, unchanged: the same git blob. Sincea17bbd83, feat: beat patterns, beat units, time signatures and quarter stamps #621 has made four changes:MAX_UNIT_LENGTH(32 characters) beforeFraction()reads it, so a unit reads the same on every Python, and the error message cuts the unit short;MeasureMeterholds tuples, so a meter can be hashed;beat_unit_idisstr | None, and the docstring says what it names in the app and in the core;quarter_lengthis exact when given anint.meters_ofpasses the units and beat values as tuples, as feat: beat patterns, beat units, time signatures and quarter stamps #621's_compute_measure_metersnow does.Tests
test_timemap_units.pyports feat: beat patterns, beat units, time signatures and quarter stamps #621's newTestParseUnitscases: the longest unit read, a longer one refused with a shortened message, and a 5,000-digit unit refused whatever Python's digit limit is.test_timemap_meters.pycompares tuples, and adds feat: beat patterns, beat units, time signatures and quarter stamps #621'stest_meters_can_be_hashedandtest_quarter_length_is_exact.test_timemap_rows.pyandtest_timemap_meters.pycheck that a beat unit longer than 32 characters is left out when a timeline is read, so the unit before it carries on.uv run --package tilia-core pytest packages/tilia-core -q: 404 passed onv1-prerelease, which now has Move #621's beat unit rules into tilia_core.timemap, and compute each measure's meter #706 and feat(core): the measure table's structure and the time map's positions #707 (table and positions), and each commit passes on its own.python scripts/check_packages.pypasses. black and ruff are clean.Guarantees. I neutralised the code behind each one, ran the suite (404 tests), then restored it:
too_long orremovedshown = itemunits=unitsinmeters_oftuple()inmeters_ofquarter_lengthis exact for anintFraction()Part of TimeLineAnnotator/project-management#247
🤖 Generated with Claude Code