Skip to content

Commit

Permalink
fixup! Export
Browse files Browse the repository at this point in the history
fix possibly-used-before-assignment
  • Loading branch information
jacobtylerwalls committed Aug 3, 2024
1 parent b9861ad commit 08cd3db
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions music21/musicxml/m21ToXml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4103,12 +4103,13 @@ def noteToXml(self, n: note.GeneralNote, noteIndexInChord=0, chordParent=None):
n = t.cast(note.NotRest, n)
stemDirection = n.stemDirection

if stem_has_style := (chordOrN.hasStyleInformation
and isinstance(chordOrN.style, style.NoteStyle)
and chordOrN.style.stemStyle is not None):
note_style = chordOrN.style
stem_style = None
if (chordOrN.hasStyleInformation
and isinstance(chordOrN.style, style.NoteStyle)
and chordOrN.style.stemStyle is not None):
stem_style = chordOrN.style.stemStyle

if stemDirection is not None or stem_has_style:
if stemDirection is not None or stem_style:
mxStem = SubElement(mxNote, 'stem')
if stemDirection is None:
if closest_clef := chordOrN.getContextByClass(clef.Clef):
Expand All @@ -4120,9 +4121,9 @@ def noteToXml(self, n: note.GeneralNote, noteIndexInChord=0, chordParent=None):
if sdText == 'noStem':
sdText = 'none'
mxStem.text = sdText
if stem_has_style:
self.setColor(mxStem, note_style.stemStyle)
self.setPosition(mxStem, note_style.stemStyle)
if stem_style:
self.setColor(mxStem, stem_style)
self.setPosition(mxStem, stem_style)

# end Stem

Expand Down

0 comments on commit 08cd3db

Please sign in to comment.