Repository navigation
feat(core): move the beat pattern parser into tilia_core.timemap - #739
Merged
Merged
Conversation
Moved from tilia/timelines/beat/pattern.py (desktop#621), unchanged: the file is the same blob as at 0ee8ea4, 07cb6d4 and a17bbd8. It sits next to units.py, the other module from #621. The beat importer and adding a beat timeline will call it, and so will the app's beat timeline, its validators and the beat pattern dialog once the app uses the core's copy. Its tests move to test_timemap_pattern.py with only the import changed. Part of TimeLineAnnotator/project-management#270 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The moved tests cover parse and group_runs only. format_bars is what the beat importer stores as a timeline's beat pattern, so its runs, its flattening of nested groups and its round trip through parse are tested here. Part of TimeLineAnnotator/project-management#270 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
azfoo
force-pushed
the
v1/270-beat-pattern
branch
from
October 14, 2026 17:42
71a890e to
775e203
Compare
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
Moves #621 (beat units and time signatures)'s beat pattern parser into the core, for the beat importer and for adding a beat timeline.
What changed
packages/tilia-core/src/tilia_core/timemap/pattern.py:tilia/timelines/beat/pattern.pyfrom feat: beat patterns, beat units, time signatures and quarter stamps #621, unchanged (the same blob,236c76e5, atfeat/beat-unit's head0ee8ea45, at07cb6d4fand ata17bbd83). It sits next tounits.py, the other module from feat: beat patterns, beat units, time signatures and quarter stamps #621: the beat importer and adding a beat timeline will call it, and so will the app's beat timeline, its validators and the beat pattern dialog once the app imports the core's copy. It imports nothing from the app and doesn't log, so nothing had to change. The app keeps its own copy until it switches to the core's.packages/tilia-core/tests/timemap/test_timemap_pattern.py: feat: beat patterns, beat units, time signatures and quarter stamps #621'stests/timelines/beat/test_pattern.py, with only the import changed (first commit), plus aTestFormatBarsclass (second commit): runs collapsed, nested groups not recovered, andparse(format_bars(bars))giving the same bars back. The moved tests coverparseandgroup_runsonly.Tests
uv run --package tilia-core pytest packages/tilia-core -q, on the currentv1-prerelease: 794 passed, 21 skipped, 8 xfailed (Python 3.11), 55 of them intest_timemap_pattern.py.python scripts/check_packages.py: all package checks passed (both wheels, fresh installs without PySide6 or the app, both test suites), on the currentv1-prerelease.ruff checkandblack --checkon both files: clean.Guards: what removing each one does
Each check neutralised in turn, the pattern tests run, the file restored (its blob checked afterwards). Run on the module and tests as they are here:
MAX_BARS, after each item (parse_items)MAX_BARS, before a group is repeated (parse_item)MAX_DEPTHMAX_DIGITS_DIGITS, notstr.isdigit)format_barscollapsing runsUntested: the check before a group is repeated, the one that keeps
999999[999999[4]]from exhausting memory. Without it,999999999[999999999[4]]is still refused by the check after each item, but only once the list of 999,999,999 bars is built (22 s and several GB here), so every test passes. The same holds for #621's own tests. A cheap test that fails without it is TimeLineAnnotator/project-management#301 (test the large-group guard); it isn't in this PR, which moves the code and its tests as they are.Part of TimeLineAnnotator/project-management#270
🤖 Generated with Claude Code