Build Fix
ci / checks (push) Failing after 1h18m29s

This commit is contained in:
khodowany
2026-09-25 09:35:09 -05:00
parent 07559ad74c
commit 17326dbf56
34 changed files with 283 additions and 3723 deletions
+7 -4
View File
@@ -4,7 +4,6 @@ import copy
from fractions import Fraction
from typing import Any
SCHEMA_VERSION = 3
MAX_INTEGER = (1 << 63) - 1
NOTE_TYPES = ('maxima', 'long', 'breve', 'whole', 'half', 'quarter', 'eighth', '16th', '32nd', '64th', '128th', '256th', '512th', '1024th')
TYPE_LENGTHS = {name: Fraction(32, 2 ** index) for index, name in enumerate(NOTE_TYPES)}
@@ -141,11 +140,15 @@ def make_event(identifier: str, onset: Fraction, duration: Fraction, kind: str,
return event
def validate_document(document: dict) -> None:
if document.get('schema_version') != SCHEMA_VERSION:
raise ValueError('unsupported score schema; regenerate score assets with the current generator')
if not isinstance(document, dict) or not isinstance(document.get('metadata'), dict):
raise ValueError('score requires a metadata object')
if any(not isinstance(document['metadata'].get(name), str) for name in ('title', 'composer', 'key_signature', 'time_signature')):
raise ValueError('score metadata requires title, composer, key_signature and time_signature strings')
staves = document.get('staves', [])
if len(staves) != 1:
if not isinstance(staves, list) or len(staves) != 1 or not isinstance(staves[0], dict):
raise ValueError('exactly one staff is currently supported')
if not isinstance(staves[0].get('measures'), list) or not staves[0]['measures']:
raise ValueError('score requires measures')
instruments = staves[0].get('instruments', [])
instrument_ids = {i['id'] for i in instruments}
if len(instruments) != len(instrument_ids) or any(not isinstance(i, str) or not i for i in instrument_ids):