From 12b8b078eb1c50c48d6fc72626284d3a0e6612ee Mon Sep 17 00:00:00 2001 From: Johannes Hentschel Date: Sat, 2 Sep 2023 10:42:29 +0200 Subject: [PATCH] makes the rests facet evaluate to None if no rests are present in the score. This prevents the creation of frictionless schemas with wild column names for empty dataframes --- src/ms3/bs4_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ms3/bs4_parser.py b/src/ms3/bs4_parser.py index e7ba15fe..d1ddd1ea 100644 --- a/src/ms3/bs4_parser.py +++ b/src/ms3/bs4_parser.py @@ -2382,6 +2382,8 @@ def rests( DataFrame representing the :ref:`rests` of the MuseScore file. """ rests = self.rl() + if len(rests) == 0: + return None if unfold: rests = self.unfold_facet_df(rests, "rests") if rests is None: @@ -2815,7 +2817,7 @@ def perform_checks(self): metronome_mark_missing = False # here we could insert logic for treating incipit measure groups differently if metronome_mark_missing: - msg = "No metronome mark found in the very first measure" + msg = "No metronome mark found in the first measure" tempo_selector = (events.event == "Tempo").fillna(False) if tempo_selector.sum() == 0: msg += " nor anywhere else in the score."