Skip to content

Copy #621's units.py into tilia_core.timemap again - #732

Merged
azfoo merged 3 commits into
v1-prereleasefrom
v1/247-units-copy
Oct 14, 2026
Merged

azfoo merged 3 commits into
v1-prereleasefrom
v1/247-units-copy

Conversation

@azfoo

@azfoo azfoo commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Claude

Copies #621 (beat units and time signatures)'s units.py into tilia_core.timemap again, so the two files stay the same. The core's first copy came in with #706 (beat-unit rules in the core).

Tests

Guarantees. I neutralised the code behind each one, ran the suite (404 tests), then restored it:

Guarantee Code neutralised Tests failing
a unit over 32 characters is refused, and left out when read too_long or removed 4
the message cuts a long unit short shown = item 3
a meter's units are a tuple units=units in meters_of 5
a meter's beat values are a tuple no tuple() in meters_of 11
quarter_length is exact for an int no Fraction() 1

Part of TimeLineAnnotator/project-management#247

🤖 Generated with Claude Code

azfoo and others added 2 commits October 13, 2026 14:20
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
azfoo force-pushed the v1/247-units-copy branch from be2b25e to e2b1e6a Compare October 13, 2026 12:22
@azfoo
azfoo changed the base branch from v1/213-timemap-meters to v1-prerelease October 13, 2026 12:22
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 azfoo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 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.py and #621's tilia/timelines/beat/units.py at 07cb6d4f are the same blob (3ca97a74), and feat/beat-unit is still at 07cb6d4f.
  • meters_of changes only by the two tuple()s, as #621's _compute_measure_meters has them. The _BeatUnit docstring change is wording.
  • The ported tests are #621's, case for case: the three new TestParseUnits tests, test_meters_can_be_hashed and test_quarter_length_is_exact. The lists-to-tuples changes in test_timemap_meters.py change no expected value.
  • Each commit passes on its own: 399, 402 and 404 tests at e5337b28, e2b1e6a8 and c6584d8f.
  • 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-prerelease has moved since this branch was cut (#731, the importers' setup), and no file under timemap changed. 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 units and beat_values are tuples, and beat_unit_id is str | None in both copies (WP9's data-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.

@azfoo
azfoo requested a review from FelipeDefensor October 14, 2026 12:56
@azfoo
azfoo merged commit b45fc94 into v1-prerelease Oct 14, 2026
26 checks passed
@azfoo
azfoo deleted the v1/247-units-copy branch October 14, 2026 14:15
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.

1 participant