diff --git a/music21/abcFormat/__init__.py b/music21/abcFormat/__init__.py index be1a21ce9..73ce4495c 100644 --- a/music21/abcFormat/__init__.py +++ b/music21/abcFormat/__init__.py @@ -1768,7 +1768,11 @@ def __init__(self, src: str = ''): # store a list of component objects self.subTokens: list[ABCToken] = [] - def parse(self, forceKeySignature=None, forceDefaultQuarterLength=None): + def parse( + self, + forceDefaultQuarterLength: float|None = None, + forceKeySignature: key.KeySignature|None = None + ): ''' Handles the following types of chords: @@ -1803,6 +1807,7 @@ def parse(self, forceKeySignature=None, forceDefaultQuarterLength=None): outer_lengthModifier = self.getQuarterLength(outerLengthModifierStr, forceDefaultQuarterLength=1.0) + activeKeySignature: key.KeySignature|None if forceKeySignature is not None: activeKeySignature = forceKeySignature else: # may be None @@ -1815,7 +1820,7 @@ def parse(self, forceKeySignature=None, forceDefaultQuarterLength=None): # may need to supply key? ah.tokenize(tokenStr) - inner_quarterLength = 0 + inner_quarterLength: OffsetQL = 0.0 # tokens contained here are each ABCNote instances for token in ah.tokens: # environLocal.printDebug(['ABCChord: subTokens', t]) @@ -2631,10 +2636,10 @@ def tokenProcess(self) -> None: # notes within slur marks need to be added to the spanner if isinstance(token, ABCSlurStart): token.fillSlur() + slurObj = token.slurObj if t.TYPE_CHECKING: - assert token.slurObj is not None - - self.activeSpanners.append(token.slurObj) + assert slurObj is not None + self.activeSpanners.append(slurObj) self.activeParens.append('Slur') elif isinstance(token, ABCParenStop): if self.activeParens: @@ -2951,10 +2956,10 @@ def definesMeasures(self): Returns True if this token structure defines Measures in a normal Measure form. Otherwise False - >>> abcStr = ('M:6/8\\nL:1/8\\nK:G\\nV:1 name="Whistle" ' + - ... 'snm="wh"\\nB3 A3 | G6 | B3 A3 | G6 ||\\nV:2 name="violin" ' + - ... 'snm="v"\\nBdB AcA | GAG D3 | BdB AcA | GAG D6 ||\\nV:3 name="Bass" ' + - ... 'snm="b" clef=bass\\nD3 D3 | D6 | D3 D3 | D6 ||') + >>> abcStr = ('M:6/8\\nL:1/8\\nK:G\\nV:1 name="Whistle" ' + ... 'snm="wh"\\nB3 A3 | G6 | B3 A3 | G6 ||\\nV:2 name="violin" ' + ... 'snm="v"\\nBdB AcA | GAG D3 | BdB AcA | GAG D6 ||\\nV:3 name="Bass" ' + ... 'snm="b" clef=bass\\nD3 D3 | D6 | D3 D3 | D6 ||') >>> ah = abcFormat.ABCHandler() >>> junk = ah.process(abcStr) >>> ah.definesMeasures() @@ -2989,10 +2994,10 @@ def splitByVoice(self) -> list[ABCHandler]: Each part is returned as a ABCHandler instance. - >>> abcStr = ('M:6/8\\nL:1/8\\nK:G\\nV:1 name="Whistle" ' + - ... 'snm="wh"\\nB3 A3 | G6 | B3 A3 | G6 ||\\nV:2 name="violin" ' + - ... 'snm="v"\\nBdB AcA | GAG D3 | BdB AcA | GAG D6 ||\\nV:3 name="Bass" ' + - ... 'snm="b" clef=bass\\nD3 D3 | D6 | D3 D3 | D6 ||') + >>> abcStr = ('M:6/8\\nL:1/8\\nK:G\\nV:1 name="Whistle" ' + ... 'snm="wh"\\nB3 A3 | G6 | B3 A3 | G6 ||\\nV:2 name="violin" ' + ... 'snm="v"\\nBdB AcA | GAG D3 | BdB AcA | GAG D6 ||\\nV:3 name="Bass" ' + ... 'snm="b" clef=bass\\nD3 D3 | D6 | D3 D3 | D6 ||') >>> ah = abcFormat.ABCHandler() >>> ah.process(abcStr) >>> tokenColls = ah.splitByVoice() diff --git a/music21/alpha/analysis/search.py b/music21/alpha/analysis/search.py index 209ea469b..fc43cb99b 100644 --- a/music21/alpha/analysis/search.py +++ b/music21/alpha/analysis/search.py @@ -187,8 +187,8 @@ def findConsecutiveScale(source, targetScale, degreesRequired=5, stepSize=1, comparisonAttribute=comparisonAttribute): pass - # environLocal.printDebug(['matched degree count but next pitch is ' + - # 'in scale and direction', 'collDegrees', collDegrees]) + # environLocal.printDebug(['matched degree count but next pitch is ' + # + 'in scale and direction', 'collDegrees', collDegrees]) else: # environLocal.printDebug(['matched degree count', 'collDegrees', collDegrees, # 'pNext', pNext]) diff --git a/music21/analysis/reduction.py b/music21/analysis/reduction.py index e850be322..56bbadb4c 100644 --- a/music21/analysis/reduction.py +++ b/music21/analysis/reduction.py @@ -615,11 +615,10 @@ def _createEventSpans(self): # eLast = partMeasures[0][i] # # use duration, not barDuration.quarterLength # # as want filled duration? - # eEnd = (eLast.getOffsetBySite( - # partMeasures[0]) + - # eLast.barDuration.quarterLength) - # ds = {'eStart':eStart, 'span':eEnd-eStart, - # 'weight':None, 'color':pColor} + # eEnd = (eLast.getOffsetBySite(partMeasures[0]) + # + eLast.barDuration.quarterLength) + # ds = {'eStart': eStart, 'span': eEnd - eStart, + # 'weight': None, 'color': pColor} # dataEvents.append(ds) # eStart = None # eLast = partMeasures[0][i] diff --git a/music21/base.py b/music21/base.py index 1927faaab..563c494e7 100644 --- a/music21/base.py +++ b/music21/base.py @@ -2447,8 +2447,8 @@ def _setActiveSite(self, site: stream.Stream|None): self._activeSiteStoredOffset = storedOffset # siteId = id(site) # if not self.sites.hasSiteId(siteId): # This should raise a warning, should not happen - # # environLocal.warn('Adding a siteDict entry for a ' + - # # 'site that should already be there!') + # # environLocal.warn('Adding a siteDict entry for a ' + # # 'site that should already be there!') # self.sites.add(site, idKey=siteId) else: self._activeSiteStoredOffset = None diff --git a/music21/capella/fromCapellaXML.py b/music21/capella/fromCapellaXML.py index c4f94a4bc..c1ecbdf57 100644 --- a/music21/capella/fromCapellaXML.py +++ b/music21/capella/fromCapellaXML.py @@ -148,7 +148,7 @@ def domElementFromText(self, xmlText=None): >>> ci = capella.fromCapellaXML.CapellaImporter() >>> funnyTag = ci.domElementFromText( - ... 'hiha' + + ... 'hiha' ... '') >>> funnyTag @@ -441,7 +441,7 @@ def chordOrNoteFromChord(self, chordElement): This one is an actual chord >>> chordElement = ci.domElementFromText( - ... '' + + ... '' ... '') >>> c = ci.chordOrNoteFromChord(chordElement) >>> c @@ -615,7 +615,7 @@ def lyricListFromLyric(self, lyricElement): >>> ci = capella.fromCapellaXML.CapellaImporter() >>> lyricEl = ci.domElementFromText( - ... 'di' + + ... 'di' ... 'man,frau,') >>> ci.lyricListFromLyric(lyricEl) [, diff --git a/music21/converter/__init__.py b/music21/converter/__init__.py index c1602addd..90859086a 100644 --- a/music21/converter/__init__.py +++ b/music21/converter/__init__.py @@ -749,7 +749,7 @@ def parseURL( re-reading from a cached file. >>> joplinURL = ('https://github.com/cuthbertLab/music21/raw/master' - ... + '/music21/corpus/joplin/maple_leaf_rag.mxl') + ... '/music21/corpus/joplin/maple_leaf_rag.mxl') >>> c = converter.Converter() >>> #_DOCS_SHOW c.parseURL(joplinURL) >>> #_DOCS_SHOW joplinStream = c.stream @@ -2130,8 +2130,8 @@ def testMEIvsMX(self): # These strings aren't valid documents, but they are enough to pass the detection we're # testing in parseData(). But it does mean we'll be testing in a strange way. meiString = '' - # mxlString = ('' + - # '') + # mxlString = ('' + # '') # The "mei" module raises an MeiElementError with "meiString," so as long as that's raised, # we know that parseData() chose correctly. diff --git a/music21/converter/subConverters.py b/music21/converter/subConverters.py index 540c1ae8a..296dbada2 100644 --- a/music21/converter/subConverters.py +++ b/music21/converter/subConverters.py @@ -631,8 +631,8 @@ def parseData(self, humdrumString, number=None): Open Humdrum data from a string -- calls :meth:`~music21.humdrum.spineParser.HumdrumDataCollection.parse()`. - >>> humData = ('**kern\\n*M2/4\\n=1\\n24r\\n24g#\\n24f#\\n24e\\n24c#\\n' + - ... '24f\\n24r\\n24dn\\n24e-\\n24gn\\n24e-\\n24dn\\n*-') + >>> humData = ('**kern\\n*M2/4\\n=1\\n24r\\n24g#\\n24f#\\n24e\\n24c#\\n' + ... '24f\\n24r\\n24dn\\n24e-\\n24gn\\n24e-\\n24dn\\n*-') >>> c = converter.subConverters.ConverterHumdrum() >>> s = c.parseData(humData) >>> c.stream.show('text') @@ -762,8 +762,8 @@ def parseData(self, nwcData): r''' Open Noteworthy data from a string or list - >>> nwcData = ('!NoteWorthyComposer(2.0)\n|AddStaff\n|Clef|' + - ... 'Type:Treble\n|Note|Dur:Whole|Pos:1^') + >>> nwcData = ('!NoteWorthyComposer(2.0)\n|AddStaff\n|Clef|' + ... 'Type:Treble\n|Note|Dur:Whole|Pos:1^') >>> c = converter.subConverters.ConverterNoteworthy() >>> c.parseData(nwcData) >>> c.stream.show('text') diff --git a/music21/corpus/testCorpus.py b/music21/corpus/testCorpus.py index 04993128b..e6f1092c1 100644 --- a/music21/corpus/testCorpus.py +++ b/music21/corpus/testCorpus.py @@ -155,8 +155,8 @@ def testSearch10(self): # self.assertGreater(len(searchResults), 0) # # returns items in pairs: url and work number # self.assertEqual(searchResults[0].sourcePath, - # 'http://impromastering.com/uploads/transcription_file/' + - # 'file/196/Giant_Steps__John_Coltrane_C.xml') + # 'http://impromastering.com/uploads/transcription_file/' + # + 'file/196/Giant_Steps__John_Coltrane_C.xml') # def testGetWorkList(self): # self.assertGreaterEqual(len(corpus.corpora.CoreCorpus().getPaths('.md')), 38) diff --git a/music21/harmony.py b/music21/harmony.py index 245ae3995..1032d78ef 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -297,8 +297,8 @@ def _updateFromParameters( but we want the objects to retain their initial root, bass, and inversion. ''' if root and isinstance(root, str): - root = common.cleanedFlatNotation(root) - self.root(pitch.Pitch(root, octave=3)) + root_str = common.cleanedFlatNotation(root) + self.root(pitch.Pitch(root_str, octave=3)) elif root is not None: self.root(root) @@ -308,8 +308,8 @@ def _updateFromParameters( # and then bass. if bass and isinstance(bass, str): - bass = common.cleanedFlatNotation(bass) - self.bass(pitch.Pitch(bass, octave=3), allow_add=True) + bass_str = common.cleanedFlatNotation(bass) + self.bass(pitch.Pitch(bass_str, octave=3), allow_add=True) elif bass is not None: self.bass(bass, allow_add=True) @@ -2267,9 +2267,9 @@ def findFigure(self): >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> elStr = (r'Cdominant' + - ... '9-1' + - ... ' add') + >>> elStr = ('Cdominant' + ... '9-1' + ... ' add') >>> mxHarmony = EL(elStr) >>> cs = MP.xmlToChordSymbol(mxHarmony) @@ -2283,10 +2283,10 @@ def findFigure(self): , ) - >>> elStr = (r'Cmajor' + - ... 'B-1' + - ... '20' + - ... ' add') + >>> elStr = ('Cmajor' + ... 'B-1' + ... '20' + ... ' add') >>> mxHarmony = EL(elStr) >>> cs = MP.xmlToChordSymbol(mxHarmony) @@ -2682,8 +2682,13 @@ def testHarmonyPreservesInversionAndBass(self): self.assertEqual(explicitFm6.inversion(), 1) self.assertEqual(explicitFm6.bass(find=False).name, 'A-') self.assertEqual(explicitFm6.root(find=False).name, 'F') - self.assertLess(explicitFm6.bass(find=False).octave, - explicitFm6.root(find=False).octave) + fm6bassOctave = explicitFm6.bass(find=False).octave + fm6rootOctave = explicitFm6.root(find=False).octave + self.assertIsNotNone(fm6bassOctave) + self.assertIsNotNone(fm6rootOctave) + assert fm6bassOctave is not None + assert fm6rootOctave is not None + self.assertLess(fm6bassOctave, fm6rootOctave) def testClassSortOrderHarmony(self): ''' @@ -2836,7 +2841,6 @@ def runTestOnChord(self, xmlString, figure, pitches): self.assertEqual(cs1.bass(), cs3.bass()) def testChordWithBass(self): - xmlString = ''' diff --git a/music21/humdrum/spineParser.py b/music21/humdrum/spineParser.py index 2a5630426..12b9a99a6 100644 --- a/music21/humdrum/spineParser.py +++ b/music21/humdrum/spineParser.py @@ -377,10 +377,10 @@ def parseEventListFromDataStream( Returns eventList in addition to setting it as `self.eventList`. - >>> eventString = ('!!! COM: Beethoven, Ludwig van\n' + - ... '!! Not really a piece by Beethoven\n' + - ... '**kern\t**dynam\n' + - ... 'C4\tpp\n' + + >>> eventString = ('!!! COM: Beethoven, Ludwig van\n' + ... '!! Not really a piece by Beethoven\n' + ... '**kern\t**dynam\n' + ... 'C4\tpp\n' ... 'D8\t.\n') >>> hdc = humdrum.spineParser.HumdrumDataCollection(eventString) >>> hdc.maxSpines = 2 @@ -459,10 +459,10 @@ def parseProtoSpinesAndEventCollections( Returns a tuple of protoSpines and eventCollections in addition to setting it in the calling object. - >>> eventString = ('!!!COM: Beethoven, Ludwig van\n' + - ... '!! Not really a piece by Beethoven\n' + - ... '**kern\t**dynam\n' + - ... 'C4\tpp\n' + + >>> eventString = ('!!!COM: Beethoven, Ludwig van\n' + ... '!! Not really a piece by Beethoven\n' + ... '**kern\t**dynam\n' + ... 'C4\tpp\n' ... 'D8\t.\n') >>> hdc = humdrum.spineParser.HumdrumDataCollection(eventString) >>> hdc.maxSpines = 2 @@ -784,11 +784,11 @@ def insertGlobalEvents(self) -> None: # if self.spineCollection is None: # raise HumdrumException('parsing got no spine collections!') # elif self.spineCollection.spines is None: - # raise HumdrumException('not a single spine in your data. Is this your problem? ' + - # '(File a bug report if you ' + + # raise HumdrumException('not a single spine in your data. Is this your problem? ' + # '(File a bug report if you ' # 'have doubled checked your data)') # elif self.spineCollection.spines[0].stream is None: - # raise HumdrumException('okay, you got at least one spine, but it does not have ' + + # raise HumdrumException('okay, you got at least one spine, but it does not have ' # 'a stream in it; (check your data or file a bug report)') # else: # masterStream = stream.Score() @@ -2400,7 +2400,7 @@ def hdStringToNote(contents: str) -> note.GeneralNote: elif '\\' in contents: thisObject.stemDirection = 'down' - # 3.2.7 Duration + + # 3.2.7 Duration and # 3.2.8 N-Tuplets # TODO: SPEEDUP -- only search for rational after foundNumber. diff --git a/music21/instrument.py b/music21/instrument.py index 43e2c7e45..5a9a77550 100644 --- a/music21/instrument.py +++ b/music21/instrument.py @@ -315,7 +315,7 @@ def autoAssignMidiChannel(self, usedChannels: list[int], maxMidi=16): self.midiChannel = ch return self.midiChannel return 0 - # raise InstrumentException('we are out of midi channels and this ' + + # raise InstrumentException('we are out of midi channels and this ' # 'was not already detected PROGRAM BUG!') diff --git a/music21/interval.py b/music21/interval.py index 821ab6af5..ae3129d6c 100644 --- a/music21/interval.py +++ b/music21/interval.py @@ -3492,7 +3492,7 @@ def _diatonicTransposePitch(self, # pitchAlt = copy.deepcopy(pitch2) # pitchAlt.ps = pitch2.ps + halfStepsToFix # environLocal.printDebug( - # 'coercing pitch due to a transposition that requires an extreme ' + + # 'coercing pitch due to a transposition that requires an extreme ' # f'accidental: {pitch2} -> {pitchAlt}') # pitch2 = pitchAlt pitch2.ps = pitch2.ps + halfStepsToFix diff --git a/music21/layout.py b/music21/layout.py index 3f0f75851..9bd20b273 100644 --- a/music21/layout.py +++ b/music21/layout.py @@ -999,8 +999,8 @@ def getPositionForStaff(self, pageId, systemId, staffId): >>> ls.getPositionForStaff(1, 0, 0) (0.0, 40.0) - The second staff (staff 1) begins at the end of staff 0 (40.0) + - the appropriate staffDistance + The second staff (staff 1) begins at the end of + staff 0 (40.0) plus the appropriate staffDistance and adds the height of the staff. Staff 1 here has a size of 80 which means 80% of the normal staff size. 40 * 0.8 = 32.0: diff --git a/music21/mei/base.py b/music21/mei/base.py index c4e2b3b1e..ead4acb67 100644 --- a/music21/mei/base.py +++ b/music21/mei/base.py @@ -447,8 +447,8 @@ def allPartsPresent(scoreElem) -> tuple[str, ...]: ... ... ... """ - >>> import xml.etree.ElementTree as ETree - >>> meiDoc = ETree.fromstring(meiDoc) + >>> from xml.etree.ElementTree import fromstring as EL + >>> meiDoc = EL(meiDoc) >>> mei.base.allPartsPresent(meiDoc) ('1', '2') diff --git a/music21/musedata/__init__.py b/music21/musedata/__init__.py index 9f5522d81..941fc5e9c 100644 --- a/music21/musedata/__init__.py +++ b/music21/musedata/__init__.py @@ -1592,11 +1592,11 @@ def addString(self, input_str): Add a string representation acting like a part file >>> mdw = musedata.MuseDataWork() - >>> mdw.addString('WK#:581 MV#:3c\nBreitkopf & Hartel, Vol. 13\n' + - ... 'Clarinet Quintet\n' + - ... 'Trio II\n' + - ... '$ K:0 Q:6 T:3/4 X:-11 C:4\n' + - ... 'C5 3 e d [ (&0p\n' + + >>> mdw.addString('WK#:581 MV#:3c\nBreitkopf & Hartel, Vol. 13\n' + ... 'Clarinet Quintet\n' + ... 'Trio II\n' + ... '$ K:0 Q:6 T:3/4 X:-11 C:4\n' + ... 'C5 3 e d [ (&0p\n' ... 'E5 3 e d ]') # TODO: Okay, so what? did we test this or demo anything? diff --git a/music21/musicxml/helpers.py b/music21/musicxml/helpers.py index 5d35712ac..804cb0c7c 100644 --- a/music21/musicxml/helpers.py +++ b/music21/musicxml/helpers.py @@ -115,10 +115,10 @@ def insertBeforeElements(root, insert, tagList=None): of any instance of a child tag given in `tagList`. Append the element if `tagList` is `None`. - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> from music21.musicxml.helpers import insertBeforeElements, dump - >>> root = El('G4') - >>> insert = El('') + >>> root = EL('G4') + >>> insert = EL('') >>> insertBeforeElements(root, insert, tagList=['line']) >>> dump(root) @@ -130,7 +130,7 @@ def insertBeforeElements(root, insert, tagList=None): Now insert another element at the end by not specifying a tag list: - >>> insert2 = El('') + >>> insert2 = EL('') >>> insertBeforeElements(root, insert2) >>> dump(root) @@ -214,8 +214,8 @@ def synchronizeIdsToM21(element: ET.Element, m21Object: Music21Object): bye - >>> from xml.etree.ElementTree import fromstring as El - >>> e = El('') + >>> from xml.etree.ElementTree import fromstring as EL + >>> e = EL('') >>> f = expressions.Fermata() >>> musicxml.helpers.synchronizeIdsToM21(e, f) >>> f.id @@ -223,7 +223,7 @@ def synchronizeIdsToM21(element: ET.Element, m21Object: Music21Object): Does not change the id if the id is not specified: - >>> e = El('') + >>> e = EL('') >>> f = expressions.Fermata() >>> f.id = 'doNotOverwrite' >>> musicxml.helpers.synchronizeIdsToM21(e, f) @@ -245,8 +245,8 @@ def synchronizeIdsToXML( on many elements which is perfect for getting from .id on a music21 element. - >>> from xml.etree.ElementTree import fromstring as El - >>> e = El('') + >>> from xml.etree.ElementTree import fromstring as EL + >>> e = EL('') >>> f = expressions.Fermata() >>> f.id = 'fermata1' >>> musicxml.helpers.synchronizeIdsToXML(e, f) @@ -255,7 +255,7 @@ def synchronizeIdsToXML( Does not set attr: id if el.id is not valid or default: - >>> e = El('') + >>> e = EL('') >>> f = expressions.Fermata() >>> musicxml.helpers.synchronizeIdsToXML(e, f) >>> e.get('id', None) is None @@ -267,7 +267,7 @@ def synchronizeIdsToXML( None can be passed in instead of a m21object. - >>> e = El('') + >>> e = EL('') >>> musicxml.helpers.synchronizeIdsToXML(e, None) >>> e.get('id', 'no idea') 'no idea' @@ -304,8 +304,8 @@ def setM21AttributeFromAttribute( Pass a function or lambda function as transform to transform the value before setting it - >>> from xml.etree.ElementTree import fromstring as El - >>> e = El('') + >>> from xml.etree.ElementTree import fromstring as EL + >>> e = EL('') >>> setb = musicxml.helpers.setM21AttributeFromAttribute >>> pl = layout.PageLayout() @@ -356,8 +356,8 @@ def setXMLAttributeFromAttribute( Pass a function or lambda function as transform to transform the value before setting it - >>> from xml.etree.ElementTree import fromstring as El - >>> e = El('') + >>> from xml.etree.ElementTree import fromstring as EL + >>> e = EL('') >>> setb = musicxml.helpers.setXMLAttributeFromAttribute >>> pl = layout.PageLayout() diff --git a/music21/musicxml/m21ToXml.py b/music21/musicxml/m21ToXml.py index aaa6efb7f..0ec9ff7f1 100644 --- a/music21/musicxml/m21ToXml.py +++ b/music21/musicxml/m21ToXml.py @@ -903,9 +903,9 @@ def setFont(self, mxObject, m21Object): conforms to attr-group %font in the MusicXML DTD - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> XB = musicxml.m21ToXml.XMLExporterBase() - >>> mxObj = El('hi') + >>> mxObj = EL('hi') >>> te = expressions.TextExpression('hi!') >>> te.style.fontFamily = ['Courier', 'monospaced'] >>> te.style.fontStyle = 'italic' @@ -915,7 +915,7 @@ def setFont(self, mxObject, m21Object): hi >>> XB = musicxml.m21ToXml.XMLExporterBase() - >>> mxObj = El('hi') + >>> mxObj = EL('hi') >>> te = expressions.TextExpression('hi!') >>> te.style.fontStyle = 'bold' >>> XB.setFont(mxObj, te) @@ -964,9 +964,9 @@ def setPosition(self, mxObject, m21Object): def setEditorial(self, mxObject, m21Object): ''' - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> XB = musicxml.m21ToXml.XMLExporterBase() - >>> mxObj = El('') + >>> mxObj = EL('') >>> n = note.Note('C-5') Most common case: does nothing @@ -988,7 +988,7 @@ def setEditorial(self, mxObject, m21Object): Placing information in `.editorial.comments` only puts out the level: - >>> mxObj = El('') + >>> mxObj = EL('') >>> n = note.Note('C-5') >>> com = editorial.Comment('flat is obvious error for sharp') >>> com.levelInformation = 'hello' @@ -1927,14 +1927,17 @@ def addStyleToXmlDefaults(self, mxDefaults): Demonstrating round tripping: >>> import xml.etree.ElementTree as ET - >>> defaults = ET.fromstring('' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '') + >>> from xml.etree.ElementTree import fromstring as EL + >>> defaults = ET.fromstring( + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... ) >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> MI.styleFromXmlDefaults(defaults) diff --git a/music21/musicxml/partStaffExporter.py b/music21/musicxml/partStaffExporter.py index 3e33da48d..f9d8213f8 100644 --- a/music21/musicxml/partStaffExporter.py +++ b/music21/musicxml/partStaffExporter.py @@ -39,10 +39,10 @@ def addStaffTags( For a tag `measure`, add a grandchild to any instance of a child tag of a type in `tagList`. - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> from music21.musicxml.partStaffExporter import addStaffTags >>> from music21.musicxml.helpers import dump - >>> elem = El(""" + >>> elem = EL(""" ... ... ... @@ -681,17 +681,17 @@ def cleanUpSubsequentPartStaffs(self, group: StaffGroup): def moveMeasureContents(measure: Element, otherMeasure: Element, staffNumber: int): # noinspection PyShadowingNames ''' - Move the child elements of `measure` into `otherMeasure`; - create voice numbers if needed; - bump voice numbers if they conflict; - account for and tags; - skip tags; - set "number" on midmeasure clef changes; - replace existing tags. - - >>> from xml.etree.ElementTree import fromstring as El - >>> measure = El('') - >>> otherMeasure = El('') + Move the child elements of `measure` into `otherMeasure`. + Create voice numbers if needed. + Bump voice numbers if they conflict. + Account for and tags. + Skip tags. + Set "number" on mid-measure clef changes. + Replace existing tags. + + >>> from xml.etree.ElementTree import fromstring as EL + >>> measure = EL('') + >>> otherMeasure = EL('') >>> SX = musicxml.m21ToXml.ScoreExporter >>> SX.moveMeasureContents(measure, otherMeasure, 2) >>> SX().dump(otherMeasure) @@ -704,12 +704,12 @@ def moveMeasureContents(measure: Element, otherMeasure: Element, staffNumber: in - >>> SX.moveMeasureContents(El(''), otherMeasure, 2) + >>> SX.moveMeasureContents(EL(''), otherMeasure, 2) Traceback (most recent call last): music21.musicxml.xmlObjects.MusicXMLExportException: moveMeasureContents() called on should be exported per merged measure: + Only one `` should be exported per merged measure: >>> from music21.musicxml import testPrimitive >>> s = converter.parse(testPrimitive.mixedVoices1a) diff --git a/music21/musicxml/xmlToM21.py b/music21/musicxml/xmlToM21.py index b1904d4e3..e7531fb75 100644 --- a/music21/musicxml/xmlToM21.py +++ b/music21/musicxml/xmlToM21.py @@ -279,9 +279,9 @@ def setStyleAttributes(self, mxObject, m21Object, musicXMLNames, m21Names=None): a list/tuple of m21Names, and assigns each of the mxObject's attributes that fits this style name to the corresponding style object's m21Name attribute. - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> XP = musicxml.xmlToM21.XMLParserBase() - >>> mxObj = El('') + >>> mxObj = EL('') >>> m21Obj = base.Music21Object() >>> musicXMLNames = ('w', 'x', 'y', 'z') >>> m21Names = ('justify', 'absoluteX', 'absoluteY', 'hideObjectOnPrint') @@ -422,10 +422,10 @@ def setFont(self, mxObject, m21Object): conforms to attr-group %font in the MusicXML DTD - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> XP = musicxml.xmlToM21.XMLParserBase() - >>> mxObj = El('') + >>> mxObj = EL('') >>> te = expressions.TextExpression('hi!') >>> XP.setFont(mxObj, te) @@ -474,9 +474,9 @@ def setEditorial(self, mxObj, m21Obj): ''' Set editorial information from an mxObj - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> XP = musicxml.xmlToM21.XMLParserBase() - >>> mxObj = El('') + >>> mxObj = EL('') >>> n = note.Note('C#4') Most common case: @@ -485,8 +485,8 @@ def setEditorial(self, mxObj, m21Obj): >>> n.hasEditorialInformation False - >>> mxObj = El('Sharp is conjectural' - ... + '2') + >>> mxObj = EL('Sharp is conjectural' + ... '2') >>> XP.setEditorial(mxObj, n) >>> n.hasEditorialInformation True @@ -505,7 +505,7 @@ def setEditorial(self, mxObj, m21Obj): If no tag exists, the editorial information will be found in comments: - >>> mxObj = El('ed') + >>> mxObj = EL('ed') >>> n = note.Note('C#4') >>> XP.setEditorial(mxObj, n) >>> len(n.editorial.footnotes) @@ -554,14 +554,16 @@ def xmlPrintToPageLayout(self, mxPrint, inputM21=None): Given an mxPrint object, set object data for the print section of a layout.PageLayout object - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxPrint = El('' - ... + ' 4000' - ... + ' 20' - ... + ' 30.25' - ... + '') + >>> mxPrint = EL( + ... '' + ... ' 4000' + ... ' 20' + ... ' 30.25' + ... '' + ... ) >>> pl = MP.xmlPrintToPageLayout(mxPrint) >>> pl.isNew @@ -624,14 +626,16 @@ def xmlPrintToSystemLayout(self, mxPrint, inputM21=None): ''' Given an mxPrint object, set object data - >>> from xml.etree.ElementTree import fromstring as El + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxPrint = El('' - ... + ' 55' - ... + ' 20' - ... + ' 30.25' - ... + '') + >>> mxPrint = EL( + ... '' + ... ' 55' + ... ' 20' + ... ' 30.25' + ... '' + ... ) >>> sl = MP.xmlPrintToSystemLayout(mxPrint) >>> sl.isNew True @@ -929,9 +933,8 @@ def xmlCreditToTextBox(self, mxCredit): ''' Convert a MusicXML credit to a music21 TextBox - >>> import xml.etree.ElementTree as ET - >>> credit = ET.fromstring( - ... 'Testing') + >>> from xml.etree.ElementTree import fromstring as EL + >>> credit = EL('Testing') >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> tb = MI.xmlCreditToTextBox(credit) @@ -942,9 +945,9 @@ def xmlCreditToTextBox(self, mxCredit): OMIT_FROM_DOCS - Capella generates empty credit-words + Capella generates empty credit-words. Make sure they do not crash. - >>> credit = ET.fromstring('') + >>> credit = EL('') >>> tb = MI.xmlCreditToTextBox(credit) >>> tb @@ -1025,15 +1028,17 @@ def styleFromXmlDefaults(self, mxDefaults): Here the demo does not include the tag since that is documented in `xmlAppearanceToStyle` - >>> import xml.etree.ElementTree as ET - >>> defaults = ET.fromstring('' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '' - ... + '') + >>> from xml.etree.ElementTree import fromstring as EL + >>> defaults = EL( + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... '' + ... ) >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> MI.styleFromXmlDefaults(defaults) @@ -1096,14 +1101,16 @@ def xmlAppearanceToStyle(self, mxAppearance): ''' Parse the appearance tag for information about line widths and note sizes - >>> import xml.etree.ElementTree as ET - >>> appear = ET.fromstring('' - ... + '5' - ... + '1.5625' - ... + '60' - ... + '0.5' - ... + 'dotted' - ... + '') + >>> from xml.etree.ElementTree import fromstring as EL + >>> appear = EL( + ... '' + ... '5' + ... '1.5625' + ... '60' + ... '0.5' + ... 'dotted' + ... '' + ... ) >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> MI.xmlAppearanceToStyle(appear) @@ -1391,8 +1398,8 @@ def creatorToContributor(self, ''' Given a tag, fill the necessary parameters of a Contributor. - >>> import xml.etree.ElementTree as ET - >>> creator = ET.fromstring('Beethoven, Ludwig van') + >>> from xml.etree.ElementTree import fromstring as EL + >>> creator = EL('Beethoven, Ludwig van') >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> c = MI.creatorToContributor(creator) @@ -1435,8 +1442,8 @@ def rightsToCopyright(self, rights): Given a tag, fill the necessary parameters of a :class:`~music21.metadata.primitives.Copyright` object. - >>> import xml.etree.ElementTree as ET - >>> rights = ET.fromstring('CC-SA-BY') + >>> from xml.etree.ElementTree import fromstring as EL + >>> rights = EL('CC-SA-BY') >>> MI = musicxml.xmlToM21.MusicXMLImporter() >>> c = MI.rightsToCopyright(rights) @@ -1650,16 +1657,17 @@ def getDefaultInstrument(self, mxScorePart: ET.Element|None = None) -> instrumen r''' Get a default instrument from the mxScorePart tag. - >>> scorePart = ('Bass' - ... + 'B.' - ... + '' - ... + ' Instrument 4' - ... + '' - ... + '' - ... + ' 4' - ... + '1' - ... + '' - ... + '') + >>> scorePart = ( + ... 'Bass' + ... 'B.' + ... '' + ... ' Instrument 4' + ... '' + ... '' + ... ' 4' + ... '1' + ... '' + ... '') >>> from xml.etree.ElementTree import fromstring as EL >>> pp = musicxml.xmlToM21.PartParser() @@ -1672,16 +1680,17 @@ def getDefaultInstrument(self, mxScorePart: ET.Element|None = None) -> instrumen Non-default transpositions captured as of v7.3: - >>> scorePart = ('C Trumpet' - ... + 'C Tpt.' - ... + '' - ... + ' C Trumpet' - ... + '' - ... + '' - ... + ' 2' - ... + '57' - ... + '' - ... + '') + >>> scorePart = ( + ... 'C Trumpet' + ... 'C Tpt.' + ... '' + ... ' C Trumpet' + ... '' + ... '' + ... ' 2' + ... '57' + ... '' + ... '') >>> from xml.etree.ElementTree import fromstring as EL >>> pp = musicxml.xmlToM21.PartParser() @@ -2486,8 +2495,7 @@ def __init__(self, @staticmethod def getStaffNumber(mxObject: ET.Element|int|None) -> int: ''' - gets an int representing a staff number, or 0 (representing no staff assigned) - from an mxObject or a number: + gets an int representing a staff number from an mxObject or a number: >>> mp = musicxml.xmlToM21.MeasureParser() >>> from xml.etree.ElementTree import fromstring as EL @@ -2497,11 +2505,13 @@ def getStaffNumber(mxObject: ET.Element|int|None) -> int: >>> mp.getStaffNumber(EL('3')) 3 - If there is no tag, notes return the special NO_STAFF_ASSIGNED value, - (which is for now just a fancy alias for 0!) + If there is no tag, notes return the special NO_STAFF_ASSIGNED value + (which is, for now, just a fancy alias for 0!) >>> el = EL('C4') >>> NO_STAFF_ASSIGNED = musicxml.xmlToM21.NO_STAFF_ASSIGNED + >>> NO_STAFF_ASSIGNED + 0 >>> mp.getStaffNumber(el) == NO_STAFF_ASSIGNED True @@ -2700,11 +2710,11 @@ def xmlBackup(self, mxObj: ET.Element): A floor of 0.0 is enforced in case of float rounding issues. + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() >>> MP.divisions = 100 >>> MP.offsetMeasureNote = 1.875 - >>> from xml.etree.ElementTree import fromstring as EL >>> mxBackup = EL('100') >>> MP.xmlBackup(mxBackup) >>> MP.offsetMeasureNote @@ -2920,11 +2930,14 @@ def xmlToChord(self, mxNoteList: list[ET.Element]) -> chord.ChordBase: >>> qnDuration = r'7560quarter' - >>> a = EL(r'A3' - ... + qnDuration + '') - >>> b = EL(r'B3' - ... + qnDuration + '') - + >>> a = EL('' + ... + 'A3' + ... + qnDuration + ... + '') + >>> b = EL('' + ... + 'B3' + ... + qnDuration + ... + '') >>> c = MP.xmlToChord([a, b]) >>> len(c.pitches) 2 @@ -3016,9 +3029,9 @@ def xmlToSimpleNote(self, mxNote, freeSpanners=True) -> note.Note|note.Unpitched >>> MP.divisions = 10080 >>> mxNote = EL('D' - ... + '-16' - ... + '7560' - ... + 'eighth') + ... '-16' + ... '7560' + ... 'eighth') >>> n = MP.xmlToSimpleNote(mxNote) >>> n @@ -3198,7 +3211,7 @@ def xmlNotehead(self, n, mxNotehead): >>> n = note.Note() >>> nh = EL('' - ... + 'diamond') + ... 'diamond') >>> MP.xmlNotehead(n, nh) >>> n.notehead @@ -3232,7 +3245,7 @@ def xmlToPitch(self, mxNote, inputM21=None): >>> MP = musicxml.xmlToM21.MeasureParser() >>> b = EL('E-1' - ... + '3') + ... '3') >>> a = MP.xmlToPitch(b) >>> print(a) E-3 @@ -3240,7 +3253,7 @@ def xmlToPitch(self, mxNote, inputM21=None): Conflicting alter and accidental -- alter is still stored, but name is : >>> b = EL('E-13' - ... + 'sharp') + ... 'sharp') >>> a = MP.xmlToPitch(b) >>> print(a) E#3 @@ -3320,9 +3333,9 @@ def xmlToUnpitched( >>> mxNote = EL('7560eighth') >>> unpitched = EL('' - ... + 'E' - ... + '5' - ... + '') + ... 'E' + ... '5' + ... '') >>> mxNote.append(unpitched) >>> n = MP.xmlToSimpleNote(mxNote) >>> n.displayStep @@ -3439,10 +3452,10 @@ def xmlToRest(self, mxRest): >>> mxr_positioned = EL( ... '' - ... + 'G' - ... + '4' - ... + '' - ... + '5eighth' + ... 'G' + ... '4' + ... '' + ... '5eighth' ... ) >>> r = MP.xmlToRest(mxr_positioned) >>> r @@ -3492,7 +3505,7 @@ def xmlToRest(self, mxRest): See https://github.com/w3c-cg/musicxml/issues/478 >>> mxr = EL('10' - ... + 'quarter') + ... 'quarter') >>> r = MP.xmlToRest(mxr) >>> MP.fullMeasureRest True @@ -3663,10 +3676,10 @@ def xmlToDuration(self, mxNote, inputM21=None): >>> MP.divisions = 10080 - >>> mxNote = EL('D' + - ... '-16' + - ... '7560' + - ... 'eighth') + >>> mxNote = EL('D' + ... '-16' + ... '7560' + ... 'eighth') >>> c = duration.Duration() >>> MP.xmlToDuration(mxNote, c) @@ -3816,9 +3829,9 @@ def xmlNotations(self, mxNotations: ET.Element, n: note.GeneralNote): >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxNotations = EL('' + - ... 'angled' + - ... '') + >>> mxNotations = EL('' + ... 'angled' + ... '') >>> n = note.Note() >>> MP.xmlNotations(mxNotations, n) >>> n.expressions @@ -4127,7 +4140,7 @@ def xmlToArticulation(self, mxObj): 'above' >>> mxArt = EL('') + ... 'line-shape="curved" line-type="dashed" space-length="1" />') >>> a = MP.xmlToArticulation(mxArt) >>> a @@ -4656,15 +4669,15 @@ def xmlToTie(self, mxNote): Translate a MusicXML with SubElements :class:`~music21.tie.Tie` object - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() Create the incomplete part of a Note. - >>> mxNote = ET.fromstring('' - ... + '' - ... + '' - ... + '') + >>> mxNote = EL('' + ... '' + ... '' + ... '') >>> m21Tie = MP.xmlToTie(mxNote) >>> m21Tie.type 'start' @@ -4676,10 +4689,10 @@ def xmlToTie(self, mxNote): Same thing but with orientation instead of placement, which both get mapped to placement in Tie objects - >>> mxNote = ET.fromstring('' - ... + '' - ... + '' - ... + '') + >>> mxNote = EL('' + ... '' + ... '' + ... '') >>> tieObj = MP.xmlToTie(mxNote) >>> tieObj.placement 'above' @@ -4736,21 +4749,21 @@ def xmlToTuplets(self, mxNote: ET.Element) -> list[duration.Tuplet]: Given an mxNote, based on mxTimeModification and mxTuplet objects, return a list of Tuplet objects - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxNote = ET.fromstring('16th' + - ... '5' + - ... '4') + >>> mxNote = EL('16th' + ... '5' + ... '4') >>> tups = MP.xmlToTuplets(mxNote) >>> tups [] - >>> mxNote = ET.fromstring('eighth' + - ... '5' + - ... '3' + - ... '16th' + - ... '') + >>> mxNote = EL('eighth' + ... '5' + ... '3' + ... '16th' + ... '') >>> tup = MP.xmlToTuplets(mxNote) >>> tup [] @@ -4913,11 +4926,11 @@ def updateLyricsFromList(self, n, lyricList): Takes a list of elements and update the note's lyrics from that list. - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxLyric1 = ET.fromstring('HiThere') - >>> mxLyric2 = ET.fromstring('Bye') + >>> mxLyric1 = EL('HiThere') + >>> mxLyric2 = EL('Bye') >>> n = note.Note() >>> MP.updateLyricsFromList(n, [mxLyric1, mxLyric2]) >>> n.lyrics @@ -4946,12 +4959,12 @@ def xmlToLyric(self, mxLyric, inputM21=None) -> note.Lyric|None: Otherwise, a new `Lyric` object is created and returned. - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxLyric = ET.fromstring('' - ... + 'single' - ... + 'word') + >>> mxLyric = EL('' + ... 'single' + ... 'word') >>> lyricObj = note.Lyric() >>> MP.xmlToLyric(mxLyric, lyricObj) >>> lyricObj @@ -4968,13 +4981,13 @@ def xmlToLyric(self, mxLyric, inputM21=None) -> note.Lyric|None: Multiple texts can be created and result in composite lyrics - >>> mxBianco = ET.fromstring('' - ... + 'end' - ... + 'co' - ... + '_' - ... + 'single' - ... + 'e' - ... + '') + >>> mxBianco = EL('' + ... 'end' + ... 'co' + ... '_' + ... 'single' + ... 'e' + ... '') >>> bianco = MP.xmlToLyric(mxBianco) >>> bianco @@ -5216,11 +5229,11 @@ def xmlToRepeat(self, mxBarline, inputM21=None): Given an mxBarline (not an mxRepeat object) with repeatObj as a parameter, file the necessary parameters and return a bar.Repeat() object - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxBarline = ET.fromstring('light-heavy' + - ... '') + >>> mxBarline = EL('light-heavy' + ... '') >>> r = MP.xmlToRepeat(mxBarline) >>> r @@ -5237,8 +5250,8 @@ def xmlToRepeat(self, mxBarline, inputM21=None): Test that a forward repeat with times doesn't raise an exception, and that the resulting Repeat doesn't have times set. - >>> mxStartBarline = ET.fromstring('light-heavy' + - ... '') + >>> mxStartBarline = EL('light-heavy' + ... '') >>> rs = MP.xmlToRepeat(mxStartBarline) >>> rs @@ -5294,11 +5307,12 @@ def xmlToBarline(self, mxBarline, inputM21=None): ''' Given an mxBarline, fill the necessary parameters - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> mxBarline = ET.fromstring( - ... 'light-light') + >>> mxBarline = EL('' + ... 'light-light' + ... '') >>> b = MP.xmlToBarline(mxBarline) >>> b @@ -5666,8 +5680,8 @@ def xmlToTextExpression(self, mxWords): >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> m = EL('a tempo') + >>> m = EL('a tempo') >>> te = MP.xmlToTextExpression(m) >>> te.content 'a tempo' @@ -5703,15 +5717,15 @@ def xmlToTempoIndication(self, mxMetronome, mxWords=None): >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> m = EL(r'125' + - ... 'half') + >>> m = EL('125' + ... 'half') >>> MP.xmlToTempoIndication(m) Metric modulation: - >>> m = EL(r'long32nd' + - ... '') + >>> m = EL('long32nd' + ... '') >>> MP.xmlToTempoIndication(m) = float: >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() >>> MP.divisions = 40 - >>> off = EL(r'100') + >>> off = EL('100') >>> MP.xmlToOffset(off) 2.5 @@ -5793,7 +5807,7 @@ def xmlToOffset(self, mxObj: ET.Element) -> float: if need be. >>> MP.divisions = 30 - >>> off = EL(r'10') + >>> off = EL('10') >>> MP.xmlToOffset(off) 0.33333... ''' @@ -5872,24 +5886,24 @@ def xmlTransposeToInterval(self, mxTranspose): ''' Convert a MusicXML Transpose object to a music21 Interval object. - >>> import xml.etree.ElementTree as ET + >>> from xml.etree.ElementTree import fromstring as EL >>> MP = musicxml.xmlToM21.MeasureParser() - >>> t = ET.fromstring('-1' - ... + '-2') + >>> t = EL('-1' + ... '-2') >>> MP.xmlTransposeToInterval(t) - >>> t = ET.fromstring('-5' - ... + '-9') + >>> t = EL('-5' + ... '-9') >>> MP.xmlTransposeToInterval(t) Not mentioned in MusicXML XSD but supported in (Finale; MuseScore): octave-change refers to both diatonic and chromatic, so we will deal: - >>> t = ET.fromstring('-1-2' - ... + '-1') + >>> t = EL('-1-2' + ... '-1') >>> inv = MP.xmlTransposeToInterval(t) >>> inv @@ -5971,47 +5985,49 @@ def xmlToTimeSignature( Returns a TimeSignature or SenzaMisuraTimeSignature (for senza-misura) from a