Skip to content

Commit

Permalink
restore parts I wanted restored.
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Jan 2, 2024
1 parent 40c5bba commit f006111
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions music21/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,16 @@ def removeSandwichedUnbeamables(beamsList: list[Beams | None]):
None,
None]
'''
for i in range(0, len(beamsList)):
previousBeamIsNone = (i == 0 or beamsList[i - 1] is None)
nextBeamIsNone = (i + 1 == len(beamsList) or beamsList[i + 1] is None)
if previousBeamIsNone and nextBeamIsNone:
beamLast = None
for i in range(len(beamsList)):
if i != len(beamsList) - 1:
beamNext = beamsList[i + 1]
else:
beamNext = None
if beamLast is None and beamNext is None:
beamsList[i] = None
beamLast = beamsList[i]

return beamsList

@staticmethod
Expand Down
8 changes: 5 additions & 3 deletions music21/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2782,9 +2782,11 @@ def _isStandardUniqueName(self, uniqueName: str) -> bool:
>>> rmd._isStandardUniqueName('average duration')
False
'''
return (super()._isStandardUniqueName(uniqueName)
or uniqueName in self.additionalRichMetadataAttributes)

if super()._isStandardUniqueName(uniqueName):
return True
if uniqueName in self.additionalRichMetadataAttributes:
return True
return False

# -----------------------------------------------------------------------------
# tests are in test/test_metadata
Expand Down
5 changes: 4 additions & 1 deletion music21/musicxml/xmlToM21.py
Original file line number Diff line number Diff line change
Expand Up @@ -5966,7 +5966,10 @@ def nonTraditionalKeySignature(self, mxKey):
for step, alter, accidental in zip(steps, alters, accidentals):
p = pitch.Pitch(step)
if accidental is not None:
accidentalName = self.mxAccidentalNameToM21.get(accidental, accidental)
if accidental in self.mxAccidentalNameToM21:
accidentalName = self.mxAccidentalNameToM21[accidental]
else:
accidentalName = accidental
p.accidental = pitch.Accidental(accidentalName)
p.accidental.alter = alter
else:
Expand Down

0 comments on commit f006111

Please sign in to comment.