From 1bc59ab7d668cc6277fdb8f8f527d99a86717d94 Mon Sep 17 00:00:00 2001 From: TimFelix <35711942+TimFelixBeyer@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:59:04 +0200 Subject: [PATCH] Fix linting --- music21/musicxml/test_xmlToM21.py | 5 +++-- music21/musicxml/xmlToM21.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/music21/musicxml/test_xmlToM21.py b/music21/musicxml/test_xmlToM21.py index b7194f1b0..dd252054d 100644 --- a/music21/musicxml/test_xmlToM21.py +++ b/music21/musicxml/test_xmlToM21.py @@ -1504,9 +1504,9 @@ def testImportImplicitMeasureNumber(self): m = s[stream.Measure].first() self.assertIs(m.showNumber, stream.enums.ShowNumber.NEVER) - def testAdjustTimeAttributesFromMeasure(self): + def testAdjustTimeAttributesFromMeasure(self): # Ignore import artifacts: - d = duration.Duration(3 + 3/480) + d = duration.Duration(3 + 3 / 480) m = stream.Measure([meter.TimeSignature('6/8'), note.Note(duration=d)]) PP = PartParser() PP.lastMeasureOffset = 21.0 @@ -1533,6 +1533,7 @@ def testAdjustTimeAttributesFromMeasure(self): PP.adjustTimeAttributesFromMeasure(m) self.assertEqual(PP.lastMeasureOffset, 25.0) + if __name__ == '__main__': import music21 music21.mainTest(Test) diff --git a/music21/musicxml/xmlToM21.py b/music21/musicxml/xmlToM21.py index b59625956..aaae96a7e 100644 --- a/music21/musicxml/xmlToM21.py +++ b/music21/musicxml/xmlToM21.py @@ -2198,15 +2198,17 @@ def adjustTimeAttributesFromMeasure(self, m: stream.Measure): tol = 1e-6 # If the measure is overfull by a "round" amount, assume that it was intended # otherwise it was likely the result of malformed MusicXML. - if (diff > 0.5 - or nearestMultiple(diff, 0.0625)[1] < tol - or nearestMultiple(diff, opFrac(1/12))[1] < tol): + if (diff > 0.5 + or nearestMultiple(diff, 0.0625)[1] < tol + or nearestMultiple(diff, opFrac(1 / 12))[1] < tol): mOffsetShift = mHighestTime else: mOffsetShift = lastTimeSignatureQuarterLength - warnings.warn(f"""Warning: measure {m.number} in part {self.stream.partName} - is overfull: {mHighestTime} > {lastTimeSignatureQuarterLength}, - assuming {mOffsetShift} is correct.""") + warnings.warn( + f"Warning: measure {m.number} in part {self.stream.partName}" + f"is overfull: {mHighestTime} > {lastTimeSignatureQuarterLength}," + f"assuming {mOffsetShift} is correct." + ) elif (mHighestTime == 0.0 and not m.recurse().notesAndRests.getElementsNotOfClass('Harmony') ):