@@ -285,3 +285,12 @@ def validate_document(document: dict) -> None:
|
||||
for span in staves[0].get('octave_shifts', []):
|
||||
if not 0 <= fraction(span['start']) < fraction(span['end']) <= absolute or not -3 <= span['octaves'] <= 3:
|
||||
raise ValueError('invalid octave-shift span')
|
||||
previous_end = fractions.Fraction()
|
||||
for span in staves[0].get('scale_spans', []):
|
||||
start, end = fraction(span['start']), fraction(span['end'])
|
||||
if not previous_end <= start < end <= absolute or not isinstance(span.get('label'), str) or not span['label'].strip() or type(span.get('matched')) is not bool:
|
||||
raise ValueError('invalid solo scale span')
|
||||
if not isinstance(span.get('id'), str) or not span['id'] or span['id'] in ids:
|
||||
raise ValueError('solo scale spans require unique IDs')
|
||||
ids.add(span['id'])
|
||||
previous_end = end
|
||||
|
||||
Reference in New Issue
Block a user