diff --git a/.agents/skills/running-tests/SKILL.md b/.agents/skills/running-tests/SKILL.md index 92601b045..dc1538c1c 100644 --- a/.agents/skills/running-tests/SKILL.md +++ b/.agents/skills/running-tests/SKILL.md @@ -75,17 +75,25 @@ pytest is for a module. For the whole suite use the runners, and note that a green pytest run does not mean CI will be green -- they gather and order modules differently. +Use `multiprocessTest` -- it runs on n-1 cores and finishes in about 10 seconds, +against roughly 45 for the single-core runner: + ```bash -# everyday full run, on n-1 cores uv run python music21/test/multiprocessTest.py +``` -# exactly what GitHub Actions runs (~1 minute); use before pushing to a PR +That gap is the whole story when someone is waiting on the answer. Reach for +`testSingleCoreAll` only for what `multiprocessTest` cannot tell you: it is what +GitHub Actions runs, so it is the one to check before a release, when chasing a +CI failure that will not reproduce, or on a single-core machine. + +```bash uv run python -c 'from music21.test.testSingleCoreAll import ciMain as ci; ci()' ``` The two runners see slightly different sets of modules -- `multiprocessTest` walks the package tree for modules reachable from `import music21`, while -`testSingleCoreAll` gathers module files from disk. Run both before a release. +`testSingleCoreAll` gathers module files from disk. Module **order** differs between the two runners and again from pytest. `multiprocessTest` goes in reverse-alphabetical order (with the known-slow diff --git a/music21/abcFormat/__init__.py b/music21/abcFormat/__init__.py index 7319a0050..b84ec4281 100644 --- a/music21/abcFormat/__init__.py +++ b/music21/abcFormat/__init__.py @@ -2505,13 +2505,15 @@ def tokenize(self, strSrc: str) -> None: # v is up bow; might be: "^Segno"v which also should be dropped # H is fermata # . dot may be staccato, but should be attached to pitch - if self.currentCollectStr in ('w', 'u', 'v', 'v.', 'h', 'H', 'vk', - 'uk', 'U', '~', - '.', '=', 'V', 'v.', 'S', 's', - 'i', 'I', 'ui', 'u.', 'Q', 'Hy', 'Hx', - 'r', 'm', 'M', 'n', 'N', 'o', 'O', 'P', - 'l', 'L', 'R', - 'y', 'T', 't', 'x', 'Z'): + if self.currentCollectStr in ( + 'w', 'u', 'v', 'v.', 'h', 'H', 'vk', + 'uk', 'U', '~', + '.', '=', 'V', 'v.', 'S', 's', + 'i', 'I', 'ui', 'u.', 'Q', 'Hy', 'Hx', + 'r', 'm', 'M', 'n', 'N', 'o', 'O', 'P', + 'l', 'L', 'R', + 'y', 'T', 't', 'x', 'Z', + ): pass # these are bad chords, or other problematic notations like # "D.C."x @@ -2785,7 +2787,6 @@ def __add__(self, other: ABCHandler) -> ABCHandler: True >>> ah3.tokens[3] == ah2.tokens[0] True - ''' ah = self.__class__() # will get the same class type ah.tokens = self.tokens + other.tokens @@ -3114,7 +3115,6 @@ def _buildMeasureBoundaryIndices( [[0, 9], [10, 16], [16, 23], [23, 29], [29, 36], [36, 42], [42, 49], [49, 56], [56, 61], [62, 64], [64, 70], [70, 77], [77, 84], [84, 90], [90, 96], [96, 103], [103, 110], [110, 115]] - ''' # collect start and end pairs of split pairs = [] diff --git a/music21/abcFormat/testFiles.py b/music21/abcFormat/testFiles.py index 8cbd76cad..eee14079f 100644 --- a/music21/abcFormat/testFiles.py +++ b/music21/abcFormat/testFiles.py @@ -633,11 +633,11 @@ # ------------------------------------------------------------------------------ ALL = [fyrareprisarn, mysteryReel, fullRiggedShip, aleIsDear, kitchGirl, - williamAndNancy, morrisonsJig, hectorTheHero, kingOfTheFairies, - sicutRosa, theAleWifesDaughter, theBeggerBoy, theBattleOfTheSnaBas, - draughtOfAle, - valentineJigg, - testPrimitive, testPrimitivePolyphonic, testPrimitiveTuplet + williamAndNancy, morrisonsJig, hectorTheHero, kingOfTheFairies, + sicutRosa, theAleWifesDaughter, theBeggerBoy, theBattleOfTheSnaBas, + draughtOfAle, + valentineJigg, + testPrimitive, testPrimitivePolyphonic, testPrimitiveTuplet ] diff --git a/music21/abcFormat/translate.py b/music21/abcFormat/translate.py index 69c943a27..6e245f12a 100644 --- a/music21/abcFormat/translate.py +++ b/music21/abcFormat/translate.py @@ -1044,9 +1044,9 @@ def testNoChord(self): score = harmony.realizeChordSymbolDurations(score) self.assertEqual(8, score.getElementsByClass(harmony.ChordSymbol) - .last().quarterLength) + .last().quarterLength) self.assertEqual(4, score.getElementsByClass(harmony.ChordSymbol) - .first().quarterLength) + .first().quarterLength) def testAbcKeyImport(self): from music21 import abcFormat diff --git a/music21/alpha/analysis/aligner.py b/music21/alpha/analysis/aligner.py index 4df85e39f..d7604ded3 100644 --- a/music21/alpha/analysis/aligner.py +++ b/music21/alpha/analysis/aligner.py @@ -176,7 +176,6 @@ def makeHashedStreams(self): >>> sa2.hashedSourceStream [NoteHashWithReference(Pitch=69, Duration=1.0, Offset=0.0), NoteHashWithReference(Pitch=67, Duration=1.0, Offset=1.0)] - ''' if not self.preHashed: self.hashedTargetStream = self.hasher.hashStream(self.targetStream) @@ -230,7 +229,6 @@ def setupDistanceMatrix(self): Traceback (most recent call last): music21.alpha.analysis.aligner.AlignerException: Cannot perform alignment with empty source stream. - ''' if not self.hashedTargetStream: self.makeHashedStreams() @@ -306,7 +304,6 @@ def populateDistanceMatrix(self): [2, 2, 2, 4], [4, 4, 3, 3], [6, 6, 5, 3]]) - ''' # calculate insert and delete costs based on the first tuple in the Source S @@ -381,7 +378,6 @@ def getPossibleMovesFromLocation(self, i, j): >>> sa.getPossibleMovesFromLocation(3, 0) [0, None, None] - ''' verticalCost = int(self.distanceMatrix[i - 1][j]) if i >= 1 else None horizontalCost = int(self.distanceMatrix[i][j - 1]) if j >= 1 else None @@ -736,7 +732,6 @@ def tupleEqualityWithoutReference(self, tup1, tup2): >>> sa.tupleEqualityWithoutReference(nhwr1, nhwr3) False - ''' for val in tup1.hashItemsKeys: if getattr(tup1, val) != getattr(tup2, val): @@ -828,7 +823,6 @@ def calculateChangesList(self): 1 >>> saD.similarityScore 0.5 - ''' i = self.n j = self.m diff --git a/music21/alpha/analysis/hasher.py b/music21/alpha/analysis/hasher.py index 9da199112..a89f0df9b 100644 --- a/music21/alpha/analysis/hasher.py +++ b/music21/alpha/analysis/hasher.py @@ -186,7 +186,6 @@ def _hashMIDIPitchName(self, e, thisChord=None): >>> r = note.Rest() >>> h._hashMIDIPitchName(r, thisChord=c) 0 - ''' if thisChord and self.hashChordsAsChords: return 1 @@ -417,16 +416,16 @@ def hashStream(self, s): if self.hashChordsAsNotes: for n in elt: singleNoteHash = [self.hashingFunctions[hashProperty](n, thisChord=elt) - for hashProperty in self.tupleList] + for hashProperty in self.tupleList] self.addHashToFinalHash(singleNoteHash, finalHash, n) elif self.hashChordsAsChords: singleNoteHash = [self.hashingFunctions[hashProperty](None, thisChord=elt) - for hashProperty in self.tupleList] + for hashProperty in self.tupleList] self.addHashToFinalHash(singleNoteHash, finalHash, elt) else: singleNoteHash = [self.hashingFunctions[hashProperty](elt) - for hashProperty in self.tupleList] + for hashProperty in self.tupleList] self.addHashToFinalHash(singleNoteHash, finalHash, elt) # TODO: don't finalHash back and forth, return it in the smaller functions return finalHash diff --git a/music21/alpha/analysis/ornamentRecognizer.py b/music21/alpha/analysis/ornamentRecognizer.py index 029f35b96..1364d2572 100644 --- a/music21/alpha/analysis/ornamentRecognizer.py +++ b/music21/alpha/analysis/ornamentRecognizer.py @@ -543,7 +543,7 @@ def testRecognizeTrill(self): t3Notes = stream.Stream() # C B C B C D E F t3Notes.append( [t3n1, t3n2, deepcopy(t3n1), deepcopy(t3n2), deepcopy(t3n1), - nachschlagN1, nachschlagN2, nachschlagN3] + nachschlagN1, nachschlagN2, nachschlagN3] ) testConditions.append( diff --git a/music21/analysis/correlate.py b/music21/analysis/correlate.py index 563d94c39..e629da986 100644 --- a/music21/analysis/correlate.py +++ b/music21/analysis/correlate.py @@ -45,7 +45,6 @@ class ActivityMatch: .. image:: images/ScatterWeightedPitchSpaceDynamicSymbol.* :width: 600 - ''' def __init__(self, streamObj): if not hasattr(streamObj, 'classes') or 'Stream' not in streamObj.classes: @@ -59,7 +58,6 @@ def _findActive(self, objNameSrc=None, objNameDst=None): Do the analysis, finding correlations of src with dst returns an ordered list of dictionaries, in the form {'src': obj, 'dst': [objs]} - ''' if objNameSrc is None: objNameSrc = (note.Note, chord.Chord) diff --git a/music21/analysis/discrete.py b/music21/analysis/discrete.py index 13af52e37..be51d2a46 100644 --- a/music21/analysis/discrete.py +++ b/music21/analysis/discrete.py @@ -565,14 +565,12 @@ def _likelyKeys(self, sStream): def _bestKeyEnharmonic(self, pitchObj, mode, sStream=None): ''' - >>> ks = analysis.discrete.KrumhanslSchmuckler() >>> s = converter.parse('tinynotation: 4/4 b-4 e- f g-') >>> ks._bestKeyEnharmonic(pitch.Pitch('e#'), 'minor', s) >>> ks._bestKeyEnharmonic(pitch.Pitch('f-'), 'major', s) - ''' if pitchObj is None: return None @@ -881,7 +879,6 @@ def getWeights(self, weightType='major'): 12 >>> a.getWeights('major') [16.8..., 0.8..., 12.9..., 1.4..., ...] - ''' weightType = weightType.lower() # note: only one value is different from KrumhanslSchmuckler @@ -1045,7 +1042,6 @@ def getPitchSpan(self, subStream) -> tuple[pitch.Pitch, pitch.Pitch]|None: >>> s.insert(4, harmony.ChordSymbol('C6')) >>> p.getPitchSpan(s) is None True - ''' if subStream is self._referenceStream and self.minPitchObj and self.maxPitchObj: return self.minPitchObj, self.maxPitchObj @@ -1118,7 +1114,6 @@ def solutionLegend(self, compress: bool = False) -> list[ >>> x = p.process(s.parts[1]) >>> [len(y) for y in [x for x in p.solutionLegend(compress=True)]] [2, 2] - ''' colorsUsed = [] if compress: @@ -1160,7 +1155,6 @@ def solutionUnitString(self): def solutionToColor(self, solution: int|None) -> str: ''' - >>> p = analysis.discrete.Ambitus() >>> s = stream.Stream() >>> c = chord.Chord(['a2', 'b4', 'c8']) diff --git a/music21/analysis/harmonicFunction.py b/music21/analysis/harmonicFunction.py index cee140a83..25237bf19 100644 --- a/music21/analysis/harmonicFunction.py +++ b/music21/analysis/harmonicFunction.py @@ -178,7 +178,6 @@ def functionToRoman(thisHarmonicFunction: HarmonicFunction, >>> rn = roman.RomanNumeral('vi') >>> str(analysis.harmonicFunction.romanToFunction(rn)) 'Tp' - ''' if isinstance(keyOrScale, str): keyOrScale = key.Key(keyOrScale) diff --git a/music21/analysis/metrical.py b/music21/analysis/metrical.py index 10aa5222b..8a20f44e0 100644 --- a/music21/analysis/metrical.py +++ b/music21/analysis/metrical.py @@ -114,7 +114,6 @@ def thomassenMelodicAccent(streamIn: stream.Stream): ('E4', 0.5561) ('D4', 0.17) ('D4', 0.0) - ''' # we use .ps instead of Intervals for speed, since # we just need perceived contours diff --git a/music21/analysis/patel.py b/music21/analysis/patel.py index 499fed7ea..54d019aa9 100644 --- a/music21/analysis/patel.py +++ b/music21/analysis/patel.py @@ -92,7 +92,7 @@ def melodicIntervalVariability(streamForAnalysis, **skipKeywords): totalElements = len(intervalStream) if totalElements < 2: # this is correct. raise ValueError('need at least three notes to have ' - + 'a std-deviation of intervals (and thus a MIV)') + + 'a std-deviation of intervals (and thus a MIV)') # summation = 0 semitoneList = [myInt.chromatic.undirected for myInt in intervalStream] return 100 * (stdev(semitoneList) / mean(semitoneList)) diff --git a/music21/analysis/reduceChordsOld.py b/music21/analysis/reduceChordsOld.py index 2281f8c32..adf531979 100644 --- a/music21/analysis/reduceChordsOld.py +++ b/music21/analysis/reduceChordsOld.py @@ -154,7 +154,6 @@ def reduceMeasureToNChords(self, def computeMeasureChordWeights(self, measureObj, weightAlgorithm=None): ''' - >>> s = analysis.reduceChordsOld.testMeasureStream1().notes >>> cr = analysis.reduceChordsOld.ChordReducer() >>> cws = cr.computeMeasureChordWeights(s) diff --git a/music21/analysis/reduction.py b/music21/analysis/reduction.py index 7628593d9..e4bf27dcb 100644 --- a/music21/analysis/reduction.py +++ b/music21/analysis/reduction.py @@ -463,7 +463,6 @@ class PartReduction: of all parts. The default is True. If the `normalize` parameter is False, no normalization will take place. The default is True. - ''' def __init__(self, srcScore=None, @@ -734,9 +733,14 @@ def _dynamicToWeight(targets): offsetEnd = offsetStart + ds['span'] # get all targets within the contiguous region # e.g., Dynamics objects - match = flatRef.getElementsByOffset(offsetStart, offsetEnd, - includeEndBoundary=True, mustFinishInSpan=False, - mustBeginInSpan=True).getElementsByClass(target).stream() + inRegion = flatRef.getElementsByOffset( + offsetStart, + offsetEnd, + includeEndBoundary=True, + mustFinishInSpan=False, + mustBeginInSpan=True, + ) + match = inRegion.getElementsByClass(target).stream() # environLocal.printDebug(['matched elements', target, match]) # extend duration of all found dynamics match.extendDuration(target, inPlace=True) @@ -1252,7 +1256,7 @@ def testPartReductionE(self): s.insert(0, p2) # s.show() pr = analysis.reduction.PartReduction(s, fillByMeasure=True, - segmentByTarget=False, normalize=False) + segmentByTarget=False, normalize=False) pr.process() target = pr.getGraphHorizontalBarWeightedData() match = [(0, [[0.0, 4.0, 0.178571428571, '#666666'], @@ -1265,7 +1269,7 @@ def testPartReductionE(self): self._matchWeightedData(match, target) pr = analysis.reduction.PartReduction(s, fillByMeasure=False, - segmentByTarget=True, normalize=False) + segmentByTarget=True, normalize=False) pr.process() target = pr.getGraphHorizontalBarWeightedData() match = [(0, [[0.0, 2.0, 0.05, '#666666'], @@ -1282,7 +1286,7 @@ def testPartReductionE(self): pr = analysis.reduction.PartReduction(s, fillByMeasure=False, - segmentByTarget=False) + segmentByTarget=False) pr.process() target = pr.getGraphHorizontalBarWeightedData() # print(target) @@ -1296,7 +1300,7 @@ def testPartReductionE(self): pr = analysis.reduction.PartReduction(s, fillByMeasure=True, - segmentByTarget=True) + segmentByTarget=True) pr.process() target = pr.getGraphHorizontalBarWeightedData() match = [(0, [[0.0, 2.0, 0.3888888888888, '#666666'], diff --git a/music21/analysis/windowed.py b/music21/analysis/windowed.py index 64bead7e8..09e143d95 100644 --- a/music21/analysis/windowed.py +++ b/music21/analysis/windowed.py @@ -94,7 +94,6 @@ def getMinimumWindowStream(self, timeSignature='1/4'): >>> wa1 = analysis.windowed.WindowedAnalysis(s, p) >>> wa2 = analysis.windowed.WindowedAnalysis(s.flatten(), p) - ''' # create a stream that contains just a 1/4 time signature; this is # the minimum window size (and partitioning will be done by measure) @@ -151,7 +150,6 @@ def analyze(self, windowSize, windowType='overlap'): >>> a, b = wa.analyze(1, windowType='adjacentAverage') >>> len(a), len(b) (36, 36) - ''' maxWindowCount = len(self._windowedStream) # assuming that this is sorted diff --git a/music21/articulations.py b/music21/articulations.py index 95b03e1f1..6e4b8953f 100644 --- a/music21/articulations.py +++ b/music21/articulations.py @@ -219,7 +219,6 @@ class TimbreArticulation(Articulation): # ------------------------------------------------------------------------------ class Accent(DynamicArticulation): ''' - >>> a = articulations.Accent() ''' def __init__(self, **keywords): @@ -246,7 +245,6 @@ def __init__(self, **keywords): class Staccato(LengthArticulation): ''' - >>> a = articulations.Staccato() ''' def __init__(self, **keywords): diff --git a/music21/audioSearch/scoreFollower.py b/music21/audioSearch/scoreFollower.py index 5d6584957..073f11605 100644 --- a/music21/audioSearch/scoreFollower.py +++ b/music21/audioSearch/scoreFollower.py @@ -120,7 +120,6 @@ def repeatTranscription(self): False >>> print(ScF.lastNotePosition) 10 - ''' from music21 import audioSearch @@ -382,7 +381,6 @@ def updatePosition(self, prob, totalLengthPeriod, time_start): >>> exitType = ScF.updatePosition(prob, totalLengthPeriod, time_start) >>> print(exitType) countdownExceeded - ''' exitType = False @@ -462,7 +460,6 @@ def predictNextNotePosition(self, totalLengthPeriod, totalSeconds): ... totalLengthPeriod, totalSeconds) >>> print(predictedStartPosition) 18 - ''' extraLength = totalLengthPeriod * totalSeconds / self.seconds_recording middleRhythm = 0 diff --git a/music21/base.py b/music21/base.py index 76c3b76f0..4878c13be 100644 --- a/music21/base.py +++ b/music21/base.py @@ -316,7 +316,6 @@ def _getEqualityAttributes(cls) -> frozenset[str]: True >>> 'pitch' in base._getEqualityAttributes(bar.Barline) False - ''' equalityAttributes = set() # equalityAttributesIgnore works, but not yet needed. @@ -2161,7 +2160,7 @@ def contextSites( offsetAdjustedCsTuple = ContextSortTuple( derivedCsTuple.site, derivedCsTuple.offset.modify(offset=derivedCsTuple[1].offset - + offsetAppend), + + offsetAppend), derivedCsTuple.recurseType) if returnSortTuples: yield offsetAdjustedCsTuple @@ -2192,7 +2191,6 @@ def getAllContextsByClass(self, className): TODO: make it so that it does not skip over multiple matching classes at the same offset. with sortTuple - ''' el = self.getContextByClass(className) while el is not None: @@ -2771,7 +2769,7 @@ def sortTuple(self, insertIndex = 0 return SortTuple(atEnd, offset, self.priority, - self.classSortOrder, isNotGrace, insertIndex) + self.classSortOrder, isNotGrace, insertIndex) # ----------------------------------------------------------------- @property @@ -3505,7 +3503,6 @@ def splitAtDurations(self) -> _SplitTuple: ('64th', 0, (,)) TODO: unite this and other functions into a "split" function -- document obscure uses. - ''' atm = self.duration.aggregateTupletMultiplier() quarterLengthList = [opFrac(c.quarterLength * atm) for c in self.duration.components] diff --git a/music21/beam.py b/music21/beam.py index 86afb6273..e6e258ed0 100644 --- a/music21/beam.py +++ b/music21/beam.py @@ -642,7 +642,6 @@ def setAll(self, type, direction=None): # type is okay @ReservedAssignment >>> a.setAll('sexy') Traceback (most recent call last): music21.beam.BeamException: beam type cannot be sexy - ''' if type not in ('start', 'stop', 'continue', 'partial'): raise BeamException(f'beam type cannot be {type}') @@ -679,7 +678,6 @@ def setByNumber(self, number, type, direction=None): # type is okay @ReservedAs >>> a.setByNumber(2, 'crazy') Traceback (most recent call last): music21.beam.BeamException: beam type cannot be crazy - ''' # permit providing one argument hyphenated if '-' in type: diff --git a/music21/braille/basic.py b/music21/braille/basic.py index 22d600e97..c9218a3be 100644 --- a/music21/braille/basic.py +++ b/music21/braille/basic.py @@ -592,7 +592,6 @@ def yieldBrailleArticulations(noteEl): ⠦ ⠨⠦ ⠸⠦ - ''' def _brailleArticulationsSortKey(inner_articulation): isBowing = isinstance(inner_articulation, articulations.Bowing) @@ -740,8 +739,8 @@ def noteToBraille( f'transcriber-added {symbols["transcriber-added_sign"]}') tupletTrans = symbols['tuplet_prefix'] # dots 4,5,6 tupletTrans += numberToBraille(allTuplets[0].numberNotesActual, - withNumberSign=False, - lower=True) + withNumberSign=False, + lower=True) tupletTrans += symbols['dot'] noteTrans.append(tupletTrans) music21Note.editorial.brailleEnglish.append( @@ -1237,7 +1236,6 @@ def transcribeHeading( ⠀⠀⠀⠀⠑⠀⠀⠀⠀⠀ ⠞⠗⠁⠝⠟⠥⠊⠇⠇⠕⠲ ⠀⠀⠀⠣⠣⠨⠉⠀⠀⠀ - ''' if (music21KeySignature is None and music21TimeSignature is None diff --git a/music21/braille/noteGrouping.py b/music21/braille/noteGrouping.py index 588a0d255..9df8c7f03 100644 --- a/music21/braille/noteGrouping.py +++ b/music21/braille/noteGrouping.py @@ -118,7 +118,6 @@ def transcribeGroup(self, brailleElementGrouping=None): transcribe a group of notes, possibly excluding certain attributes. Returns a (unicode) string of brailleElementGrouping transcribed. - ''' self.reset() if brailleElementGrouping is not None: diff --git a/music21/braille/segment.py b/music21/braille/segment.py index 35b30b2e2..eb493b4a6 100644 --- a/music21/braille/segment.py +++ b/music21/braille/segment.py @@ -697,7 +697,6 @@ def showLeadingOctaveFromNoteGrouping(self, noteGrouping: BrailleElementGrouping True >>> bs1.showLeadingOctaveFromNoteGrouping(beg1) True - ''' currentKey = self.currentGroupingKey previousKey = self.previousGroupingKey @@ -827,8 +826,8 @@ def extractNoteGrouping(self) -> None: # hence -- let us split this noteGrouping into two noteGroupings. try: bngA, bngB = self.splitNoteGroupingAndTranscribe(noteGrouping, - showLeadingOctave, - addSpace) + showLeadingOctave, + addSpace) self.currentLine.append(bngA, addSpace=addSpace) self.addToNewLine(bngB) except BrailleSegmentException: @@ -1073,8 +1072,8 @@ def fixOneArticulation(artic, music21NoteStart, allNotes, noteIndexStart): newSegment = self.consolidate() noteGroupings = [newSegment[gpKey] - for gpKey in newSegment.keys() - if gpKey.affinity == Affinity.NOTEGROUP] + for gpKey in newSegment.keys() + if gpKey.affinity == Affinity.NOTEGROUP] for noteGrouping in noteGroupings: allNotes_outer = [n for n in noteGrouping if isinstance(n, note.Note)] for noteIndexStart_outer in range(len(allNotes_outer)): diff --git a/music21/braille/test.py b/music21/braille/test.py index ab2c0468c..24e7fc690 100644 --- a/music21/braille/test.py +++ b/music21/braille/test.py @@ -1848,7 +1848,7 @@ def test_example05_3(self): def test_example05_4(self): self.methodArgs = {'suppressOctaveMarks': True} bm = converter.parse('tinynotation: 4/4 E2 F2 G1 E2 D2 C1 D2 E2 F2 E2 D1 r1 ' - 'C2 D2 E1 F2 G2 A1 G2 F2 E2 D2 C1 r1') + 'C2 D2 E1 F2 G2 A1 G2 F2 E2 D2 C1 r1') bm.makeNotation(inPlace=True, cautionaryNotImmediateRepeat=False) self.s = bm self.e = ''' @@ -3622,9 +3622,9 @@ def test_example08_7a(self): (-4, '4/4', 'Andante', '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠁⠝⠙⠁⠝⠞⠑⠲⠀⠼⠙⠣⠼⠙⠲⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'), (3, '3/8', 'Con moto', '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠉⠕⠝⠀⠍⠕⠞⠕⠲⠀⠩⠩⠩⠼⠉⠦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'), (None, '4/4', 'Andante cantabile', - '⠀⠀⠀⠀⠀⠀⠀⠀⠠⠁⠝⠙⠁⠝⠞⠑⠀⠉⠁⠝⠞⠁⠃⠊⠇⠑⠲⠀⠼⠙⠲⠀⠀⠀⠀⠀⠀⠀⠀⠀'), + '⠀⠀⠀⠀⠀⠀⠀⠀⠠⠁⠝⠙⠁⠝⠞⠑⠀⠉⠁⠝⠞⠁⠃⠊⠇⠑⠲⠀⠼⠙⠲⠀⠀⠀⠀⠀⠀⠀⠀⠀'), (2, '7/8', 'Very brightly', - '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠧⠑⠗⠽⠀⠃⠗⠊⠛⠓⠞⠇⠽⠲⠀⠩⠩⠼⠛⠦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀') + '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠧⠑⠗⠽⠀⠃⠗⠊⠛⠓⠞⠇⠽⠲⠀⠩⠩⠼⠛⠦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀') ] for ks, ts, tt, r in results: if ks is not None: @@ -3637,7 +3637,7 @@ def test_example08_8(self): from music21.braille import basic self.assertEqual(basic.metronomeMarkToBraille( tempo.MetronomeMark(number=80, - referent=note.Note(type='half'))), '⠝⠶⠼⠓⠚') + referent=note.Note(type='half'))), '⠝⠶⠼⠓⠚') def test_example08_9(self): from music21.braille.basic import transcribeHeading @@ -3671,7 +3671,7 @@ def test_drill08_1(self): bm = converter.parse(''' tinynotation: 4/4 a2 g8 f8 e4 d4 e4 f8 g8 a4 g4 c'8 b8 a4 g4 f4. e8 d2 c4 e4 a4 e'4 e'4 d'4 c'8 b8 a4 a'4 g'8 f'8 e'4 d'4 c'4 a8 b8 c'2''', - makeNotation=False) + makeNotation=False) bm.replace(bm.getElementsByClass(meter.TimeSignature).first(), meter.TimeSignature('c')) bm.insert(0, tempo.TempoText('Andante maestoso')) bm.insert(0, tempo.MetronomeMark(number=92, referent=note.Note(type='quarter'))) diff --git a/music21/braille/text.py b/music21/braille/text.py index 6335f5949..a5fa2f950 100644 --- a/music21/braille/text.py +++ b/music21/braille/text.py @@ -147,7 +147,6 @@ def addToNewLine(self, brailleNoteGrouping): >>> print(str(bt)) hi ⠨⠜⠄⠹⠹⠹ - ''' self.makeNewLine() if self.rightHandSymbol or self.leftHandSymbol: diff --git a/music21/braille/translate.py b/music21/braille/translate.py index f7e19da88..d7528ad4e 100644 --- a/music21/braille/translate.py +++ b/music21/braille/translate.py @@ -244,22 +244,22 @@ def streamToBraille(music21Stream: stream.Measure|stream.Part|stream.Score|strea ''' if isinstance(music21Stream, stream.Part): return partToBraille(music21Stream, - inPlace=inPlace, - debug=debug, - cancelOutgoingKeySig=cancelOutgoingKeySig, - descendingChords=descendingChords, - dummyRestLength=dummyRestLength, - maxLineLength=maxLineLength, - segmentBreaks=segmentBreaks, - showClefSigns=showClefSigns, - showFirstMeasureNumber=showFirstMeasureNumber, - showHand=showHand, - showHeading=showHeading, - showLongSlursAndTiesTogether=showLongSlursAndTiesTogether, - showShortSlursAndTiesTogether=showShortSlursAndTiesTogether, - slurLongPhraseWithBrackets=slurLongPhraseWithBrackets, - suppressOctaveMarks=suppressOctaveMarks, - upperFirstInNoteFingering=upperFirstInNoteFingering, + inPlace=inPlace, + debug=debug, + cancelOutgoingKeySig=cancelOutgoingKeySig, + descendingChords=descendingChords, + dummyRestLength=dummyRestLength, + maxLineLength=maxLineLength, + segmentBreaks=segmentBreaks, + showClefSigns=showClefSigns, + showFirstMeasureNumber=showFirstMeasureNumber, + showHand=showHand, + showHeading=showHeading, + showLongSlursAndTiesTogether=showLongSlursAndTiesTogether, + showShortSlursAndTiesTogether=showShortSlursAndTiesTogether, + slurLongPhraseWithBrackets=slurLongPhraseWithBrackets, + suppressOctaveMarks=suppressOctaveMarks, + upperFirstInNoteFingering=upperFirstInNoteFingering, ) elif isinstance(music21Stream, stream.Measure): return measureToBraille(music21Stream, @@ -597,7 +597,6 @@ def measureToBraille(music21Measure, ⠼⠁⠀⠐⠽⠣⠅ >>> print(braille.translate.measureToBraille(p.measure(1))) ⠼⠙⠲⠀⠐⠽⠣⠅ - ''' measureToTranscribe = music21Measure if not inPlace: diff --git a/music21/capella/fromCapellaXML.py b/music21/capella/fromCapellaXML.py index 5410207ef..820cf6e96 100644 --- a/music21/capella/fromCapellaXML.py +++ b/music21/capella/fromCapellaXML.py @@ -877,7 +877,6 @@ def barlineListFromBarline(self, barlineElement: ET.Element) -> list[bar.Barline >>> repeatTag = ci.domElementFromText('') >>> ci.barlineListFromBarline(repeatTag) [, ] - ''' barlineList: list[bar.Barline] = [] hasRepeatEnd = False diff --git a/music21/chord/__init__.py b/music21/chord/__init__.py index d258b3746..3c5a16330 100644 --- a/music21/chord/__init__.py +++ b/music21/chord/__init__.py @@ -925,7 +925,6 @@ def formatVectorString(vectorList: Iterable[int]) -> str: >>> c1.formatVectorString([10, 11, 3, 5]) '' - ''' msg = ['<'] for e in vectorList: # should be numbers @@ -1333,7 +1332,6 @@ def bass( # # >>> cmin_inv.bass() # - ''' if newbass: newbassPitch: pitch.Pitch @@ -1424,7 +1422,6 @@ def canBeTonic(self) -> bool: >>> a = chord.Chord(['g', 'b', 'd']) >>> a.canBeTonic() True - ''' if self.isMajorTriad() or self.isMinorTriad(): return True @@ -2152,7 +2149,6 @@ def hasRepeatedChordStep( >>> cChord.hasRepeatedChordStep(5) False - ''' if testRoot is None: testRoot = self.root() @@ -2189,7 +2185,6 @@ def intervalFromChordStep( >>> print(cmaj.intervalFromChordStep(6)) None - ''' if testRoot is None: try: @@ -2544,7 +2539,6 @@ def isAugmentedSixth(self, *, permitAnyInversion: bool = False) -> bool: True If `permitAnyInversion` is True then any inversion is allowed. - ''' # cardinality is just used to speed up the call to avoid checking multiple augmented # 6ths on a triad, etc. The fact that Ab C F# Gb will have cardinality of 3 @@ -2692,7 +2686,6 @@ def isConsonant(self) -> bool: >>> c13.isConsonant() False - ''' c2 = self.removeRedundantPitchNames(inPlace=False) if len(c2.pitches) == 1: @@ -2939,7 +2932,6 @@ def isGermanAugmentedSixth(self, *, permitAnyInversion=False) -> bool: >>> gr6d = chord.Chord(['A-3', 'C-4', 'E-4', 'F#4']) >>> gr6d.isGermanAugmentedSixth() False - ''' return self._isAugmentedSixthHelper( (4, 27, -1), @@ -4000,7 +3992,6 @@ def semiClosedPosition( ... ) >>> c1 - ''' c2 = self.closedPosition(forceOctave=forceOctave, inPlace=inPlace, @@ -4491,7 +4482,6 @@ def transpose(self, value, *, inPlace=False): >>> a.transpose(aInterval, inPlace=True) >>> a - ''' if hasattr(value, 'diatonic'): # it is an Interval class intervalObj = value @@ -4985,7 +4975,6 @@ def fullName(self) -> str: >>> chord.Chord(['d1', 'e4-', 'b3-'], quarterLength=2/3).fullName 'Chord {D in octave 1 | E-flat in octave 4 | B-flat in octave 3} Quarter Triplet (2/3 QL)' - ''' msg = [] sub = [] @@ -5823,7 +5812,6 @@ def fromForteClass(notation: str|Sequence[int]) -> Chord: >>> chord.fromForteClass((11, 1)) - ''' card = None num = 1 @@ -5879,7 +5867,6 @@ def fromIntervalVector(notation: Sequence[int], getZRelation: bool = False) -> C >>> chord.fromIntervalVector((1, 1, 1, 1, 1, 1)).getZRelation() - ''' addressList = None if common.isListLike(notation): diff --git a/music21/clef.py b/music21/clef.py index 7ff0c6c80..a62569fee 100644 --- a/music21/clef.py +++ b/music21/clef.py @@ -107,7 +107,6 @@ class Clef(base.Music21Object): True >>> clef.NoClef().sign 'none' - ''', 'line': ''' The line, counting from the bottom up, that the clef resides on. @@ -602,7 +601,6 @@ class TenorClef(CClef): 'C' >>> a.line 4 - ''' def __init__(self, **keywords): diff --git a/music21/common/classTools.py b/music21/common/classTools.py index 024074b6e..a8ce7ddeb 100644 --- a/music21/common/classTools.py +++ b/music21/common/classTools.py @@ -84,7 +84,6 @@ def isNum(usrData: t.Any) -> t.TypeGuard[t.Union[float, int, Fraction]]: >>> from decimal import Decimal >>> common.isNum(Decimal('2.0')) True - ''' # noinspection PyBroadException try: diff --git a/music21/common/decorators.py b/music21/common/decorators.py index a71e37455..390a33063 100644 --- a/music21/common/decorators.py +++ b/music21/common/decorators.py @@ -125,7 +125,6 @@ def deprecated( Restore stderr at the end. >>> sys.stderr = saveStdErr - ''' if hasattr(method, '__qualname__'): funcName = method.__qualname__ diff --git a/music21/common/formats.py b/music21/common/formats.py index 7d9bf7cce..40bbbc64b 100644 --- a/music21/common/formats.py +++ b/music21/common/formats.py @@ -73,7 +73,6 @@ def findSubConverterForFormat(fmt: str) -> type[SubConverter]|None: >>> common.findSubConverterForFormat('t') - ''' fmt = fmt.lower().strip() from music21 import converter diff --git a/music21/common/numberTools.py b/music21/common/numberTools.py index 21c798fad..34eb8cbd5 100644 --- a/music21/common/numberTools.py +++ b/music21/common/numberTools.py @@ -931,7 +931,6 @@ def groupContiguousIntegers(src: list[int]) -> list[list[int]]: # noinspection SpellCheckingInspection def fromRoman(num: str, *, strictModern: bool = False) -> int: ''' - Convert a Roman numeral (upper or lower) to an int https://code.activestate.com/recipes/81611-roman-numerals/ diff --git a/music21/configure.py b/music21/configure.py index 772cee6ab..06ffbecdd 100644 --- a/music21/configure.py +++ b/music21/configure.py @@ -318,7 +318,6 @@ def prependPromptHeader(self, msg): def appendPromptHeader(self, msg): ''' - >>> d = configure.Dialog() >>> d.appendPromptHeader('test') >>> d._promptHeader diff --git a/music21/converter/subConverters.py b/music21/converter/subConverters.py index 2cfea252b..f505ce45d 100644 --- a/music21/converter/subConverters.py +++ b/music21/converter/subConverters.py @@ -61,7 +61,6 @@ class SubConverter: codecWrite = True or False (default False) if encodings need to be used to write stringEncoding = string (default 'utf-8'). If codecWrite is True, this specifies what encoding to use - ''' readBinary: bool = False canBePickled: bool = True diff --git a/music21/corpus/__init__.py b/music21/corpus/__init__.py index 7b4982374..f369e711f 100644 --- a/music21/corpus/__init__.py +++ b/music21/corpus/__init__.py @@ -109,7 +109,6 @@ def getCorePaths( >>> abcFilePaths = corpus.getCorePaths(fileExtensions=('abc',)) >>> len(abcFilePaths) >= 100 True - ''' return corpora.CoreCorpus().getPaths( fileExtensions=fileExtensions, @@ -267,7 +266,6 @@ def noCorpus(): >>> corpus.noCorpus() False - ''' return corpora.CoreCorpus().noCorpus diff --git a/music21/corpus/corpora.py b/music21/corpus/corpora.py index b394dc8b9..651d28485 100644 --- a/music21/corpus/corpora.py +++ b/music21/corpus/corpora.py @@ -292,7 +292,6 @@ def getWorkList( >>> len(coreCorpus.getWorkList('verdi')) 1 - ''' if str(workName).startswith('schumann/'): # pragma: no cover # no default schumanns, but older examples showed this. @@ -396,7 +395,6 @@ def search( ... field='noteCount', ... ) - ''' return self.metadataBundle.search( query, @@ -660,7 +658,6 @@ def manualCoreCorpusPath(self): >>> #_DOCS_SHOW coreCorpus.manualCoreCorpusPath is None >>> True #_DOCS_HIDE True - ''' userSettings = environment.UserSettings() if 'manualCoreCorpusPath' in userSettings.keys(): @@ -967,7 +964,6 @@ def name(self): >>> corpus.corpora.LocalCorpus('funkCorpus').name 'funkCorpus' - ''' if self._name is None: return 'local' diff --git a/music21/corpus/manager.py b/music21/corpus/manager.py index f3fd0bba4..5632bd325 100644 --- a/music21/corpus/manager.py +++ b/music21/corpus/manager.py @@ -296,7 +296,6 @@ def search( If ``corpusNames`` is None, all corpora known to music21 will be searched. See usersGuide (chapter 11) for more information on searching - ''' # >>> corpus.search('coltrane', corpusNames=('virtual',)) # diff --git a/music21/corpus/virtual.py b/music21/corpus/virtual.py index 599448bd4..747264f73 100644 --- a/music21/corpus/virtual.py +++ b/music21/corpus/virtual.py @@ -77,7 +77,6 @@ def getUrlByExt(self, extList=None): class BachBWV1007Prelude(VirtualWork): ''' - >>> a = corpus.virtual.BachBWV1007Prelude() >>> a.getUrlByExt('.xml') ['https://kern.ccarh.org/cgi-bin/ksdata?l=cc/bach/cello&file=bwv1007-01.krn&f=xml'] diff --git a/music21/duration.py b/music21/duration.py index a0af8d046..0f5616adb 100644 --- a/music21/duration.py +++ b/music21/duration.py @@ -331,7 +331,6 @@ def dottedMatch(qLen: OffsetQLIn, >>> duration.dottedMatch(0.00001, 2) (False, False) - ''' for dots in range(maxDots + 1): # assume qLen has n dots, so find its non-dotted length @@ -1268,7 +1267,6 @@ def setDurationType( >>> a.setDurationType(4.0) >>> a.totalTupletLength() 8.0 - ''' self._checkFrozen() if not isinstance(durType, str): diff --git a/music21/dynamics.py b/music21/dynamics.py index 146ea7978..b4bf812ea 100644 --- a/music21/dynamics.py +++ b/music21/dynamics.py @@ -27,27 +27,27 @@ shortNames = ['pppppp', 'ppppp', 'pppp', 'ppp', 'pp', 'p', 'mp', - 'mf', 'f', 'fp', 'sf', 'ff', 'fff', 'ffff', 'fffff', 'ffffff'] + 'mf', 'f', 'fp', 'sf', 'ff', 'fff', 'ffff', 'fffff', 'ffffff'] longNames = {'ppp': 'pianississimo', - 'pp': 'pianissimo', - 'p': 'piano', - 'mp': 'mezzopiano', - 'mf': 'mezzoforte', - 'f': 'forte', - 'fp': 'fortepiano', - 'sf': 'sforzando', - 'ff': 'fortissimo', - 'fff': 'fortississimo'} + 'pp': 'pianissimo', + 'p': 'piano', + 'mp': 'mezzopiano', + 'mf': 'mezzoforte', + 'f': 'forte', + 'fp': 'fortepiano', + 'sf': 'sforzando', + 'ff': 'fortissimo', + 'fff': 'fortississimo'} # could be really useful for automatic description of musical events englishNames = {'ppp': 'extremely soft', - 'pp': 'very soft', - 'p': 'soft', - 'mp': 'moderately soft', - 'mf': 'moderately loud', - 'f': 'loud', - 'ff': 'very loud', - 'fff': 'extremely loud'} + 'pp': 'very soft', + 'p': 'soft', + 'mp': 'moderately soft', + 'mf': 'moderately loud', + 'f': 'loud', + 'ff': 'very loud', + 'fff': 'extremely loud'} def dynamicStrFromDecimal(n): @@ -172,7 +172,6 @@ class Dynamic(base.Music21Object): .. image:: images/dynamics_simple.* :width: 344 - ''' classSortOrder = 10 _styleClass = style.TextStyle diff --git a/music21/editorial.py b/music21/editorial.py index 8ece0a43c..7dde23f38 100644 --- a/music21/editorial.py +++ b/music21/editorial.py @@ -72,7 +72,6 @@ class Editorial(prebase.ProtoM21Object, dict): .. image:: images/noteEditorialFictaSharp.* :width: 103 - ''' _DOC_ATTR: dict[str, str] = { 'comments': ''' diff --git a/music21/environment.py b/music21/environment.py index dd724a2de..2d805c429 100644 --- a/music21/environment.py +++ b/music21/environment.py @@ -941,7 +941,6 @@ def getKeysToPaths(self): 'musicxmlPath' 'pdfPath' 'vectorPath' - ''' return envSingleton().getKeysToPaths() diff --git a/music21/expressions.py b/music21/expressions.py index 23674a0d4..fbecb96bf 100644 --- a/music21/expressions.py +++ b/music21/expressions.py @@ -179,7 +179,6 @@ class RehearsalMark(Expression): >>> rm = expressions.RehearsalMark('B') >>> rm - ''' classSortOrder = -30 _styleClass = style.TextStylePlacement @@ -220,7 +219,6 @@ def _getNumberingFromContent(c) -> str|None: >>> print(ex._getNumberingFromContent('*')) None - ''' if c is None: return None @@ -584,8 +582,8 @@ def realize( keySig: key.KeySignature|None = None, inPlace: bool = False ) -> tuple[list[note.Note|note.Unpitched], - note.Note|note.Unpitched|None, - list[note.Note|note.Unpitched]]: + note.Note|note.Unpitched|None, + list[note.Note|note.Unpitched]]: ''' Subclassable method call that takes a sourceObject and optional keySig and returns a three-element tuple of a list of notes before the @@ -704,7 +702,6 @@ def name(self) -> str: >>> invertedMordent = expressions.InvertedMordent(accidental=sharp) >>> invertedMordent.name 'inverted mordent (sharp)' - ''' theName: str = super().name if self.accidental is not None: @@ -914,8 +911,8 @@ def realize( keySig: key.KeySignature|None = None, inPlace: bool = False ) -> tuple[list[note.Note|note.Unpitched], - note.Note|note.Unpitched|None, - list[note.Note|note.Unpitched]]: + note.Note|note.Unpitched|None, + list[note.Note|note.Unpitched]]: ''' Realize a mordent. @@ -1270,7 +1267,6 @@ class Trill(Ornament): The size property has been removed and replaced with `.getSize()` (which requires a `srcObj` and optional `keySig` param). Added optional `keySig` param to `.realize()` as well. - ''' _direction: str = 'up' @@ -1299,7 +1295,6 @@ def name(self) -> str: >>> doubleSharpedTrill = expressions.Trill(accidental=pitch.Accidental('double-sharp')) >>> doubleSharpedTrill.name 'trill (double-sharp)' - ''' theName: str = super().name if self.accidental: @@ -1581,8 +1576,8 @@ def realize( keySig: key.KeySignature|None = None, inPlace: bool = False ) -> tuple[list[note.Note|note.Unpitched], - note.Note|note.Unpitched|None, - list[note.Note|note.Unpitched]]: + note.Note|note.Unpitched|None, + list[note.Note|note.Unpitched]]: ''' Realize a trill. @@ -1992,7 +1987,6 @@ def name(self) -> str: ... delay=1.0, lowerAccidental=pitch.Accidental('double-flat')) >>> delayedBy1Turn.name 'delayed(delayQL=1.0) turn (lower=double-flat)' - ''' theName: str = super().name if self.delay == OrnamentDelay.DEFAULT_DELAY: @@ -2455,8 +2449,8 @@ def realize( keySig: key.KeySignature|None = None, inPlace: bool = False ) -> tuple[list[note.Note|note.Unpitched], - note.Note|note.Unpitched|None, - list[note.Note|note.Unpitched]]: + note.Note|note.Unpitched|None, + list[note.Note|note.Unpitched]]: ''' Realize an appoggiatura. @@ -2603,8 +2597,8 @@ def realize( keySig: key.KeySignature|None = None, inPlace: bool = False ) -> tuple[list[note.Note|note.Unpitched], - note.Note|note.Unpitched|None, - list[note.Note|note.Unpitched]]: + note.Note|note.Unpitched|None, + list[note.Note|note.Unpitched]]: ''' Realize the ornament. diff --git a/music21/features/base.py b/music21/features/base.py index f26214c57..d428c8228 100644 --- a/music21/features/base.py +++ b/music21/features/base.py @@ -213,7 +213,6 @@ def getAttributeLabels(self) -> list[str]: 'Fifths_Pitch_Histogram_3', 'Fifths_Pitch_Histogram_4', 'Fifths_Pitch_Histogram_5', 'Fifths_Pitch_Histogram_6', 'Fifths_Pitch_Histogram_7', 'Fifths_Pitch_Histogram_8', 'Fifths_Pitch_Histogram_9', 'Fifths_Pitch_Histogram_10', 'Fifths_Pitch_Histogram_11'] - ''' post: list[str] = [] if self.dimensions == 1: @@ -1224,7 +1223,6 @@ def extractorsById(idOrList: str|Iterable[str], >>> y = [x.id for x in features.extractorsById('all')] >>> y[0:3], y[-3:-1] (['M1', 'M2', 'M3'], ['CS12', 'MC1']) - ''' from music21.features import jSymbolic from music21.features import native @@ -1268,7 +1266,6 @@ def extractorById(idOrList: str|Iterable[str], >>> fe = features.extractorById('p20')(s) # call class >>> fe.extract().vector [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] - ''' ebi = extractorsById(idOrList=idOrList, library=library) if ebi: @@ -1358,11 +1355,11 @@ def testStreamFormsA(self): '3-8': 2, '3-2': 2}) self.assertEqual(di['chordify.flat.getElementsByClass(Chord).typesHistogram'], - {'isMinorTriad': 6, 'isAugmentedTriad': 0, - 'isTriad': 34, 'isSeventh': 0, 'isDiminishedTriad': 4, - 'isDiminishedSeventh': 0, 'isIncompleteMajorTriad': 26, - 'isHalfDiminishedSeventh': 0, 'isMajorTriad': 24, - 'isDominantSeventh': 0, 'isIncompleteMinorTriad': 16}) + {'isMinorTriad': 6, 'isAugmentedTriad': 0, + 'isTriad': 34, 'isSeventh': 0, 'isDiminishedTriad': 4, + 'isDiminishedSeventh': 0, 'isIncompleteMajorTriad': 26, + 'isHalfDiminishedSeventh': 0, 'isMajorTriad': 24, + 'isDominantSeventh': 0, 'isIncompleteMinorTriad': 16}) self.assertEqual(di['flat.notes.quarterLengthHistogram'], {0.5: 116, 1.0: 39, 1.5: 27, 2.0: 31, 3.0: 2, 4.0: 3, @@ -1653,8 +1650,8 @@ def x_testRegionClassificationJSymbolicB(self): # pragma: no cover # features common to both collections featureExtractors = features.extractorsById( ['r31', 'r32', 'r33', 'r34', 'r35', 'p1', 'p2', 'p3', 'p4', - 'p5', 'p6', 'p7', 'p8', 'p9', 'p10', 'p11', 'p12', 'p13', - 'p14', 'p15', 'p16', 'p19', 'p20', 'p21'], 'jSymbolic') + 'p5', 'p6', 'p7', 'p8', 'p9', 'p10', 'p11', 'p12', 'p13', + 'p14', 'p15', 'p16', 'p19', 'p20', 'p21'], 'jSymbolic') # first bundle ds = features.DataSet(classLabel='Region') diff --git a/music21/features/jSymbolic.py b/music21/features/jSymbolic.py index dc48ea6ab..e98a8b876 100644 --- a/music21/features/jSymbolic.py +++ b/music21/features/jSymbolic.py @@ -102,7 +102,6 @@ def process(self) -> None: class MostCommonMelodicIntervalFeature(featuresModule.FeatureExtractor): ''' - >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.MostCommonMelodicIntervalFeature(s) >>> f = fe.extract() @@ -129,7 +128,6 @@ def process(self) -> None: class DistanceBetweenMostCommonMelodicIntervalsFeature( featuresModule.FeatureExtractor): ''' - >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.DistanceBetweenMostCommonMelodicIntervalsFeature(s) >>> f = fe.extract() @@ -192,7 +190,6 @@ def process(self) -> None: class RelativeStrengthOfMostCommonIntervalsFeature( featuresModule.FeatureExtractor): ''' - >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.RelativeStrengthOfMostCommonIntervalsFeature(s) >>> f = fe.extract() @@ -856,7 +853,6 @@ def process(self) -> None: class RelativeStrengthOfTopPitchClassesFeature(featuresModule.FeatureExtractor): ''' - >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.RelativeStrengthOfTopPitchClassesFeature(s) >>> fe.extract().vector @@ -924,7 +920,6 @@ def process(self) -> None: class IntervalBetweenStrongestPitchClassesFeature( featuresModule.FeatureExtractor): ''' - >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.IntervalBetweenStrongestPitchClassesFeature(s) >>> fe.extract().vector @@ -1495,7 +1490,6 @@ class VibratoPrevalenceFeature(featuresModule.FeatureExtractor): Number of notes for which Pitch Bend messages change direction at least twice divided by total number of notes that have Pitch Bend messages associated with them. - ''' id = 'P25' name = 'Vibrato Prevalence' @@ -1516,7 +1510,6 @@ class PrevalenceOfMicrotonesFeature(featuresModule.FeatureExtractor): Number of Note Ons that are preceded by isolated MIDI Pitch Bend messages as a fraction of the total number of Note Ons.' - ''' id = 'P26' name = 'Prevalence Of Microtones' @@ -1580,7 +1573,6 @@ class SecondStrongestRhythmicPulseFeature(featuresModule.FeatureExtractor): >>> f = fe.extract() >>> f.vector [192] - ''' id = 'R2' name = 'Second Strongest Rhythmic Pulse' @@ -1616,7 +1608,6 @@ class HarmonicityOfTwoStrongestRhythmicPulsesFeature( >>> f = fe.extract() >>> f.vector [0.5] - ''' id = 'R3' name = 'Harmonicity of Two Strongest Rhythmic Pulses' @@ -1699,7 +1690,6 @@ class StrengthRatioOfTwoStrongestRhythmicPulsesFeature( >>> fe = features.jSymbolic.StrengthRatioOfTwoStrongestRhythmicPulsesFeature(sch) >>> fe.extract().vector[0] 7.0 - ''' id = 'R6' name = 'Strength Ratio of Two Strongest Rhythmic Pulses' @@ -1756,7 +1746,6 @@ class NumberOfStrongPulsesFeature(featuresModule.FeatureExtractor): Not yet implemented. Number of beat peaks with normalized frequencies over 0.1. - ''' id = 'R8' name = 'Number of Strong Pulses' @@ -1874,7 +1863,6 @@ class BeatHistogramFeature(featuresModule.FeatureExtractor): A feature extractor that finds a feature array with entries corresponding to the frequency values of each of the bins of the beat histogram (except the first 40 empty ones). - ''' id = 'R14' name = 'Beat Histogram' @@ -2608,7 +2596,6 @@ class VariationOfDynamicsFeature(featuresModule.FeatureExtractor): Standard deviation of loudness levels of all notes. TODO: implement - ''' id = 'D2' name = 'Variation of Dynamics' @@ -2623,7 +2610,6 @@ class VariationOfDynamicsInEachVoiceFeature(featuresModule.FeatureExtractor): channel that contains at least one note. TODO: implement - ''' id = 'D3' name = 'Variation of Dynamics In Each Voice' @@ -2639,7 +2625,6 @@ class AverageNoteToNoteDynamicsChangeFeature(featuresModule.FeatureExtractor): same channel (in MIDI velocity units). TODO: implement - ''' id = 'D4' @@ -2789,7 +2774,6 @@ class VoiceEqualityNoteDurationFeature(featuresModule.FeatureExtractor): Not implemented. TODO: implement - ''' id = 'T5' name = 'Voice Equality - Note Duration' @@ -2802,7 +2786,6 @@ class VoiceEqualityDynamicsFeature(featuresModule.FeatureExtractor): Not implemented. TODO: implement - ''' id = 'T6' name = 'Voice Equality - Dynamics' @@ -2815,7 +2798,6 @@ class VoiceEqualityMelodicLeapsFeature(featuresModule.FeatureExtractor): Not implemented. TODO: implement - ''' id = 'T7' name = 'Voice Equality - Melodic Leaps' @@ -2886,7 +2868,6 @@ class RelativeNoteDensityOfHighestLineFeature(featuresModule.FeatureExtractor): Not implemented. TODO: implement - ''' id = 'T13' name = 'Relative Note Density of Highest Line' @@ -3027,7 +3008,6 @@ def process(self) -> None: class NotePrevalenceOfPitchedInstrumentsFeature( featuresModule.FeatureExtractor): ''' - >>> s1 = stream.Stream() >>> s1.append(instrument.AcousticGuitar()) >>> s1.repeatAppend(note.Note(), 4) @@ -3089,7 +3069,6 @@ class NotePrevalenceOfUnpitchedInstrumentsFeature( Not implemented. TODO: implement - ''' id = 'I4' name = 'Note Prevalence of Unpitched Instruments' @@ -3118,7 +3097,6 @@ class TimePrevalenceOfPitchedInstrumentsFeature( in seconds of the piece.' TODO: implement - ''' id = 'I5' name = 'Time Prevalence of Pitched Instruments' @@ -3146,7 +3124,6 @@ class VariabilityOfNotePrevalenceOfPitchedInstrumentsFeature( >>> fe = features.jSymbolic.VariabilityOfNotePrevalenceOfPitchedInstrumentsFeature(s1) >>> fe.extract().vector [0.33333...] - ''' id = 'I6' name = 'Variability of Note Prevalence of Pitched Instruments' @@ -3190,7 +3167,6 @@ class VariabilityOfNotePrevalenceOfUnpitchedInstrumentsFeature( official standard. TODO: implement - ''' id = 'I7' name = 'Variability of Note Prevalence of Unpitched Instruments' @@ -3213,7 +3189,6 @@ class NumberOfPitchedInstrumentsFeature(featuresModule.FeatureExtractor): >>> fe = features.jSymbolic.NumberOfPitchedInstrumentsFeature(s1) >>> fe.extract().vector [2] - ''' id = 'I8' name = 'Number of Pitched Instruments' diff --git a/music21/features/native.py b/music21/features/native.py index 6a7cce173..214602229 100644 --- a/music21/features/native.py +++ b/music21/features/native.py @@ -87,7 +87,6 @@ class QualityFeature(featuresModule.FeatureExtractor): # for monophonic melodies # incomplete measures / pickups for monophonic melodies - ''' id = 'P22' name = 'Quality' @@ -741,7 +740,6 @@ class ChordBassMotionFeature(featuresModule.FeatureExtractor): 0.0, 0.0, 0.07..., 0.008...] Post 1990s music has a lot more semitone motion. - ''' id = 'CS12' name = 'Chord Bass Motion' @@ -880,7 +878,6 @@ class LanguageFeature(featuresModule.FeatureExtractor): >>> fe = features.native.LanguageFeature(s) >>> fe.extract().vector [3] - ''' id = 'TX1' name = 'Language Feature' diff --git a/music21/features/outputFormats.py b/music21/features/outputFormats.py index 5e6a06d7e..b16332981 100644 --- a/music21/features/outputFormats.py +++ b/music21/features/outputFormats.py @@ -88,7 +88,6 @@ def getHeaderLines(self, includeClassLabel: bool = True, ['Identifier', 'Changes_of_Meter', 'Composer'] ['string', 'discrete', 'discrete'] ['meta', '', 'class'] - ''' if self._dataSet is None: # pragma: no cover raise OutputFormatException('cannot get header lines without a DataSet') @@ -217,7 +216,6 @@ def getHeaderLines(self, includeClassLabel: bool = True, @ATTRIBUTE Changes_of_Meter NUMERIC @ATTRIBUTE class {} @DATA - ''' if self._dataSet is None: # pragma: no cover raise OutputFormatException('cannot get header lines without a DataSet') diff --git a/music21/figuredBass/notation.py b/music21/figuredBass/notation.py index 86c1cb862..563b24c2a 100644 --- a/music21/figuredBass/notation.py +++ b/music21/figuredBass/notation.py @@ -24,18 +24,18 @@ ''' shorthandNotation: dict[tuple[int|None, ...], tuple[int, ...]] = { - (None,): (5, 3), - (5,): (5, 3), - (6,): (6, 3), - (7,): (7, 5, 3), - (9,): (9, 7, 5, 3), - (11,): (11, 9, 7, 5, 3), - (13,): (13, 11, 9, 7, 5, 3), - (6, 5): (6, 5, 3), - (4, 3): (6, 4, 3), - (4, 2): (6, 4, 2), - (2,): (6, 4, 2), - } + (None,): (5, 3), + (5,): (5, 3), + (6,): (6, 3), + (7,): (7, 5, 3), + (9,): (9, 7, 5, 3), + (11,): (11, 9, 7, 5, 3), + (13,): (13, 11, 9, 7, 5, 3), + (6, 5): (6, 5, 3), + (4, 3): (6, 4, 3), + (4, 2): (6, 4, 2), + (2,): (6, 4, 2), +} prefixes = ['+', '#', '++', '##'] suffixes = ['\\'] @@ -641,7 +641,6 @@ def _reprInternal(self) -> str: def _toAccidental(self) -> pitch.Accidental|None: ''' - >>> from music21.figuredBass import notation as n >>> m1 = n.Modifier('#') >>> m2 = n.Modifier('-') diff --git a/music21/figuredBass/possibility.py b/music21/figuredBass/possibility.py index 6c5bc6456..7ee1e1e14 100644 --- a/music21/figuredBass/possibility.py +++ b/music21/figuredBass/possibility.py @@ -944,7 +944,6 @@ def partPairs( (, ), (, ), (, )] - ''' return list(zip(possibA, possibB, strict=True)) diff --git a/music21/figuredBass/realizer.py b/music21/figuredBass/realizer.py index 2011a6000..69e92bdb8 100644 --- a/music21/figuredBass/realizer.py +++ b/music21/figuredBass/realizer.py @@ -367,16 +367,16 @@ def retrieveSegments( previousBassNote = bassNotes[bassNoteIndex] bassNote = t.cast(note.Note, currentMapping[allKeys[0]][-1]) previousSegment = segment.OverlaidSegment(bassNote, bassNote.editorial.notationString, - self._fbScale, - fbRules, numParts, maxPitch) + self._fbScale, + fbRules, numParts, maxPitch) previousSegment.quarterLength = previousBassNote.quarterLength segmentList.append(previousSegment) for k in allKeys[1:]: (startTime, unused_endTime) = k bassNote = t.cast(note.Note, currentMapping[k][-1]) currentSegment = segment.OverlaidSegment(bassNote, bassNote.editorial.notationString, - self._fbScale, - fbRules, numParts, maxPitch) + self._fbScale, + fbRules, numParts, maxPitch) for partNumber in range(1, len(currentMapping[k])): upperPitch = t.cast(note.Note, currentMapping[k][partNumber - 1]) currentSegment.fbRules._partPitchLimits.append((partNumber, upperPitch)) @@ -456,7 +456,6 @@ def realize( >>> r4 = fbLine4.realize() >>> r4.getNumSolutions() 13 - ''' if fbRules is None: fbRules = rules.Rules() diff --git a/music21/figuredBass/segment.py b/music21/figuredBass/segment.py index ac7b18389..5bf60d481 100644 --- a/music21/figuredBass/segment.py +++ b/music21/figuredBass/segment.py @@ -211,16 +211,16 @@ def singlePossibilityRules( singlePossibRules = [ (fbRules.forbidIncompletePossibilities, - possibility.isIncomplete, - False, - [self.pitchNamesInChord]), + possibility.isIncomplete, + False, + [self.pitchNamesInChord]), (True, - possibility.upperPartsWithinLimit, - True, - [fbRules.upperPartsMaxSemitoneSeparation]), + possibility.upperPartsWithinLimit, + True, + [fbRules.upperPartsMaxSemitoneSeparation]), (fbRules.forbidVoiceCrossing, - possibility.voiceCrossing, - False) + possibility.voiceCrossing, + False) ] return singlePossibRules @@ -856,8 +856,8 @@ def _resolveOrdinarySegment( correctB = segmentB.allCorrectSinglePossibilities() correctAB = itertools.product(correctA, correctB) return filter(lambda possibAB: self._isCorrectConsecutivePossibility(possibA=possibAB[0], - possibB=possibAB[1]), - correctAB) + possibB=possibAB[1]), + correctAB) def _resolveSpecialSegment( self, diff --git a/music21/freezeThaw.py b/music21/freezeThaw.py index 3176ec6fc..a4aa36df6 100644 --- a/music21/freezeThaw.py +++ b/music21/freezeThaw.py @@ -230,7 +230,6 @@ def packStream(self, streamObj=None): >>> sf = freezeThaw.StreamFreezer(s) >>> pprint(sf.packStream()) {'m21Version': (...), 'stream': } - ''' # do all things necessary to set up the stream if streamObj is None: @@ -442,7 +441,6 @@ def setupStoredElementOffsetTuples(self, streamObj): (, 'end')] >>> s2._storedElementOffsetTuples[2][0] is v1 True - ''' if hasattr(streamObj, '_storedElementOffsetTuples'): # in the case of a spanner storing a Stream, like a StaffGroup @@ -1208,9 +1206,9 @@ def testPickleMidi(self): from music21 import note a = str(common.getSourceFilePath() - / 'midi' - / 'testPrimitive' - / 'test03.mid') + / 'midi' + / 'testPrimitive' + / 'test03.mid') # a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi' c = converter.parse(a) diff --git a/music21/graph/__init__.py b/music21/graph/__init__.py index aa362942d..6e86c6f19 100644 --- a/music21/graph/__init__.py +++ b/music21/graph/__init__.py @@ -134,7 +134,6 @@ def plotStream( .. image:: images/HorizontalBarPitchSpaceOffset.* :width: 600 - ''' plotMake = findPlot.getPlotsToMake(graphFormat, xValue, yValue, zValue) # environLocal.printDebug(['plotClassName found', plotMake]) diff --git a/music21/graph/axis.py b/music21/graph/axis.py index 30630ebd8..b2c20cb6e 100644 --- a/music21/graph/axis.py +++ b/music21/graph/axis.py @@ -121,7 +121,6 @@ def _reprInternal(self): >>> axStream = graph.axis.DynamicsAxis(s, axisName='y') >>> axStream - ''' c = self.client if c is not None: @@ -315,7 +314,7 @@ class PitchAxis(Axis): labelDefault = 'Pitch' quantities: tuple[str, ...] = ('pitchGeneric', ) - def __init__(self, client=None, axisName='x'): + def __init__(self, client=None, axisName='x') -> None: super().__init__(client, axisName) self.showOctaves: bool|t.Literal['few'] = 'few' self.showEnharmonic = True @@ -450,7 +449,7 @@ class PitchClassAxis(PitchAxis): labelDefault = 'Pitch Class' quantities: tuple[str, ...] = ('pitchClass', 'pitchclass', 'pc') - def __init__(self, client=None, axisName='x'): + def __init__(self, client=None, axisName='x') -> None: self.showOctaves: bool|t.Literal['few'] = False super().__init__(client, axisName) self.minValue = 0 @@ -1034,7 +1033,6 @@ def getOffsetMap(self): >>> om3 = ax.getOffsetMap() >>> om3 {} - ''' s = self.stream if s is None: @@ -1127,7 +1125,7 @@ class QuarterLengthAxis(PositionAxis): 'duration', ) - def __init__(self, client=None, axisName='x'): + def __init__(self, client=None, axisName='x') -> None: super().__init__(client, axisName) self.useLogScale: bool|int = True self.useDurationNames = False @@ -1322,7 +1320,6 @@ def ticks(self): >>> ax.maxValue = 6 >>> ax.ticks() [(3, '$ppp$'), (4, '$pp$'), (5, '$p$'), (6, '$mp$')] - ''' ticks = [] if self.minValue is None: diff --git a/music21/graph/findPlot.py b/music21/graph/findPlot.py index dee2df5c9..7dfd5e222 100644 --- a/music21/graph/findPlot.py +++ b/music21/graph/findPlot.py @@ -109,7 +109,6 @@ def getAxisQuantities(synonyms=False, axesToCheck=None): >>> graph.findPlot.getAxisQuantities(True, axesToCheck=theseAxes) ['count', 'quantity', 'frequency', 'counting', 'offset', 'measure', 'offsets', 'measures', 'time'] - ''' if axesToCheck is None: axesToCheck = getAxisClasses() @@ -167,7 +166,6 @@ def getPlotClassesFromFormat(graphFormat, checkPlotClasses=None): >>> pcs = [graph.plot.ScatterWeighted, graph.plot.Dolan] >>> graph.findPlot.getPlotClassesFromFormat('scatterweighted', pcs) [] - ''' graphFormat = userFormatsToFormat(graphFormat).lower() @@ -306,7 +304,6 @@ def getPlotsToMake(graphFormat: str|None = None, OrderedDict({'x': , 'y': , 'z': }))] - ''' def _bestPlotType(graphClassesToChooseFrom): # now get the best graph type from this possibly motley list diff --git a/music21/graph/plot.py b/music21/graph/plot.py index eb87a027e..058428062 100644 --- a/music21/graph/plot.py +++ b/music21/graph/plot.py @@ -671,7 +671,6 @@ class HistogramPitchClass(Histogram): .. image:: images/HistogramPitchClass.* :width: 600 - ''' axesClasses: dict[str, type[axis.Axis]] = { **Histogram.axesClasses, @@ -699,7 +698,6 @@ class HistogramQuarterLength(Histogram): .. image:: images/HistogramQuarterLength.* :width: 600 - ''' axesClasses: dict[str, type[axis.Axis]] = { **Histogram.axesClasses, @@ -779,7 +777,6 @@ class ScatterWeightedPitchClassQuarterLength(ScatterWeighted): .. image:: images/ScatterWeightedPitchClassQuarterLength.* :width: 600 - ''' axesClasses: dict[str, type[axis.Axis]] = { **ScatterWeighted.axesClasses, @@ -814,7 +811,6 @@ class ScatterWeightedPitchSpaceDynamicSymbol(ScatterWeighted): .. image:: images/ScatterWeightedPitchSpaceDynamicSymbol.* :width: 600 - ''' axesClasses: dict[str, type[axis.Axis]] = { **ScatterWeighted.axesClasses, @@ -1009,7 +1005,6 @@ class WindowedKey(WindowedAnalysis): >>> p.processorClass = analysis.discrete.TemperleyKostkaPayne >>> p.doneAction = None #_DOCS_HIDE >>> p.run() - ''' processorClassDefault = discrete.KrumhanslSchmuckler @@ -1027,7 +1022,6 @@ class WindowedAmbitus(WindowedAnalysis): :width: 600 .. image:: images/legend-WindowedAmbitus.* - ''' processorClassDefault = discrete.Ambitus @@ -1174,7 +1168,6 @@ class HorizontalBarPitchClassOffset(HorizontalBar): .. image:: images/HorizontalBarPitchClassOffset.* :width: 600 - ''' axesClasses: dict[str, type[axis.Axis]] = { **HorizontalBar.axesClasses, @@ -1305,7 +1298,6 @@ class Dolan(HorizontalBarWeighted): .. image:: images/Dolan.* :width: 600 - ''' def __init__(self, streamObj=None, **keywords): @@ -1604,7 +1596,7 @@ def testHorizontalBarPitchClassOffset(self): a = corpus.parse('bach/bwv57.8') b = HorizontalBarPitchClassOffset(a.parts[0].measures(3, 6), - title='Bach (soprano voice, mm 3-6)') + title='Bach (soprano voice, mm 3-6)') b.run() def testScatterWeightedPitchSpaceQuarterLength(self): @@ -1799,17 +1791,18 @@ def testWindowed(self, doneAction=None): minWindow=1, windowStep=windowStep, doneAction=doneAction, dpi=300) b.run() - self.assertEqual(b.graphLegend.data, + self.assertEqual( + b.graphLegend.data, [ ['Major', - [('C#', '#f0727a'), ('D', '#ffd752'), ('E', '#eeff9a'), - ('F#', '#b9f0ff'), ('A', '#bb9aff'), ('B', '#ffb5ff') - ] + [('C#', '#f0727a'), ('D', '#ffd752'), ('E', '#eeff9a'), + ('F#', '#b9f0ff'), ('A', '#bb9aff'), ('B', '#ffb5ff') + ] ], ['Minor', - [('c#', '#8c0e16'), ('', '#ffffff'), ('', '#ffffff'), - ('f#', '#558caa'), ('', '#ffffff'), ('b', '#9b519b') - ] + [('c#', '#8c0e16'), ('', '#ffffff'), ('', '#ffffff'), + ('f#', '#558caa'), ('', '#ffffff'), ('b', '#9b519b') + ] ] ] ) diff --git a/music21/graph/primitives.py b/music21/graph/primitives.py index 526c2dc4b..fe460b19e 100644 --- a/music21/graph/primitives.py +++ b/music21/graph/primitives.py @@ -739,7 +739,6 @@ class GraphColorGridLegend(Graph): .. image:: images/GraphColorGridLegend.* :width: 600 - ''' _DOC_ATTR: dict[str, str] = { 'hideLeftBottomSpines': 'bool to hide the left and bottom axis spines; default True', @@ -914,7 +913,6 @@ class GraphHorizontalBar(Graph): To make an equally spaced plot, like in a Pitch Space plot, leave empty data in the form: `('', [], {})` - ''' _DOC_ATTR: dict[str, str] = { 'barSpace': 'Amount of vertical space each bar takes; default 8', @@ -1190,7 +1188,6 @@ class GraphScatterWeighted(Graph): .. image:: images/GraphScatterWeighted.* :width: 600 - ''' _DOC_ATTR: dict[str, str] = { 'maxDiameter': 'the maximum diameter of any ellipse, default 1.25', diff --git a/music21/harmony.py b/music21/harmony.py index ec9dabb64..f9d152f2c 100644 --- a/music21/harmony.py +++ b/music21/harmony.py @@ -1177,7 +1177,6 @@ def chordSymbolFigureFromChord(inChord: chord.Chord, includeChordType=False): OMIT_FROM_DOCS >>> harmony.changeAbbreviationFor('major', '') - ''' if not inChord.pitches: return '' @@ -1212,7 +1211,6 @@ def compare(inChordNums, givenChordNums, permittedOmissions=()): The corresponding semitones are compared, and if they do not match it is determined whether this is a permitted omission, etc. - ''' m = len(givenChordNums) if m > len(inChordNums): @@ -1393,7 +1391,6 @@ def getAbbreviationListGivenChordType(chordType): >>> harmony.getAbbreviationListGivenChordType('minor-major-13th') ['mM13', 'minmaj13'] - ''' return CHORD_TYPES[chordType][1] @@ -1405,7 +1402,6 @@ def getCurrentAbbreviationFor(chordType): >>> harmony.getCurrentAbbreviationFor('dominant-seventh') '7' - ''' return getAbbreviationListGivenChordType(chordType)[0] @@ -1417,7 +1413,6 @@ def getNotationStringGivenChordType(chordType): >>> harmony.getNotationStringGivenChordType('German') '1,-3,#4,-6' - ''' return CHORD_TYPES[chordType][0] diff --git a/music21/humdrum/harmParser.py b/music21/humdrum/harmParser.py index 7cbc8c5a5..7f2d76e69 100644 --- a/music21/humdrum/harmParser.py +++ b/music21/humdrum/harmParser.py @@ -186,14 +186,14 @@ class HarmDefs: ''' # The definition for a harm expr harmExpression = (r'^(' - + accidental - + roots - + attribute - + intervals - + inversion - + alternative - + secondary - + r')$') + + accidental + + roots + + attribute + + intervals + + inversion + + alternative + + secondary + + r')$') class HarmParser: diff --git a/music21/humdrum/testFiles.py b/music21/humdrum/testFiles.py index 55927f7f0..421890d9c 100644 --- a/music21/humdrum/testFiles.py +++ b/music21/humdrum/testFiles.py @@ -93,7 +93,7 @@ ) ojibway = re.sub(r'\s\s\s\s+', '\t', - r''' + r''' !! Ojibway Indian Song !! Transcribed by Frances Densmore !! No. 84 "The Sioux Follow Me" diff --git a/music21/instrument.py b/music21/instrument.py index 16772e6d2..16becc2d6 100644 --- a/music21/instrument.py +++ b/music21/instrument.py @@ -104,7 +104,6 @@ def bundleInstruments(streamIn: stream.Stream, Bass Drum Bass Drum Cowbell - ''' if inPlace: s = streamIn @@ -332,7 +331,6 @@ def __init__(self, **keywords): class Piano(KeyboardInstrument): ''' - >>> p = instrument.Piano() >>> p.instrumentName 'Piano' @@ -398,7 +396,6 @@ def __init__(self, **keywords): class ElectricPiano(Piano): ''' - >>> p = instrument.ElectricPiano() >>> p.instrumentName 'Electric Piano' @@ -2545,7 +2542,6 @@ def getAllNamesForInstrument(instrumentClass: Instrument, 'english', 'french', 'german', 'italian', 'russian', 'spanish', and 'abbreviation'. Note that the language string is not case-sensitive, so 'German' is also fine. - ''' language = language.lower() diff --git a/music21/interval.py b/music21/interval.py index df3357e4f..2390cdaa1 100644 --- a/music21/interval.py +++ b/music21/interval.py @@ -1736,7 +1736,7 @@ def __eq__(self, other): # if self.direction != other.direction: # return False if (self.generic == other.generic - and self.specifier == other.specifier + and self.specifier == other.specifier and self.direction == other.direction): return True else: @@ -1853,7 +1853,6 @@ def direction(self) -> Direction: >>> interval.DiatonicInterval('A', 1).generic.direction - ''' if self.generic.undirected != 1: return self.generic.direction @@ -2777,7 +2776,6 @@ def intervalFromGenericAndChromatic( >>> interval.intervalFromGenericAndChromatic(1, 0.5) - ''' gIntV: GenericInterval if not isinstance(gInt, GenericInterval): @@ -4096,7 +4094,6 @@ def subtract(intervalList): 'Descending Diminished Unison' >>> a.chromatic.semitones -1 - ''' from music21 import pitch if not intervalList: diff --git a/music21/key.py b/music21/key.py index 05a2d69a0..ffc80d7ca 100644 --- a/music21/key.py +++ b/music21/key.py @@ -503,7 +503,6 @@ def alteredPitches(self) -> list[pitch.Pitch]: >>> nonTrad2.isNonTraditional = True >>> nonTrad2.alteredPitches [] - ''' if self._alteredPitches is not None: return self._alteredPitches diff --git a/music21/languageExcerpts/naturalLanguageObjects.py b/music21/languageExcerpts/naturalLanguageObjects.py index 40c8caff8..05fbd7ed2 100644 --- a/music21/languageExcerpts/naturalLanguageObjects.py +++ b/music21/languageExcerpts/naturalLanguageObjects.py @@ -211,7 +211,7 @@ def testConvertNotes(self) -> None: self.assertEqual('', repr(toNote('Heses', 'de'))) self.assertEqual('', repr(toNote('Eisis', 'de'))) self.assertEqual('', - repr(toNote('la quadruple dièse', 'fr'))) + repr(toNote('la quadruple dièse', 'fr'))) self.assertEqual('', repr(toNote('si triple bémol', 'fr'))) def testConvertChords(self) -> None: diff --git a/music21/lily/lilyObjects.py b/music21/lily/lilyObjects.py index 7b354b8fb..c7253e412 100644 --- a/music21/lily/lilyObjects.py +++ b/music21/lily/lilyObjects.py @@ -487,7 +487,6 @@ def stringOutput(self) -> str: class LyIdentifierInit(LyObject): r''' - >>> lyIdInit = lily.lilyObjects.LyIdentifierInit(string='hello') >>> print(lyIdInit) "hello" @@ -856,7 +855,6 @@ def stringOutput(self) -> str: class LyOutputDefBody(LyObject): r''' - output_def_body: output_def_head_with_mode_switch '{' | output_def_head_with_mode_switch '{' @@ -1956,7 +1954,6 @@ class LyScriptAbbreviation(LyObject): Holds a script abbreviation (for articulations etc.), one of:: ^ + - | > . _ - ''' def __init__(self, value: str = '') -> None: super().__init__() @@ -1971,7 +1968,6 @@ class LyScriptDir(LyObject): Holds a script direction abbreviation (above, below etc.), one of:: _ ^ - - ''' def __init__(self, value: str = '') -> None: super().__init__() diff --git a/music21/lily/translate.py b/music21/lily/translate.py index 35e87bed4..c573246ba 100644 --- a/music21/lily/translate.py +++ b/music21/lily/translate.py @@ -360,7 +360,6 @@ def loadObjectFromOpus(self, opusIn: stream.Opus, makeNotation: bool = True) -> def loadObjectFromScore(self, scoreIn: stream.Score, makeNotation: bool = True) -> None: r''' - creates a filled topLevelObject (lily.lilyObjects.LyLilypondTop) whose string representation accurately reflects this Score object. @@ -1153,7 +1152,6 @@ def appendContextFromNoteOrRest(self, noteOrRest: note.GeneralNote) -> None: fis' 4 - ''' # to be removed once grace notes are supported if noteOrRest.duration.isGrace: @@ -1218,7 +1216,6 @@ def appendContextFromChord(self, chordIn: chord.Chord) -> None: < c' f' aes' > 4 - ''' self.setContextForTupletStart(chordIn) self.appendBeamCode(chordIn) @@ -1362,7 +1359,6 @@ def appendBeamCode(self, noteOrChord: note.GeneralNote) -> None: [] >>> print(lpc.context) \set stemLeftBeamCount = #2 - ''' leftBeams = 0 rightBeams = 0 @@ -1421,7 +1417,6 @@ def appendStemCode(self, noteOrChord: note.GeneralNote) -> None: def lySimpleMusicFromChord(self, chordObj: chord.Chord) -> lyo.LySimpleMusic: ''' - >>> conv = lily.translate.LilypondConverter() >>> c1 = chord.Chord(['C#2', 'E4', 'D#5']) >>> c1.quarterLength = 3.5 @@ -1614,7 +1609,6 @@ def lyEmbeddedScmFromClef(self, clefObj: clef.Clef) -> lyo.LyEmbeddedScm: >>> lpEmbeddedScm = conv.lyEmbeddedScmFromClef(t8c) >>> print(lpEmbeddedScm) \clef "treble_8" - ''' dictTranslate = OrderedDict([ ('Treble8vbClef', 'treble_8'), @@ -1661,7 +1655,6 @@ def lyEmbeddedScmFromKeySignature(self, keyObj: key.KeySignature) -> lyo.LyEmbed >>> fSharp = key.KeySignature(6) >>> print(conv.lyEmbeddedScmFromKeySignature(fSharp)) \key fis \major - ''' keyAsKey = keyObj if isinstance(keyObj, key.Key) else keyObj.asKey('major') @@ -1896,7 +1889,6 @@ def lyPrefixCompositeMusicFromRelatedVariants( ) -> tuple[lyo.LyPrefixCompositeMusic, stream.Stream]: # noinspection PyShadowingNames r''' - >>> s1 = converter.parse('tinynotation: 4/4 a4 a a a a1') >>> s2 = converter.parse('tinynotation: 4/4 b4 b b b') >>> s3 = converter.parse('tinynotation: 4/4 c4 c c c') @@ -1988,7 +1980,6 @@ def lyPrefixCompositeMusicFromRelatedVariants( } - ''' # Order List @@ -2121,7 +2112,6 @@ def lyPrefixCompositeMusicFromVariant( ) -> lyo.LyPrefixCompositeMusic: # noinspection PyShadowingNames r''' - >>> pStream = converter.parse('tinynotation: 4/4 a4 b c d e4 f g a') >>> pStream.makeMeasures(inPlace=True) >>> p = stream.Part(pStream.elements) @@ -2156,7 +2146,6 @@ def lyPrefixCompositeMusicFromVariant( >>> print(lpc.addedVariants) ['london'] - ''' replacedElementsClef = replacedElements[0].getContextByClass(clef.Clef) @@ -2458,7 +2447,6 @@ def writeLyFile(self, ext: str = '', fp: str|pathlib.Path|None = None) -> pathli The extension should be ly. If fp is None then a named temporary file is created by environment.getTempFile. - ''' tloOut = str(self.topLevelObject) if fp is None: @@ -2487,7 +2475,6 @@ def runThroughLily( If skipWriting is True and a fileName is given then it will run that file through lilypond instead - ''' LILYEXEC = self.findLilyExec() if fileName is None: diff --git a/music21/mei/test_base.py b/music21/mei/test_base.py index cf3e8c225..311110bd2 100644 --- a/music21/mei/test_base.py +++ b/music21/mei/test_base.py @@ -2652,7 +2652,7 @@ def testUnit4StaffFromElement(self, mockTrans, mockClef, mockKey, mockTime, ''' # 1.) prepare elem = ETree.Element(f'{MEI_NS}staffDef', attrib={'meter.count': '1', - 'meter.unit': '3'}) + 'meter.unit': '3'}) mockTime.return_value = 'mockTime return' mockFromString.side_effect = instrument.InstrumentException # otherwise staffDefFromElement() thinks it got a real Instrument @@ -2670,7 +2670,7 @@ def testIntegration4StaffFromElement(self): ''' # 1.) prepare elem = ETree.Element(f'{MEI_NS}staffDef', attrib={'meter.count': '1', - 'meter.unit': '3'}) + 'meter.unit': '3'}) # 2.) run actual = base.staffDefFromElement(elem) @@ -2686,7 +2686,7 @@ def testStaffGrpUnit1StaffFromElement(self, mockStaffDefFE): ''' elem = ETree.Element('staffGrp') innerElems = [ETree.Element(f'{MEI_NS}staffDef', attrib={'n': str(n)}) - for n in range(4)] + for n in range(4)] for eachElem in innerElems: elem.append(eachElem) mockStaffDefFE.side_effect = lambda x, unused_y: f"processed {x.get('n')}" diff --git a/music21/metadata/__init__.py b/music21/metadata/__init__.py index e08de8796..7f6b67aa5 100755 --- a/music21/metadata/__init__.py +++ b/music21/metadata/__init__.py @@ -985,7 +985,6 @@ def __setitem__(self, key: str, value: t.Any|Iterable[t.Any]): >>> md[3] = ['180 minutes'] Traceback (most recent call last): KeyError: 'metadata key must be str' - ''' if not isinstance(key, str): raise KeyError('metadata key must be str') @@ -1990,7 +1989,6 @@ def _isStandardUniqueName(self, uniqueName: str) -> bool: >>> md._isStandardUniqueName('ambitus') False - ''' return uniqueName in properties.UNIQUE_NAME_TO_PROPERTY_DESCRIPTION @@ -2498,7 +2496,6 @@ class RichMetadata(Metadata): Because RichMetadata is a Music21Object, `quarterLength` is a property that must return the length of the RichMetadata object itself and should not have been ovewritten - ''' # CLASS VARIABLES # @@ -2566,7 +2563,6 @@ def merge(self, other, favorSelf=False): >>> richMetadata.merge(md) >>> richMetadata.title 'Concerto in F' - ''' # specifically name attributes to copy, as do not want to get all # Metadata is a m21 object diff --git a/music21/metadata/bundles.py b/music21/metadata/bundles.py index efa17c2af..3475312fb 100644 --- a/music21/metadata/bundles.py +++ b/music21/metadata/bundles.py @@ -347,7 +347,6 @@ def __eq__(self, other): True >>> bachBundle == 'foo' False - ''' if hasattr(other, '_metadataEntries'): if self._metadataEntries == other._metadataEntries: @@ -1096,7 +1095,6 @@ def read(self, filePath=None): Traceback (most recent call last): music21.exceptions21.MetadataException: Unnamed MetadataBundles have no default file path to read from. - ''' timer = common.Timer() timer.start() diff --git a/music21/metadata/caching.py b/music21/metadata/caching.py index 01b4efe1b..745b80494 100644 --- a/music21/metadata/caching.py +++ b/music21/metadata/caching.py @@ -316,7 +316,6 @@ def process_parallel(jobs, processCount=None): available cores. jobs is a list of :class:`~music21.metadata.MetadataCachingJob` objects. - ''' processCount = processCount or common.cpus() processCount = max(processCount, 1) diff --git a/music21/metadata/primitives.py b/music21/metadata/primitives.py index 8f73d12c0..3c87afcfe 100644 --- a/music21/metadata/primitives.py +++ b/music21/metadata/primitives.py @@ -453,7 +453,6 @@ def hasError(self): ... ) >>> b.hasError False - ''' for attr in self.attrNames: if getattr(self, attr + 'Error') is not None: @@ -498,9 +497,9 @@ def __eq__(self, other) -> bool: False ''' return (type(self) is type(other) - and self._data == other._data - and self._dataUncertainty == other._dataUncertainty - and self.relevance == other.relevance) + and self._data == other._data + and self._dataUncertainty == other._dataUncertainty + and self.relevance == other.relevance) def _reprInternal(self) -> str: return str(self) diff --git a/music21/meter/base.py b/music21/meter/base.py index 835752ba9..e0bd30566 100644 --- a/music21/meter/base.py +++ b/music21/meter/base.py @@ -497,7 +497,6 @@ class TimeSignature(TimeSignatureBase): >>> another44 = meter.TimeSignature() # '4/4' by default >>> one44 == another44 True - ''' _styleClass = style.TextStyle classSortOrder = 4 @@ -1261,7 +1260,6 @@ def _setDefaultAccentWeights(self, depth: int = 3) -> None: >>> ts2._setDefaultAccentWeights(3) # lower depth >>> [mt.weight for mt in ts2.accentSequence] [1.0, 0.125, 0.25, 0.125, 0.5, 0.125, 0.25, 0.125, 0.5, 0.125, 0.25, 0.125] - ''' # NOTE: this is a performance critical method firstPartitionForm: MeterSequence|int|None diff --git a/music21/meter/core.py b/music21/meter/core.py index f3fb0b52b..9a2a46876 100644 --- a/music21/meter/core.py +++ b/music21/meter/core.py @@ -682,7 +682,6 @@ def partitionByCount(self, countRequest: int, loadDefault: bool = True) -> None: >>> a.partitionByCount(11, loadDefault=False) Traceback (most recent call last): music21.exceptions21.MeterException: Cannot set partition by 11 (5/8) - ''' opts = self.getPartitionOptions() optMatch = None @@ -962,7 +961,6 @@ def subdividePartitionsEqual(self, divisions: int|None = None) -> None: >>> ms.subdividePartitionsEqual(5) Traceback (most recent call last): music21.exceptions21.MeterException: Cannot set partition by 5 (3/8) - ''' divisionsLocal: int = 1 for i in range(len(self)): @@ -1024,7 +1022,6 @@ def _subdivideNested(self, processObjList, divisions): False >>> post2[0] is ms[0][0] True - ''' for obj in processObjList: obj.subdividePartitionsEqual(divisions) @@ -1957,7 +1954,6 @@ def offsetToSpan(self, qLenPos, permitMeterModulus=False): >>> a.offsetToSpan(4.33333336, permitMeterModulus=True) (1.0, 2.0) - ''' qLenPos = opFrac(qLenPos) if qLenPos >= self.duration.quarterLength or qLenPos < 0: @@ -1997,7 +1993,6 @@ def offsetToWeight(self, qLenPos): Fraction(1, 3) >>> a.offsetToWeight(1.5) Fraction(1, 3) - ''' # Not sure what this does! qLenPos = opFrac(qLenPos) diff --git a/music21/midi/percussion.py b/music21/midi/percussion.py index 3cb11ec5e..b36105214 100644 --- a/music21/midi/percussion.py +++ b/music21/midi/percussion.py @@ -144,7 +144,6 @@ def midiPitchToInstrument(self, midiPitch: int|pitch.Pitch) -> instrument.Instru >>> oneBDInstrument.modifier '1' - ''' if isinstance(midiPitch, int): diff --git a/music21/midi/translate.py b/music21/midi/translate.py index f39564330..6f80058da 100644 --- a/music21/midi/translate.py +++ b/music21/midi/translate.py @@ -177,7 +177,6 @@ def ticksToDuration( '64th' >>> d2.components[2].dots 1 - ''' if inputM21DurationObject is None: d = duration.Duration() @@ -984,7 +983,6 @@ def midiEventsToTimeSignature( >>> ts = midi.translate.midiEventsToTimeSignature(me2) >>> ts - ''' # http://www.sonicspot.com/guide/midifiles.html # The time signature defined with 4 bytes, a numerator, a denominator, diff --git a/music21/musedata/__init__.py b/music21/musedata/__init__.py index 941fc5e9c..91a60e14a 100644 --- a/music21/musedata/__init__.py +++ b/music21/musedata/__init__.py @@ -159,7 +159,6 @@ def isBack(self): def _getPitchParameters(self): ''' - >>> mdr = musedata.MuseDataRecord('Ef4 1 s d ==') >>> mdr.isNote() True @@ -397,7 +396,6 @@ def getBeams(self): >>> mdr = musedata.MuseDataRecord('E2 4 q u') >>> mdr.getBeams() is None True - ''' if self.stage == 1: return None @@ -458,7 +456,6 @@ def getArticulationObjects(self): >>> mdr = musedata.MuseDataRecord('C4 12 e u [ .p>') >>> mdr.getArticulationObjects() [, ] - ''' from music21 import articulations post = [] @@ -498,7 +495,6 @@ def getExpressionObjects(self): >>> mdr = musedata.MuseDataRecord('C4 12 e u [ .p>F') >>> mdr.getExpressionObjects() [] - ''' from music21 import expressions post = [] @@ -540,8 +536,8 @@ def getDynamicObjects(self): return post # find targets from largest to smallest targets = ('ppp', 'fff', - 'pp', 'ff', 'fp', 'mp', 'mf', - 'p', 'f', 'm', 'Z', 'Zp', 'R') + 'pp', 'ff', 'fp', 'mp', 'mf', + 'p', 'f', 'm', 'Z', 'Zp', 'R') for target in targets: pos = data.find(target) if pos < 0: @@ -574,7 +570,6 @@ def hasCautionaryAccidental(self): >>> mdr = musedata.MuseDataRecord('C4 12 e u [') >>> mdr.hasCautionaryAccidental() False - ''' data = self._getAdditionalNotations() if data is None: @@ -833,7 +828,6 @@ def _scrubStage1(self, src): def _getDigitsFollowingTag(self, line, tag): ''' - >>> mdp = musedata.MuseDataPart() >>> mdp._getDigitsFollowingTag('junk WK#:2345', 'WK#:') '2345' @@ -864,7 +858,6 @@ def _getDigitsFollowingTag(self, line, tag): def _getAlphasFollowingTag(self, line, tag, keepSpace=False, keepCase=False): ''' - >>> mdp = musedata.MuseDataPart() >>> mdp._getAlphasFollowingTag('Group memberships: sound, score', 'Group memberships:') 'sound,score' @@ -1386,7 +1379,6 @@ def getDivisionsPerQuarterNote(self): def _getMeasureBoundaryIndices(self, src=None): ''' - >>> mdp = musedata.MuseDataPart() >>> mdp.stage is None True diff --git a/music21/musedata/translate.py b/music21/musedata/translate.py index 58ded0dd5..794f7800a 100644 --- a/music21/musedata/translate.py +++ b/music21/musedata/translate.py @@ -43,7 +43,6 @@ def _musedataBeamToBeams(beamSymbol): >>> translate._musedataBeamToBeams(r']/') # must escape backslash /> - ''' from music21 import beam @@ -367,7 +366,7 @@ def testBasic(self): from music21 import common fp1 = (common.getSourceFilePath() - / 'musedata' / 'testPrimitive' / 'test01' / '01.md') + / 'musedata' / 'testPrimitive' / 'test01' / '01.md') mdw = musedata.MuseDataWork() mdw.addFile(fp1) diff --git a/music21/musicxml/m21ToXml.py b/music21/musicxml/m21ToXml.py index d859d1ff6..605810d91 100644 --- a/music21/musicxml/m21ToXml.py +++ b/music21/musicxml/m21ToXml.py @@ -218,7 +218,6 @@ def _setTagTextFromAttribute( >>> subEl = seta(acc, e, 'alter', transform=int) >>> subEl.text '-2' - ''' if attributeName is None: attributeName = common.hyphenToCamelCase(tag) @@ -543,7 +542,6 @@ def fromDynamic(self, dynamicObject): ''' Provide a complete MusicXML string from a single dynamic by putting it into a Stream first. - ''' dCopy = copy.deepcopy(dynamicObject) out = stream.Stream() @@ -1233,7 +1231,6 @@ def staffLayoutToXmlStaffLayout(self, staffLayout, mxStaffLayoutIn=None): 40.0 - ''' if mxStaffLayoutIn is None: mxStaffLayout = Element('staff-layout') @@ -1494,7 +1491,6 @@ def scorePreliminaries(self) -> None: 0 >>> emptySX.spannerBundle - ''' self.setScoreLayouts() self.setMeterStream() @@ -2482,7 +2478,6 @@ def getSupports(self) -> list[Element]: >>> SX.stream.definesExplicitPageBreaks = True >>> SX.dump(SX.getSupports()[-1]) - ''' def getSupport(element: str, supports_type: bool, attribute: str|None = None, value: str|None = None): @@ -3193,7 +3188,6 @@ def moveForward(self, byOffset: OffsetQL): >>> len(MEX.xmlRoot) 1 - ''' amountToMoveForward: int = int(round(byOffset * self.currentDivisions)) if amountToMoveForward: @@ -4785,7 +4779,6 @@ def tupletToTimeModification(self, tup) -> Element: - ''' mxTimeModification = Element('time-modification') _setTagTextFromAttribute(tup, mxTimeModification, 'actual-notes', 'numberNotesActual') @@ -6235,7 +6228,6 @@ def dynamicToXml(self, d: dynamics.Dynamic) -> Element: 10080 - ''' mxDynamics = Element('dynamics') synchronizeIds(mxDynamics, d) @@ -6295,7 +6287,6 @@ def segnoToXml(self, segno: repeat.Segno) -> Element: - ''' mxSegno = Element('segno') synchronizeIds(mxSegno, segno) @@ -6448,7 +6439,6 @@ def tempoIndicationToXml(self, ti: tempo.TempoIndication) -> Element: Andante - ''' # if writing just a sound tag, place an empty words tag in a # direction type and then follow with sound declaration @@ -7516,7 +7506,6 @@ def intervalToXmlTranspose(self, i=None): -2 -1 - ''' # TODO: number attribute (staff number) # TODO: double empty attribute diff --git a/music21/musicxml/partStaffExporter.py b/music21/musicxml/partStaffExporter.py index b266576db..3cce7b8b3 100644 --- a/music21/musicxml/partStaffExporter.py +++ b/music21/musicxml/partStaffExporter.py @@ -85,8 +85,8 @@ def addStaffTags( mxStaff = Element('staff') mxStaff.text = str(staffNumber) helpers.insertBeforeElements(tag, mxStaff, - tagList=['beam', 'notations', 'lyric', 'play', - 'sound']) + tagList=['beam', 'notations', 'lyric', 'play', + 'sound']) class PartStaffExporterMixin: @@ -423,8 +423,8 @@ def makeDivider(inner_sourceNumber: int|str) -> Element[t.Any]: # Or, gap in measure numbers in the subsequent part: keep iterating through target if (sourceNumber is not None - and targetNumber is not None - and helpers.measureNumberComesBefore(targetNumber, sourceNumber)): + and targetNumber is not None + and helpers.measureNumberComesBefore(targetNumber, sourceNumber)): continue # sourceMeasure is not None! # Or, gap in measure numbers in target: record necessary insertions until gap is closed @@ -587,7 +587,7 @@ def isMultiAttribute(m21Class: type[M21ObjType], mxAttributes, mxStaves, tagList=['part-symbol', 'instruments', 'clef', 'staff-details', - 'transpose', 'directive', 'measure-style'] + 'transpose', 'directive', 'measure-style'] ) if multiKey and mxAttributes is not None: diff --git a/music21/musicxml/test_xmlToM21.py b/music21/musicxml/test_xmlToM21.py index b9e5047fb..21987c6a4 100644 --- a/music21/musicxml/test_xmlToM21.py +++ b/music21/musicxml/test_xmlToM21.py @@ -813,7 +813,8 @@ def testBarException(self): def testChordSymbolException(self): MP = MeasureParser() mxHarmony = self.EL('A' - 'add') + '' + 'add') with self.assertRaisesRegex(MusicXMLImportException, 'degree-value missing'): MP.xmlToChordSymbol(mxHarmony) @@ -1548,7 +1549,7 @@ def testDirectionPosition(self): # TextExpression s = converter.parse(testPrimitive.textExpressions) positionedEls = [el for el in s.recurse() if el.hasStyleInformation - and el.style.relativeX is not None] + and el.style.relativeX is not None] self.assertEqual(len(positionedEls), 3) self.assertEqual( list(set(type(el) for el in positionedEls)), @@ -1558,7 +1559,7 @@ def testDirectionPosition(self): # Wedge s = corpus.parse('beach') positionedEls = [el for el in s.recurse() if el.hasStyleInformation - and el.style.relativeX is not None] + and el.style.relativeX is not None] self.assertEqual(len(positionedEls), 40) self.assertEqual( sorted(set(type(el) for el in positionedEls), key=repr), @@ -1617,7 +1618,7 @@ def testClearingTuplets(self): d = duration.Duration(2 / 3) self.assertEqual(len(d.tuplets), 1) mxNoteNoType = EL('D6' - '3') + '3') MP.xmlToDuration(mxNoteNoType, inputM21=d) self.assertEqual(len(d.tuplets), 0) self.assertEqual(d.linked, True) diff --git a/music21/musicxml/xmlObjects.py b/music21/musicxml/xmlObjects.py index 2342e50d8..7c8babf78 100644 --- a/music21/musicxml/xmlObjects.py +++ b/music21/musicxml/xmlObjects.py @@ -154,7 +154,6 @@ def booleanToYesNo(value): >>> musicxml.xmlObjects.booleanToYesNo(5) 'yes' - ''' if value: # purposely not "is True" return 'yes' @@ -173,7 +172,6 @@ def fractionToPercent(value): >>> musicxml.xmlObjects.fractionToPercent(0.251) '25' - ''' return str(int(value * 100)) @@ -205,7 +203,6 @@ def isValidXSDID(text): >>> musicxml.xmlObjects.isValidXSDID(12345) False - ''' if not isinstance(text, str): return False diff --git a/music21/musicxml/xmlToM21.py b/music21/musicxml/xmlToM21.py index cc7a9b2e7..df091660f 100644 --- a/music21/musicxml/xmlToM21.py +++ b/music21/musicxml/xmlToM21.py @@ -899,7 +899,6 @@ def parsePartList(self, mxScore): entries into self.mxScorePartDict[partId] and adds them to any open entries, stored as PartGroup objects in self.partGroupList - ''' mxPartList = mxScore.find('part-list') if mxPartList is None: @@ -2246,8 +2245,8 @@ def adjustTimeAttributesFromMeasure(self, m: stream.Measure): # 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, 1 / 12)[1] < tol): + or nearestMultiple(diff, 0.0625)[1] < tol + or nearestMultiple(diff, 1 / 12)[1] < tol): mOffsetShift = mHighestTime else: mOffsetShift = lastTimeSignatureQuarterLength @@ -2336,7 +2335,6 @@ def applyMultiMeasureRest(self, r: note.Rest): >>> pp.applyMultiMeasureRest(r3) >>> pp.stream.show('text') {0.0} - ''' if self.activeMultiMeasureRestSpanner is None: return @@ -5096,8 +5094,8 @@ def findM21VoiceFromXmlVoice( useVoice = self.lastVoice if useVoice is None: # pragma: no cover warnings.warn('Cannot put in an element with a missing voice tag when ' - + 'no previous voice tag was given. Assuming voice 1... ', - MusicXMLWarning, stacklevel=2) + + 'no previous voice tag was given. Assuming voice 1... ', + MusicXMLWarning, stacklevel=2) useVoice = 1 thisVoice: stream.Voice|None = None diff --git a/music21/note.py b/music21/note.py index 1f1fd4f6a..9c0ff2a28 100644 --- a/music21/note.py +++ b/music21/note.py @@ -1761,7 +1761,6 @@ def transpose(self, value, *, inPlace=False): {0.0} {1.0} {1.0} - ''' from music21 import key if isinstance(value, interval.IntervalBase): diff --git a/music21/noteworthy/binaryTranslate.py b/music21/noteworthy/binaryTranslate.py index f9a292ced..5cc3da30c 100644 --- a/music21/noteworthy/binaryTranslate.py +++ b/music21/noteworthy/binaryTranslate.py @@ -186,7 +186,6 @@ {36.0} {0.0} {3.0} - ''' from __future__ import annotations diff --git a/music21/noteworthy/translate.py b/music21/noteworthy/translate.py index d83f9e4f0..f4e1cc84b 100644 --- a/music21/noteworthy/translate.py +++ b/music21/noteworthy/translate.py @@ -151,7 +151,6 @@ def parseList(self, dataList): {0.0} {0.0} {0.0} - ''' # Main for pi in dataList: @@ -243,7 +242,6 @@ def setDurationForObject(self, generalNote, durationInfo): >>> nwt.setDurationForObject(n, 'Half') >>> n.duration - ''' parts = durationInfo.split(',') lengthNote = parts[0] @@ -467,7 +465,6 @@ def translateNote(self, attributes): >>> nwt.translateNote({'Dur': 'Half', 'Pos': '-3'}) >>> measure[1] - ''' durationInfo = attributes['Dur'] pitchInfo = attributes['Pos'] @@ -522,7 +519,6 @@ def translateChord(self, attributes): >>> nwt.translateChord({'Dur': ['Half'], 'Pos': ['1,3,5']}) >>> measure[1] - ''' durationInfos = attributes['Dur'] pitchInfos = attributes['Pos'] @@ -610,7 +606,6 @@ def translateRest(self, attributes): {0.0} {2.0} {2.75} - ''' durationInfo = attributes['Dur'] @@ -649,7 +644,6 @@ def createClef(self, attributes): Traceback (most recent call last): music21.noteworthy.translate.NoteworthyTranslateException: Did not find a proper clef in type, OrangeClef - ''' currentClef = None if 'OctaveShift' in attributes: @@ -778,7 +772,6 @@ def createBarlines(self, attributes): >>> nwt.currentMeasure.leftBarline - ''' self.activeAccidentals = {} diff --git a/music21/omr/correctors.py b/music21/omr/correctors.py index bbfed5318..3e3b9fc2c 100644 --- a/music21/omr/correctors.py +++ b/music21/omr/correctors.py @@ -101,7 +101,6 @@ def getAllHashes(self): def getSinglePart(self, pn): ''' returns a NEW SinglePart object for part number pn from the score - ''' return SinglePart(self.score.parts[pn], pn) @@ -167,7 +166,6 @@ def verticalProbabilityDist(self): ''' Uses a score and returns an array of probabilities. For n in the array, n is the probability that the nth part - ''' if self.distributionArray is not None: return self.distributionArray @@ -464,7 +462,6 @@ def getIncorrectMeasureIndices(self, runFast=False): >>> p[1].insert(0, meter.TimeSignature('3/8')) >>> sp.getIncorrectMeasureIndices(runFast=False) [] - ''' from music21 import meter self.incorrectMeasures = [] @@ -555,7 +552,6 @@ def runHorizontalSearch(self, i): ''' Returns an array of the indices of the minimum distance measures given a measure (with index i) to compare to. - ''' unused_probabilityDistribution = self.horizontalProbabilityDist() incorrectMeasures = self.incorrectMeasures @@ -804,7 +800,6 @@ def hashNote(self, n): def hashGrace(self, n): ''' Gives a Grace Note a duration of a 128th note - ''' graceNoteDuration = self.hashQuarterLength(0.015625) byteEncoding = chr(graceNoteDuration) @@ -886,7 +881,6 @@ def getMeasureDifference(self, hashString): >>> hasher.setSequenceMatcher() >>> hasher.getMeasureDifference('VFUF') 1.0 - ''' self.sequenceMatcher.set_seq2(hashString) @@ -1114,7 +1108,6 @@ def getProbabilityOnSubstitute(self, source, destination): Take minimum length. Compare index to index. Any additional letters in the flagged measure get graded as additions. Any additional letters in the comparison measure get graded as omissions. - ''' ls = len(source) ld = len(destination) diff --git a/music21/omr/evaluators.py b/music21/omr/evaluators.py index 32841f35e..bb8a02cd5 100644 --- a/music21/omr/evaluators.py +++ b/music21/omr/evaluators.py @@ -28,7 +28,6 @@ class OmrGroundTruthPair: (or a pair of music21.stream.Score objects). See below for examples. - ''' def __init__(self, omr=None, ground=None): @@ -178,7 +177,7 @@ def minEditDist(self, target, source): distance[i][j] = min(distance[i - 1][j] + 1, distance[i][j - 1] + 1, distance[i - 1][j - 1] - + self.substCost(source[j - 1], target[i - 1])) + + self.substCost(source[j - 1], target[i - 1])) return distance[n][m] def getDifferences(self): @@ -335,7 +334,6 @@ def autoCorrelationBestMeasure(inputScore): (18, 6) >>> print( float(totalUnflaggedWithMatches) / totalUnflagged ) 0.333... - ''' ss = correctors.ScoreCorrector(inputScore) allHashes = ss.getAllHashes() diff --git a/music21/pitch.py b/music21/pitch.py index 217fd3fb8..feb281a4d 100644 --- a/music21/pitch.py +++ b/music21/pitch.py @@ -307,9 +307,9 @@ def _convertPsToOct(ps: int|float) -> int: def _convertPsToStep( ps: int|float ) -> tuple[StepName, - Accidental, - Microtone, - int]: + Accidental, + Microtone, + int]: ''' Utility conversion; does not process internal representations. @@ -791,7 +791,6 @@ class Microtone(prebase.ProtoM21Object, SlottedObjectMixin): >>> m.alter 0.3333... - ''' # CLASS VARIABLES # @@ -2517,7 +2516,6 @@ def convertMicrotonesToQuarterTones(self, *, inPlace: bool = False) -> t.Self|No >>> p.convertMicrotonesToQuarterTones(inPlace=True) >>> str(p) 'F~2(+12c)' - ''' if inPlace: returnObj = self @@ -4622,7 +4620,6 @@ def transpose( >>> dPitch.transpose(intv, inPlace=True) >>> dPitch - ''' # environLocal.printDebug(['Pitch.transpose()', value]) if isinstance(value, interval.IntervalBase): @@ -4905,7 +4902,6 @@ def _stepInKeySignature(self, alteredPitches: list[Pitch]) -> bool: >>> b._stepInKeySignature(ks.alteredPitches) False - ''' for p in alteredPitches: # all are altered tones, must have acc if p.step == self.step: # A# to A or A# to A-, etc @@ -5048,7 +5044,7 @@ def set_displayStatus(newDisplayStatus: bool) -> None: otherSimultaneousPitches and cautionaryPitchClass and any(pSimult.step == self.step and pSimult.pitchClass != self.pitchClass - for pSimult in otherSimultaneousPitches) + for pSimult in otherSimultaneousPitches) ): set_displayStatus(True) return @@ -5283,9 +5279,9 @@ def set_displayStatus(newDisplayStatus: bool) -> None: # if An or A to A#: need to make sure display is set elif ((pPast.accidental is None or pPast.accidental.name == 'natural') - and acc is not None # redundant. for mypy - and pSelf.accidental is not None - and pSelf.accidental.name != 'natural'): + and acc is not None # redundant. for mypy + and pSelf.accidental is not None + and pSelf.accidental.name != 'natural'): acc.displayStatus = True setFromPitchPast = True break @@ -5390,7 +5386,6 @@ def getStringHarmonic(self, chordIn: chord.Chord) -> chord.Chord|t.Literal[False (, , ) otherwise returns False - ''' # Takes in a chord, finds the interval between the notes from music21 import note diff --git a/music21/repeat.py b/music21/repeat.py index 22dca1761..4ba93d5b6 100644 --- a/music21/repeat.py +++ b/music21/repeat.py @@ -491,7 +491,6 @@ def insertRepeat(s, start, end, *, inPlace=False): 'start' >>> s.parts[0].measure(6).rightBarline.direction 'end' - ''' if s is None: @@ -951,7 +950,6 @@ def _daCapoOrSegno(self): Return a DaCapo object if this piece uses any form of DaCapo; return a Segno object if this piece uses any form of Segno. Returns None if incoherent or the piece uses neither. - ''' sumDc = self._dcCount + self._dcafCount + self._dcacCount # for now, only accepting one segno @@ -1943,7 +1941,6 @@ class RepeatFinder: .. image:: images/repeat-SimplifyExample_ChoraleSimplified.* :width: 600 - ''' _DOC_ORDER = ['simplify', 'getMeasureSimilarityList', @@ -2010,7 +2007,6 @@ def getQuarterLengthOfPickupMeasure(self): Traceback (most recent call last): music21.repeat.NoInternalStreamException: RepeatFinder must be initialized with a stream - ''' if self.s is None: raise NoInternalStreamException( @@ -2218,7 +2214,7 @@ def _getSimilarMeasuresHelper(self, measures, source, compare, resDict, useDict) # we have a repeated section at least 2 measures in length; # check to see how far it goes nextOne = self._getSimilarMeasuresHelper(measures, source + 1, compare + 1, - resDict, useDict) + resDict, useDict) # make sure we don't have overlap res = ([source], [compare]) res[0].extend(nextOne[0]) @@ -2563,7 +2559,6 @@ def getSimilarMeasureGroups(self, threshold=1): Notice that although measures 2-3 are the same as measures 6-7, we don't have ([2, 3], [6, 7]) in our result, since ([1, 2, 3], [5, 6, 7]) already contains that information. - ''' # see if we've already done this computation if self._mGroups is None: diff --git a/music21/roman.py b/music21/roman.py index 51041220c..52d5df146 100644 --- a/music21/roman.py +++ b/music21/roman.py @@ -428,7 +428,6 @@ def correctSuffixForChordQuality(chordObj, inversionString): >>> c = chord.Chord('E3 C4 G-4') >>> roman.correctSuffixForChordQuality(c, '6') 'o6' - ''' fifthType = chordObj.semitonesFromChordStep(5) if fifthType == 6: @@ -1391,8 +1390,8 @@ def romanNumeralFromChord( and chordObj.isSeventhOfType((0, 3, 7, 10))): rnString = ft.prefix + stepRoman + minorSeventhSubs[inversionString] elif (not chordHasMajorThird - and inversionString in minorMajorSeventhSubs - and chordObj.isSeventhOfType((0, 3, 7, 11))): + and inversionString in minorMajorSeventhSubs + and chordObj.isSeventhOfType((0, 3, 7, 11))): rnString = ft.prefix + stepRoman + minorMajorSeventhSubs[inversionString] elif (not noKeyGiven @@ -1435,8 +1434,9 @@ def romanNumeralFromChord( try: rn = RomanNumeral(rnString, keyObj, updatePitches=False, - # correctRNAlterationForMinor() adds cautionary - sixthMinor=Minor67Default.CAUTIONARY, seventhMinor=Minor67Default.CAUTIONARY) + # correctRNAlterationForMinor() adds cautionary + sixthMinor=Minor67Default.CAUTIONARY, + seventhMinor=Minor67Default.CAUTIONARY) except fbNotation.ModifierException as strerror: # pragma: no cover raise RomanNumeralException( 'Could not parse ' @@ -2389,7 +2389,6 @@ class RomanNumeral(harmony.Harmony): >>> roman.RomanNumeral('II', 'C', caseMatters=False).impliedQuality '' - ''', 'impliedScale': ''' If no key or scale is passed in as the second object, then @@ -3021,7 +3020,6 @@ def _parseOmittedSteps(self, workingFigure: str) -> str: '13b3' >>> rn.omittedSteps [4, 2, 7] - ''' omittedSteps = [] match = self._omittedStepsRegex.search(workingFigure) @@ -3075,7 +3073,6 @@ def _parseBracketedAlterations(self, workingFigure: str) -> str: '7' >>> rn.bracketedAlterations [('#', 5), ('b', 3)] - ''' matches = self._bracketedAlterationRegex.finditer(workingFigure) for m in matches: @@ -3214,7 +3211,7 @@ def _parseRNAloneAmidstAug6( and aug6type != 'It' and workingFigure[0] == '6' and (len(workingFigure) < 2 - or not workingFigure[1].isdigit())): + or not workingFigure[1].isdigit())): # Fr6 => Fr43 workingFigure = self._aug6defaultInversions[aug6type] + workingFigure[1:] @@ -3413,8 +3410,8 @@ def _updatePitches(self) -> None: for j in range(numberNotes): i = numberNotes - j - 1 thisScaleDegree = (bassScaleDegree - + t.cast(int, self.figuresNotationObj.numbers[i]) - - 1) + + t.cast(int, self.figuresNotationObj.numbers[i]) + - 1) newPitch = t.cast(pitch.Pitch, useScale.pitchFromDegree( thisScaleDegree, direction=scale.Direction.ASCENDING)) pitchName = self.figuresNotationObj.modifiers[i].modifyPitchName(newPitch.name) @@ -3965,7 +3962,6 @@ def isNeapolitan(self, >>> rn = roman.RomanNumeral('N53') >>> rn.isNeapolitan(require1stInversion=False) True - ''' if self.scaleDegree != 2: return False diff --git a/music21/romanText/clercqTemperley.py b/music21/romanText/clercqTemperley.py index 1fa06a92d..b03687190 100644 --- a/music21/romanText/clercqTemperley.py +++ b/music21/romanText/clercqTemperley.py @@ -323,7 +323,6 @@ class CTSong(prebase.ProtoM21Object): Fadeout: I . . V | I . . V | I . . V | Co: [2/4] I | [4/4] . . . V | I . . V | $Fadeout S: [G] $In $Vr $Ch $In*2 $Ch $Vr2 $Ch $Ch $Co - """ _DOC_ORDER = ['text', 'toPart', 'title', 'homeTimeSig', 'homeKey', 'comments', 'rules'] _DOC_ATTR: dict[str, str] = { @@ -997,7 +996,6 @@ def fixupChordAtom(self, atom: str) -> str: 'vii/o7' >>> s.fixupChordAtom('iia') 'ii+' - ''' if 'x' in atom: atom = atom.replace('x', 'o') diff --git a/music21/romanText/rtObjects.py b/music21/romanText/rtObjects.py index c373ed467..a227876fc 100644 --- a/music21/romanText/rtObjects.py +++ b/music21/romanText/rtObjects.py @@ -512,7 +512,6 @@ class RTMeasure(RTToken): ['a'] >>> rtm.isMeasure() True - ''' def __init__(self, src: str = ''): @@ -911,7 +910,6 @@ class RTAnalyticKey(RTKeyTypeAtom): >>> bMinor.getKey() - ''' footerStrip = ':' diff --git a/music21/romanText/translate.py b/music21/romanText/translate.py index 0add26309..c21f3b114 100644 --- a/music21/romanText/translate.py +++ b/music21/romanText/translate.py @@ -548,7 +548,7 @@ def translateMeasureLineToken(self, measureLineToken: rtObjects.RTMeasure) -> No ''' p = self.p skipsPriorMeasures = ((measureLineToken.number[0] > self.lastMeasureNumber + 1) - and (self.previousRn is not None)) + and (self.previousRn is not None)) isSingleMeasureCopy = (len(measureLineToken.number) == 1 and measureLineToken.isCopyDefinition) isMultipleMeasureCopy = (len(measureLineToken.number) > 1) diff --git a/music21/romanText/tsvConverter.py b/music21/romanText/tsvConverter.py index 9c91ac587..9b81ac458 100644 --- a/music21/romanText/tsvConverter.py +++ b/music21/romanText/tsvConverter.py @@ -522,7 +522,6 @@ class TsvHandler: >>> out_stream = handler.toM21Stream() >>> out_stream.parts[0].measure(1)[roman.RomanNumeral][0].figure 'I' - ''' def __init__(self, tsvFile: str|pathlib.Path, dcml_version: int = 1) -> None: if dcml_version == 1: @@ -1135,7 +1134,6 @@ def getLocalKey(local_key: str, global_key: str, convertDCMLToM21: bool = False) >>> romanText.tsvConverter.getLocalKey('vii', 'a', convertDCMLToM21=True) 'g' - ''' if convertDCMLToM21: local_key = characterSwaps(local_key, minor=isMinor(global_key[0]), direction='DCML-m21') diff --git a/music21/romanText/writeRoman.py b/music21/romanText/writeRoman.py index 132564fce..58baadb69 100644 --- a/music21/romanText/writeRoman.py +++ b/music21/romanText/writeRoman.py @@ -269,7 +269,6 @@ def prepSequentialListOfLines(self) -> None: >>> testCase.combinedList[-2] 'Time Signature: 3/4' - ''' for thisMeasure in self.container.getElementsByClass(stream.Measure): @@ -388,7 +387,6 @@ def rnString(measureNumber: int|str, As these examples show, the chordString can be a Roman numeral alone (e.g. 'viio6') or one prefixed by a change of key ('G: I'). - ''' if inString: diff --git a/music21/scale/__init__.py b/music21/scale/__init__.py index 27f0af181..20ead29ff 100644 --- a/music21/scale/__init__.py +++ b/music21/scale/__init__.py @@ -629,13 +629,13 @@ def nextPitch(self, ''' net = t.cast('intervalNetwork.IntervalNetwork', self._net) post = net.nextPitch(pitchReference=pitchReference, - nodeName=nodeName, - pitchOrigin=pitchOrigin, - direction=direction, - stepSize=stepSize, - alteredDegrees=self._alteredDegrees, - getNeighbor=getNeighbor - ) + nodeName=nodeName, + pitchOrigin=pitchOrigin, + direction=direction, + stepSize=stepSize, + alteredDegrees=self._alteredDegrees, + getNeighbor=getNeighbor + ) return copy.deepcopy(post) def getNewTonicPitch(self, @@ -1061,54 +1061,54 @@ def buildNetwork(self, mode: t.Any = None) -> None: edges = ( # ascending {'interval': 'M2', - 'connections': ( - [Terminus.LOW, 0, Direction.ASCENDING], # c to d - )}, + 'connections': ( + [Terminus.LOW, 0, Direction.ASCENDING], # c to d + )}, {'interval': 'm3', - 'connections': ( - [0, 1, Direction.ASCENDING], # d to f - )}, + 'connections': ( + [0, 1, Direction.ASCENDING], # d to f + )}, {'interval': 'M2', - 'connections': ( - [1, 2, Direction.ASCENDING], # f to g - )}, + 'connections': ( + [1, 2, Direction.ASCENDING], # f to g + )}, {'interval': 'm2', - 'connections': ( - [2, 3, Direction.ASCENDING], # g to a- - )}, + 'connections': ( + [2, 3, Direction.ASCENDING], # g to a- + )}, {'interval': 'M3', - 'connections': ( - [3, Terminus.HIGH, Direction.ASCENDING], # a- to c - )}, + 'connections': ( + [3, Terminus.HIGH, Direction.ASCENDING], # a- to c + )}, # descending {'interval': 'M2', - 'connections': ( - [Terminus.HIGH, 4, Direction.DESCENDING], # c to b- - )}, + 'connections': ( + [Terminus.HIGH, 4, Direction.DESCENDING], # c to b- + )}, {'interval': 'M2', - 'connections': ( - [4, 5, Direction.DESCENDING], # b- to a- - )}, + 'connections': ( + [4, 5, Direction.DESCENDING], # b- to a- + )}, {'interval': 'm2', - 'connections': ( - [5, 6, Direction.DESCENDING], # a- to g - )}, + 'connections': ( + [5, 6, Direction.DESCENDING], # a- to g + )}, {'interval': 'M2', - 'connections': ( - [6, 7, Direction.DESCENDING], # g to f - )}, + 'connections': ( + [6, 7, Direction.DESCENDING], # g to f + )}, {'interval': 'M2', - 'connections': ( - [7, 8, Direction.DESCENDING], # f to e- - )}, + 'connections': ( + [7, 8, Direction.DESCENDING], # f to e- + )}, {'interval': 'm2', - 'connections': ( - [8, 9, Direction.DESCENDING], # e- to d - )}, + 'connections': ( + [8, 9, Direction.DESCENDING], # e- to d + )}, {'interval': 'M2', - 'connections': ( - [9, Terminus.LOW, Direction.DESCENDING], # d to c - )}, + 'connections': ( + [9, Terminus.LOW, Direction.DESCENDING], # d to c + )}, ) self._net = intervalNetwork.IntervalNetwork( @@ -1231,33 +1231,33 @@ def buildNetwork(self, mode: t.Any = None) -> None: edges = ( # all bidirectional {'interval': 'm3', - 'connections': ( - [Terminus.LOW, 0, Direction.BI], # c to e- - )}, + 'connections': ( + [Terminus.LOW, 0, Direction.BI], # c to e- + )}, {'interval': 'M2', - 'connections': ( - [0, 1, Direction.BI], # e- to f - )}, + 'connections': ( + [0, 1, Direction.BI], # e- to f + )}, {'interval': 'M2', - 'connections': ( - [1, 3, Direction.BI], # f to g - )}, + 'connections': ( + [1, 3, Direction.BI], # f to g + )}, {'interval': 'a1', - 'connections': ( - [1, 2, Direction.BI], # f to f# - )}, + 'connections': ( + [1, 2, Direction.BI], # f to f# + )}, {'interval': 'm2', - 'connections': ( - [2, 3, Direction.BI], # f# to g - )}, + 'connections': ( + [2, 3, Direction.BI], # f# to g + )}, {'interval': 'm3', - 'connections': ( - [3, 4, Direction.BI], # g to b- - )}, + 'connections': ( + [3, 4, Direction.BI], # g to b- + )}, {'interval': 'M2', - 'connections': ( - [4, Terminus.HIGH, Direction.BI], # b- to c - )}, + 'connections': ( + [4, Terminus.HIGH, Direction.BI], # b- to c + )}, ) self._net = intervalNetwork.IntervalNetwork( @@ -1992,45 +1992,45 @@ def getScaleDegreeAndAccidentalFromPitch( # noinspection SpellCheckingInspection _solfegSyllables = {1: {-2: 'def', -1: 'de', - 0: 'do', - 1: 'di', - 2: 'dis', + 0: 'do', + 1: 'di', + 2: 'dis', }, 2: {-2: 'raf', -1: 'ra', - 0: 're', - 1: 'ri', - 2: 'ris', + 0: 're', + 1: 'ri', + 2: 'ris', }, 3: {-2: 'mef', -1: 'me', - 0: 'mi', - 1: 'mis', - 2: 'mish', + 0: 'mi', + 1: 'mis', + 2: 'mish', }, 4: {-2: 'fef', -1: 'fe', - 0: 'fa', - 1: 'fi', - 2: 'fis', + 0: 'fa', + 1: 'fi', + 2: 'fis', }, 5: {-2: 'sef', -1: 'se', - 0: 'sol', - 1: 'si', - 2: 'sis', + 0: 'sol', + 1: 'si', + 2: 'sis', }, 6: {-2: 'lef', -1: 'le', - 0: 'la', - 1: 'li', - 2: 'lis', + 0: 'la', + 1: 'li', + 2: 'lis', }, 7: {-2: 'tef', -1: 'te', - 0: 'ti', - 1: 'tis', - 2: 'tish', + 0: 'ti', + 1: 'tis', + 2: 'tish', }, } # TOO SLOW! @@ -2042,45 +2042,45 @@ def getScaleDegreeAndAccidentalFromPitch( _humdrumSolfegSyllables = { 1: {-2: 'def', -1: 'de', - 0: 'do', - 1: 'di', - 2: 'dis', + 0: 'do', + 1: 'di', + 2: 'dis', }, 2: {-2: 'raf', -1: 'ra', - 0: 're', - 1: 'ri', - 2: 'ris', + 0: 're', + 1: 'ri', + 2: 'ris', }, 3: {-2: 'mef', -1: 'me', - 0: 'mi', - 1: 'my', - 2: 'mish', + 0: 'mi', + 1: 'my', + 2: 'mish', }, 4: {-2: 'fef', -1: 'fe', - 0: 'fa', - 1: 'fi', - 2: 'fis', + 0: 'fa', + 1: 'fi', + 2: 'fis', }, 5: {-2: 'sef', -1: 'se', - 0: 'so', - 1: 'si', - 2: 'sis', + 0: 'so', + 1: 'si', + 2: 'sis', }, 6: {-2: 'lef', -1: 'le', - 0: 'la', - 1: 'li', - 2: 'lis', + 0: 'la', + 1: 'li', + 2: 'lis', }, 7: {-2: 'tef', -1: 'te', - 0: 'ti', - 1: 'ty', - 2: 'tish', + 0: 'ti', + 1: 'ty', + 2: 'tish', }, } diff --git a/music21/scale/intervalNetwork.py b/music21/scale/intervalNetwork.py index 6d25c6fad..384b181a5 100644 --- a/music21/scale/intervalNetwork.py +++ b/music21/scale/intervalNetwork.py @@ -488,7 +488,6 @@ def clear(self) -> None: def __eq__(self, other) -> bool: ''' - >>> edgeList1 = ['M2', 'M2', 'm2', 'M2', 'M2', 'M2', 'm2'] >>> edgeList2 = ['M2', 'M2', 'm2', 'M2', 'A3', 'm2'] @@ -1402,10 +1401,11 @@ def nextPitch( p = self.transposePitchAndApplySimplification(intervalObj, p) else: p = self.transposePitchAndApplySimplification(intervalObj.reverse(), p) - pCollect = self.processAlteredNodes(alteredDegrees=alteredDegrees, - n=n, - p=p, - direction=direction) + pCollect = self.processAlteredNodes( + alteredDegrees=alteredDegrees, + n=n, + p=p, + direction=direction) return pCollect @@ -1588,10 +1588,11 @@ def realizeAscending( p = self.transposePitchAndApplySimplification(intervalObj, p) pCollect = p - pCollect = self.processAlteredNodes(alteredDegrees=alteredDegrees, - n=n, - p=p, - direction=Direction.ASCENDING) + pCollect = self.processAlteredNodes( + alteredDegrees=alteredDegrees, + n=n, + p=p, + direction=Direction.ASCENDING) if attempts >= maxAttempts: raise IntervalNetworkException( @@ -2054,7 +2055,6 @@ def realizePitch( ['C1', 'G1', 'D2', 'A2', 'E3', 'B3', 'F#4', 'D-5', 'A-5', 'E-6', 'B-6', 'F7', 'C8'] >>> [str(p) for p in net5ths.realizePitch(pitch.Pitch('C2'))] ['C2', 'G2', 'D3', 'A3', 'E4', 'B4', 'F#5', 'D-6', 'A-6', 'E-7', 'B-7', 'F8', 'C9'] - ''' components = self.realize( pitchReference=pitchReference, @@ -2578,7 +2578,6 @@ def getRelativeNodeDegree( 2 >>> net.getRelativeNodeDegree('f6', 1, 'b3') 1 - ''' nId = self.getRelativeNodeId( pitchReference=pitchReference, @@ -2719,7 +2718,7 @@ def getPitchFromNodeDegree( # only match this generously if we are equating termini if equateTermini: if ((realizedNId in (Terminus.HIGH, Terminus.LOW)) - and (nodeTargetId.id in (Terminus.HIGH, Terminus.LOW))): + and (nodeTargetId.id in (Terminus.HIGH, Terminus.LOW))): return realizedPitch[i] # environLocal.printDebug(['getPitchFromNodeDegree() on trial', trial, ', @@ -2821,7 +2820,6 @@ def match(self, ['B-2', 'C3', 'E-3', 'E#3', 'F2', 'E--2'] >>> unmatched [] - ''' # these return a Node, not a nodeId # TODO: just getting first diff --git a/music21/scale/scala/__init__.py b/music21/scale/scala/__init__.py index e96f7eb7f..f16122454 100644 --- a/music21/scale/scala/__init__.py +++ b/music21/scale/scala/__init__.py @@ -648,31 +648,35 @@ def testScalaScaleB(self) -> None: self.assertEqual(ss.description, 'Franck Jedrzejewski continued fractions approx. of 12-tet') - self.assertEqual([f'{x:.9f}' for x in ss.getCentsAboveTonic()], ['100.099209825', - '199.979843291', - '299.973903610', - '400.108480470', - '498.044999135', - '600.088323762', - '699.997698171', - '800.909593096', - '900.026096390', - '1000.020156709', - '1088.268714730', - '1200.000000000']) - - self.assertEqual([f'{x:.9f}' for x in ss.getAdjacentCents()], ['100.099209825', - '99.880633466', - '99.994060319', - '100.134576860', - '97.936518664', - '102.043324627', - '99.909374409', - '100.911894925', - '99.116503294', - '99.994060319', - '88.248558022', - '111.731285270']) + self.assertEqual( + [f'{x:.9f}' for x in ss.getCentsAboveTonic()], + ['100.099209825', + '199.979843291', + '299.973903610', + '400.108480470', + '498.044999135', + '600.088323762', + '699.997698171', + '800.909593096', + '900.026096390', + '1000.020156709', + '1088.268714730', + '1200.000000000']) + + self.assertEqual( + [f'{x:.9f}' for x in ss.getAdjacentCents()], + ['100.099209825', + '99.880633466', + '99.994060319', + '100.134576860', + '97.936518664', + '102.043324627', + '99.909374409', + '100.911894925', + '99.116503294', + '99.994060319', + '88.248558022', + '111.731285270']) self.assertEqual([str(x) for x in ss.getIntervalSequence()], ['', diff --git a/music21/scale/test_scale_main.py b/music21/scale/test_scale_main.py index 587056715..bc3826c0f 100644 --- a/music21/scale/test_scale_main.py +++ b/music21/scale/test_scale_main.py @@ -894,9 +894,9 @@ def testDerivedScaleNoOctaves(self): e = d.deriveRanked(['C', 'E', 'G'], comparisonAttribute='name') self.assertEqual(str(e), ''.join(['[(3, ), ', - '(3, ), ', - '(2, ), ', - '(2, )]']), + '(3, ), ', + '(2, ), ', + '(2, )]']), str(e) ) diff --git a/music21/search/base.py b/music21/search/base.py index b111c9197..e6e856f62 100644 --- a/music21/search/base.py +++ b/music21/search/base.py @@ -1226,7 +1226,6 @@ def translateDurationToBytes(n: note.GeneralNote) -> str: '_' >>> (2 ** (ord(trans[0]) / 10)) / 256 # approximately 3 2.828... - ''' duration1to127 = 1 if n.duration.quarterLength: diff --git a/music21/search/lyrics.py b/music21/search/lyrics.py index c25120a84..8623c1b94 100644 --- a/music21/search/lyrics.py +++ b/music21/search/lyrics.py @@ -35,7 +35,6 @@ class IndexedLyric(namedtuple( )): ''' A Lyric that has been indexed to its attached element and position in a Stream. - ''' __slots__ = () _DOC_ATTR: dict[str, str] = { @@ -207,7 +206,7 @@ def index(self, s: stream.Stream|None = None) -> list[IndexedLyric]: indexByIdentifier: OrderedDict[str|int, list[IndexedLyric]] = OrderedDict() iTextByIdentifier: OrderedDict[str|int, str] = OrderedDict() lastSyllabicByIdentifier: OrderedDict[str|int, - str|None] = OrderedDict() + str|None] = OrderedDict() for n in s.recurse().notes: ls: list[note.Lyric] = n.lyrics diff --git a/music21/search/segment.py b/music21/search/segment.py index 7b25d3085..792d00ea6 100644 --- a/music21/search/segment.py +++ b/music21/search/segment.py @@ -97,7 +97,6 @@ def translateMonophonicPartToSegments( >>> measureLists[0:2] [(1, 12), (7, 18)] - ''' from music21 import search if algorithm is None: diff --git a/music21/search/serial.py b/music21/search/serial.py index d7b8cd79e..b820fda44 100644 --- a/music21/search/serial.py +++ b/music21/search/serial.py @@ -852,9 +852,9 @@ def searchRowsOnlyInclude(self, n: note.NotRest, partNumber: int | None) -> None rowSuperset = csn.readPitchClassesFromBottom() lowerBound = max([0, len(rowSuperset) - - self.searchLength - - len(self.activeChordList[-1].pitches) - + 1]) + - self.searchLength + - len(self.activeChordList[-1].pitches) + + 1]) upperBound = min([len(self.activeChordList[0].pitches), len(rowSuperset) - self.searchLength + 1]) for j in range(lowerBound, upperBound): diff --git a/music21/serial.py b/music21/serial.py index 01bbc7dac..b98c6f7da 100644 --- a/music21/serial.py +++ b/music21/serial.py @@ -99,151 +99,151 @@ def _reprInternal(self): # noinspection SpellCheckingInspection historicalDict = { 'WebernOp29': ('Webern', 'Op. 29', 'Cantata I', - [3, 11, 2, 1, 5, 4, 7, 6, 10, 9, 0, 8]), + [3, 11, 2, 1, 5, 4, 7, 6, 10, 9, 0, 8]), 'WebernOp28': ('Webern', 'Op. 28', 'String Quartet', - [1, 0, 3, 2, 6, 7, 4, 5, 9, 8, 11, 10]), + [1, 0, 3, 2, 6, 7, 4, 5, 9, 8, 11, 10]), 'SchoenbergOp24Mvmt5': ('Schoenberg', 'Op. 24', 'Serenade, Mvt. 5, "Tanzscene"', - [9, 10, 0, 3, 4, 6, 5, 7, 8, 11, 1, 2]), + [9, 10, 0, 3, 4, 6, 5, 7, 8, 11, 1, 2]), 'SchoenbergOp24Mvmt4': ('Schoenberg', 'Op. 24', 'Serenade, Mvt. 4, "Sonett"', - [4, 2, 3, 11, 0, 1, 8, 6, 9, 5, 7, 10]), + [4, 2, 3, 11, 0, 1, 8, 6, 9, 5, 7, 10]), 'SchoenbergJakobsleiter': ('Schoenberg', None, 'Die Jakobsleiter', - [1, 2, 5, 4, 8, 7, 0, 3, 11, 10, 6, 9]), + [1, 2, 5, 4, 8, 7, 0, 3, 11, 10, 6, 9]), 'SchoenbergOp27No4': ('Schoenberg', 'Op. 27 No. 4', 'Four Pieces for Mixed Chorus, No. 4', - [1, 3, 10, 6, 8, 4, 11, 0, 2, 9, 5, 7]), + [1, 3, 10, 6, 8, 4, 11, 0, 2, 9, 5, 7]), 'WebernOp23': ('Webern', 'Op. 23', 'Three Songs', - [8, 3, 7, 4, 10, 6, 2, 5, 1, 0, 9, 11]), + [8, 3, 7, 4, 10, 6, 2, 5, 1, 0, 9, 11]), 'BergLuluActIIScene1': ('Berg', 'Lulu, Act II, Scene 1', - 'Perm. (Every 5th Note Of Transposed Primary Row)', - [10, 7, 1, 0, 9, 2, 4, 11, 5, 8, 3, 6]), + 'Perm. (Every 5th Note Of Transposed Primary Row)', + [10, 7, 1, 0, 9, 2, 4, 11, 5, 8, 3, 6]), 'SchoenbergOp27No1': ('Schoenberg', 'Op. 27 No. 1', 'Four Pieces for Mixed Chorus, No. 1', - [6, 5, 2, 8, 7, 1, 3, 4, 10, 9, 11, 0]), + [6, 5, 2, 8, 7, 1, 3, 4, 10, 9, 11, 0]), 'BergLuluActIScene20': ('Berg', 'Lulu, Act I , Scene XX', - 'Perm. (Every 7th Note Of Transposed Primary Row)', - [10, 6, 3, 8, 5, 11, 4, 2, 9, 0, 1, 7]), + 'Perm. (Every 7th Note Of Transposed Primary Row)', + [10, 6, 3, 8, 5, 11, 4, 2, 9, 0, 1, 7]), 'SchoenbergOp27No3': ('Schoenberg', 'Op. 27 No. 3', 'Four Pieces for Mixed Chorus, No. 3', - [7, 6, 2, 4, 5, 3, 11, 0, 8, 10, 9, 1]), + [7, 6, 2, 4, 5, 3, 11, 0, 8, 10, 9, 1]), 'SchoenbergOp27No2': ('Schoenberg', 'Op. 27 No. 2', 'Four Pieces for Mixed Chorus, No. 2', - [0, 11, 4, 10, 2, 8, 3, 7, 6, 5, 9, 1]), + [0, 11, 4, 10, 2, 8, 3, 7, 6, 5, 9, 1]), 'SchoenbergFragPiano': ('Schoenberg', None, 'Fragment For Piano', - [6, 9, 0, 7, 1, 2, 8, 11, 5, 10, 4, 3]), + [6, 9, 0, 7, 1, 2, 8, 11, 5, 10, 4, 3]), 'SchoenbergOp50B': ('Schoenberg', 'Op. 50B', 'De Profundis', - [3, 9, 8, 4, 2, 10, 7, 11, 0, 6, 5, 1]), + [3, 9, 8, 4, 2, 10, 7, 11, 0, 6, 5, 1]), 'SchoenbergOp50C': ('Schoenberg', 'Op. 50C', 'Modern Psalms, The First Psalm', - [4, 3, 0, 8, 11, 7, 5, 9, 6, 10, 1, 2]), + [4, 3, 0, 8, 11, 7, 5, 9, 6, 10, 1, 2]), 'SchoenbergOp50A': ('Schoenberg', 'Op. 50A', 'Three Times A Thousand Years', - [7, 9, 6, 4, 5, 11, 10, 2, 0, 1, 3, 8]), + [7, 9, 6, 4, 5, 11, 10, 2, 0, 1, 3, 8]), 'SchoenbergMosesAron': ('Schoenberg', None, 'Moses And Aron', - [9, 10, 4, 2, 3, 1, 7, 5, 6, 8, 11, 0]), + [9, 10, 4, 2, 3, 1, 7, 5, 6, 8, 11, 0]), 'WebernOp25': ('Webern', 'Op. 25', 'Three Songs', - [7, 4, 3, 6, 1, 5, 2, 11, 10, 0, 9, 8]), + [7, 4, 3, 6, 1, 5, 2, 11, 10, 0, 9, 8]), 'SchoenbergOp23No5': ('Schoenberg', 'Op. 23, No. 5', 'Five Piano Pieces', - [1, 9, 11, 7, 8, 6, 10, 2, 4, 3, 0, 5]), + [1, 9, 11, 7, 8, 6, 10, 2, 4, 3, 0, 5]), 'SchoenbergOp28No1': ('Schoenberg', 'Op. 28 No. 1', - 'Three Satires for Mixed Chorus, No. 1', - [0, 4, 7, 1, 9, 11, 5, 3, 2, 6, 8, 10]), + 'Three Satires for Mixed Chorus, No. 1', + [0, 4, 7, 1, 9, 11, 5, 3, 2, 6, 8, 10]), 'SchoenbergOp28No3': ('Schoenberg', 'Op. 28 No. 3', - 'Three Satires for Mixed Chorus, No. 3', - [5, 6, 4, 8, 2, 10, 7, 9, 3, 11, 1, 0]), + 'Three Satires for Mixed Chorus, No. 3', + [5, 6, 4, 8, 2, 10, 7, 9, 3, 11, 1, 0]), 'WebernOp21': ('Webern', 'Op. 21', 'Chamber Symphony', - [5, 8, 7, 6, 10, 9, 3, 4, 0, 1, 2, 11]), + [5, 8, 7, 6, 10, 9, 3, 4, 0, 1, 2, 11]), 'SchoenbergIsraelExists': ('Schoenberg', None, 'Israel Exists Again', - [0, 3, 4, 9, 11, 5, 2, 1, 10, 8, 6, 7]), + [0, 3, 4, 9, 11, 5, 2, 1, 10, 8, 6, 7]), 'SchoenbergOp35No2': ('Schoenberg', 'Op. 35', 'Six Pieces for Male Chorus, No. 2', - [6, 9, 7, 1, 0, 2, 5, 11, 10, 3, 4, 8]), + [6, 9, 7, 1, 0, 2, 5, 11, 10, 3, 4, 8]), 'SchoenbergOp35No3': ('Schoenberg', 'Op. 35', 'Six Pieces for Male Chorus, No. 3', - [3, 6, 7, 8, 5, 0, 9, 10, 4, 11, 2, 1]), + [3, 6, 7, 8, 5, 0, 9, 10, 4, 11, 2, 1]), 'SchoenbergOp35No1': ('Schoenberg', 'Op. 35', 'Six Pieces for Male Chorus, No. 1', - [2, 11, 3, 5, 4, 1, 8, 10, 9, 6, 0, 7]), + [2, 11, 3, 5, 4, 1, 8, 10, 9, 6, 0, 7]), 'SchoenbergOp48No1': ('Schoenberg', 'Op. 48', 'Three Songs, No. 1, "Sommermud"', - [1, 2, 0, 6, 3, 5, 4, 10, 11, 7, 9, 8]), + [1, 2, 0, 6, 3, 5, 4, 10, 11, 7, 9, 8]), 'SchoenbergOp35No5': ('Schoenberg', 'Op. 35', 'Six Pieces for Male Chorus, No. 5', - [1, 7, 10, 2, 3, 11, 8, 4, 0, 6, 5, 9]), + [1, 7, 10, 2, 3, 11, 8, 4, 0, 6, 5, 9]), 'SchoenbergOp29': ('Schoenberg', 'Op. 29', 'Suite', - [3, 7, 6, 10, 2, 11, 0, 9, 8, 4, 5, 1]), + [3, 7, 6, 10, 2, 11, 0, 9, 8, 4, 5, 1]), 'BergLyricSuitePerm': ('Berg', None, 'Lyric Suite, Last Mvt. Permutation', - [5, 6, 10, 4, 1, 9, 2, 8, 7, 3, 0, 11]), + [5, 6, 10, 4, 1, 9, 2, 8, 7, 3, 0, 11]), 'WebernOp20': ('Webern', 'Op. 20', 'String Trio', - [8, 7, 2, 1, 6, 5, 9, 10, 3, 4, 0, 11]), + [8, 7, 2, 1, 6, 5, 9, 10, 3, 4, 0, 11]), 'SchoenbergOp46': ('Schoenberg', 'Op. 46', 'A Survivor From Warsaw', - [6, 7, 0, 8, 4, 3, 11, 10, 5, 9, 1, 2]), + [6, 7, 0, 8, 4, 3, 11, 10, 5, 9, 1, 2]), 'SchoenbergFragOrganSonata': ('Schoenberg', None, 'Fragment of Sonata For Organ', - [1, 7, 11, 3, 9, 2, 8, 6, 10, 5, 0, 4]), + [1, 7, 11, 3, 9, 2, 8, 6, 10, 5, 0, 4]), 'SchoenbergOp44': ('Schoenberg', 'Op. 44', 'Prelude To A Suite From "Genesis"', - [10, 6, 2, 5, 4, 0, 11, 8, 1, 3, 9, 7]), + [10, 6, 2, 5, 4, 0, 11, 8, 1, 3, 9, 7]), 'SchoenbergOp45': ('Schoenberg', 'Op. 45', 'String Trio', - [2, 10, 3, 9, 4, 1, 11, 8, 6, 7, 5, 0]), + [2, 10, 3, 9, 4, 1, 11, 8, 6, 7, 5, 0]), 'SchoenbergOp33A': ('Schoenberg', 'Op. 33A', 'Two Piano Pieces, No. 1', - [10, 5, 0, 11, 9, 6, 1, 3, 7, 8, 2, 4]), + [10, 5, 0, 11, 9, 6, 1, 3, 7, 8, 2, 4]), 'SchoenbergOp25': ('Schoenberg', 'Op.25', 'Suite for Piano', - [4, 5, 7, 1, 6, 3, 8, 2, 11, 0, 9, 10]), + [4, 5, 7, 1, 6, 3, 8, 2, 11, 0, 9, 10]), 'SchoenbergOp26': ('Schoenberg', 'Op. 26', 'Wind Quintet', - [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5]), + [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5]), 'SchoenbergOp33B': ('Schoenberg', 'Op. 33B', 'Two Piano Pieces, No. 2', - [11, 1, 5, 3, 9, 8, 6, 10, 7, 4, 0, 2]), + [11, 1, 5, 3, 9, 8, 6, 10, 7, 4, 0, 2]), 'BergViolinConcerto': ('Berg', None, 'Concerto For Violin And Orchestra', - [7, 10, 2, 6, 9, 0, 4, 8, 11, 1, 3, 5]), + [7, 10, 2, 6, 9, 0, 4, 8, 11, 1, 3, 5]), 'WebernOp22': ('Webern', 'Op. 22', 'Quartet For Violin, Clarinet, Tenor Sax, And Piano', - [6, 3, 2, 5, 4, 8, 9, 10, 11, 1, 7, 0]), + [6, 3, 2, 5, 4, 8, 9, 10, 11, 1, 7, 0]), 'BergLulu': ('Berg', None, 'Lulu: Primary Row', - [0, 4, 5, 2, 7, 9, 6, 8, 11, 10, 3, 1]), + [0, 4, 5, 2, 7, 9, 6, 8, 11, 10, 3, 1]), 'WebernOp30': ('Webern', 'Op. 30', 'Variations For Orchestra', - [9, 10, 1, 0, 11, 2, 3, 6, 5, 4, 7, 8]), + [9, 10, 1, 0, 11, 2, 3, 6, 5, 4, 7, 8]), 'WebernOp31': ('Webern', 'Op. 31', 'Cantata II', - [6, 9, 5, 4, 8, 3, 7, 11, 10, 2, 1, 0]), + [6, 9, 5, 4, 8, 3, 7, 11, 10, 2, 1, 0]), 'WebernOpNo17No1': ('Webern', 'Op. 17, No. 1', '"Armer Sunder, Du"', - [11, 10, 5, 6, 3, 4, 7, 8, 9, 0, 1, 2]), + [11, 10, 5, 6, 3, 4, 7, 8, 9, 0, 1, 2]), 'WebernOp24': ('Webern', 'Op. 24', 'Concerto For Nine Instruments', - [11, 10, 2, 3, 7, 6, 8, 4, 5, 0, 1, 9]), + [11, 10, 2, 3, 7, 6, 8, 4, 5, 0, 1, 9]), 'SchoenbergOp48No2': ('Schoenberg', 'Op. 48', 'Three Songs, No. 2, "Tot"', - [2, 3, 9, 1, 10, 4, 8, 7, 0, 11, 5, 6]), + [2, 3, 9, 1, 10, 4, 8, 7, 0, 11, 5, 6]), 'WebernOp27': ('Webern', 'Op. 27', 'Variations For Piano', - [3, 11, 10, 2, 1, 0, 6, 4, 7, 5, 9, 8]), + [3, 11, 10, 2, 1, 0, 6, 4, 7, 5, 9, 8]), 'SchoenbergOp47': ('Schoenberg', 'Op. 47', 'Fantasy For Violin And Piano', - [10, 9, 1, 11, 5, 7, 3, 4, 0, 2, 8, 6]), + [10, 9, 1, 11, 5, 7, 3, 4, 0, 2, 8, 6]), 'WebernOp19No2': ('Webern', 'Op. 19, No. 2', '"Ziehn Die Schafe"', - [8, 4, 9, 6, 7, 0, 11, 5, 3, 2, 10, 1]), + [8, 4, 9, 6, 7, 0, 11, 5, 3, 2, 10, 1]), 'WebernOp19No1': ('Webern', 'Op. 19, No. 1', '"Weiss Wie Lilien"', - [7, 10, 6, 5, 3, 9, 8, 1, 2, 11, 4, 0]), + [7, 10, 6, 5, 3, 9, 8, 1, 2, 11, 4, 0]), 'WebernOp26': ('Webern', 'Op. 26', 'Das Augenlicht', - [8, 10, 9, 0, 11, 3, 4, 1, 5, 2, 6, 7]), + [8, 10, 9, 0, 11, 3, 4, 1, 5, 2, 6, 7]), 'SchoenbergFragPianoPhantasia': ('Schoenberg', None, 'Fragment of Phantasia For Piano', - [1, 5, 3, 6, 4, 8, 0, 11, 2, 9, 10, 7]), + [1, 5, 3, 6, 4, 8, 0, 11, 2, 9, 10, 7]), 'BergDerWein': ('Berg', None, 'Der Wein', - [2, 4, 5, 7, 9, 10, 1, 6, 8, 0, 11, 3]), + [2, 4, 5, 7, 9, 10, 1, 6, 8, 0, 11, 3]), 'BergWozzeckPassacaglia': ('Berg', None, 'Wozzeck, Act I, Scene 4 "Passacaglia"', - [3, 11, 7, 1, 0, 6, 4, 10, 9, 5, 8, 2]), + [3, 11, 7, 1, 0, 6, 4, 10, 9, 5, 8, 2]), 'WebernOp18No1': ('Webern', 'Op. 18, No. 1', '"Schatzerl Klein"', - [0, 11, 5, 8, 10, 9, 3, 4, 1, 7, 2, 6]), + [0, 11, 5, 8, 10, 9, 3, 4, 1, 7, 2, 6]), 'WebernOp18No2': ('Webern', 'Op. 18, No. 2', '"Erlosung"', - [6, 9, 5, 8, 4, 7, 3, 11, 2, 10, 1, 0]), + [6, 9, 5, 8, 4, 7, 3, 11, 2, 10, 1, 0]), 'WebernOp18No3': ('Webern', 'Op. 18, No. 3', '"Ave, Regina Coelorum"', - [4, 3, 7, 6, 5, 11, 10, 2, 1, 0, 9, 8]), + [4, 3, 7, 6, 5, 11, 10, 2, 1, 0, 9, 8]), 'SchoenbergOp42': ('Schoenberg', 'Op. 42', 'Concerto For Piano And Orchestra', - [3, 10, 2, 5, 4, 0, 6, 8, 1, 9, 11, 7]), + [3, 10, 2, 5, 4, 0, 6, 8, 1, 9, 11, 7]), 'SchoenbergOp48No3': ('Schoenberg', 'Op. 48', 'Three Songs, No, 3, "Madchenlied"', - [1, 7, 9, 11, 3, 5, 10, 6, 4, 0, 8, 2]), + [1, 7, 9, 11, 3, 5, 10, 6, 4, 0, 8, 2]), 'SchoenbergOp37': ('Schoenberg', 'Op. 37', 'Fourth String Quartet', - [2, 1, 9, 10, 5, 3, 4, 0, 8, 7, 6, 11]), + [2, 1, 9, 10, 5, 3, 4, 0, 8, 7, 6, 11]), 'SchoenbergOp36': ('Schoenberg', 'Op. 36', 'Concerto for Violin and Orchestra', - [9, 10, 3, 11, 4, 6, 0, 1, 7, 8, 2, 5]), + [9, 10, 3, 11, 4, 6, 0, 1, 7, 8, 2, 5]), 'SchoenbergOp34': ('Schoenberg', 'Op. 34', 'Accompaniment to a Film Scene', - [3, 6, 2, 4, 1, 0, 9, 11, 10, 8, 5, 7]), + [3, 6, 2, 4, 1, 0, 9, 11, 10, 8, 5, 7]), 'BergChamberConcerto': ('Berg', None, 'Chamber Concerto', - [11, 7, 5, 9, 2, 3, 6, 8, 0, 1, 4, 10]), + [11, 7, 5, 9, 2, 3, 6, 8, 0, 1, 4, 10]), 'SchoenbergOp32': ('Schoenberg', 'Op. 32', 'Von Heute Auf Morgen', - [2, 3, 9, 1, 11, 5, 8, 7, 4, 0, 10, 6]), + [2, 3, 9, 1, 11, 5, 8, 7, 4, 0, 10, 6]), 'SchoenbergOp31': ('Schoenberg', 'Op. 31', 'Variations for Orchestra', - [10, 4, 6, 3, 5, 9, 2, 1, 7, 8, 11, 0]), + [10, 4, 6, 3, 5, 9, 2, 1, 7, 8, 11, 0]), 'SchoenbergOp30': ('Schoenberg', 'Op. 30', 'Third String Quartet', - [7, 4, 3, 9, 0, 5, 6, 11, 10, 1, 8, 2]), + [7, 4, 3, 9, 0, 5, 6, 11, 10, 1, 8, 2]), 'BergLyricSuite': ('Berg', None, 'Lyric Suite Primary Row', - [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11]), + [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11]), 'SchoenbergOp41': ('Schoenberg', 'Op. 41', 'Ode To Napoleon', - [1, 0, 4, 5, 9, 8, 3, 2, 6, 7, 11, 10]), + [1, 0, 4, 5, 9, 8, 3, 2, 6, 7, 11, 10]), 'WebernOp17No3': ('Webern', 'Op. 17, No. 3', '"Heiland, Unsere Missetaten..."', - [8, 5, 4, 3, 7, 6, 0, 1, 2, 11, 10, 9]), + [8, 5, 4, 3, 7, 6, 0, 1, 2, 11, 10, 9]), 'WebernOp17No2': ('Webern', 'Op. 17, No. 2', '"Liebste Jungfrau"', - [1, 0, 11, 7, 8, 2, 3, 6, 5, 4, 9, 10]) + [1, 0, 11, 7, 8, 2, 3, 6, 5, 4, 9, 10]) } # ------------------------------------------------------------------------------ @@ -427,7 +427,6 @@ def isSameRow(self, other): def getIntervalsAsString(self): ''' - Returns the string of intervals between consecutive pitch classes of a :class:`~music21.serial.ToneRow`. 'T' = 10, 'E' = 11. diff --git a/music21/sieve.py b/music21/sieve.py index b999fa5fc..a5466e1ec 100644 --- a/music21/sieve.py +++ b/music21/sieve.py @@ -203,7 +203,7 @@ def rabinMiller(n): # primes up to 100; 2, 3 handled by mod 6 primes = [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, - 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] + 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] if n <= 100: if n in primes: @@ -253,7 +253,6 @@ def discreteBinaryPad(series: Iterable[int], fixRange=None) -> list[int]: >>> sieve.discreteBinaryPad([3, 4, 5]) [1, 1, 1] - ''' # make sure these are ints for x in series: @@ -293,7 +292,6 @@ def unitNormRange(series, fixRange=None): >>> sieve.unitNormRange([1, 3, 4]) [0.0, 0.666..., 1.0] - ''' if fixRange is not None: fixRange.sort() @@ -367,7 +365,6 @@ def unitNormStep(step, a=0, b=1, normalized=True): >>> post = sieve.unitNormStep(0.25, 0, 20, normalized=False) >>> len(post) 81 - ''' if a == b: return [] # no range, return boundary @@ -487,7 +484,7 @@ def _fillRange(self): segNeg = [-x for x in segNeg] # make negative if len(segNeg) < self.length: segPos = self._fillRabinMiller(0, self.length - len(segNeg), - None, 'up') + None, 'up') self.seg = segNeg + segPos else: # add positive values self.seg = segNeg @@ -869,7 +866,6 @@ def _zUpdate(self, z=None): # -------------------------------------------------------------------------- def __call__(self): ''' - >>> a = sieve.CompressionSegment([3, 4, 5, 6, 7, 8]) >>> b = a() >>> str(b[0]) diff --git a/music21/sites.py b/music21/sites.py index b09a695cf..645023faa 100644 --- a/music21/sites.py +++ b/music21/sites.py @@ -281,7 +281,6 @@ def __len__(self): >>> aContexts.add(aObj) >>> len(aContexts) 2 - ''' return len(self.siteDict) @@ -585,7 +584,6 @@ def getAttrByName(self, attrName): >>> aSites.getAttrByName('blah') is None True - ''' post = None for obj in self.yieldSites(sortByCreationTime='reverse'): @@ -951,7 +949,6 @@ def remove(self, site): >>> aSites.remove(aSite) >>> len(aSites) 3 - ''' # must clear self._lastID = -1 # cannot be None diff --git a/music21/spanner.py b/music21/spanner.py index 6a04bd498..c12c6aab6 100644 --- a/music21/spanner.py +++ b/music21/spanner.py @@ -349,7 +349,6 @@ def purgeLocations(self, rescanIsDead=False): # -------------------------------------------------------------------------- def __getitem__(self, key): ''' - >>> n1 = note.Note('g') >>> n2 = note.Note('f#') >>> c1 = clef.BassClef() @@ -399,7 +398,6 @@ def getSpannedElements(self): def getSpannedElementsByClass(self, classFilterList): ''' - >>> n1 = note.Note('g') >>> n2 = note.Note('f#') >>> c1 = clef.AltoClef() @@ -699,7 +697,8 @@ def fill( else: endOffsetInHierarchy = opFrac(startOffsetInHierarchy + startElement.quarterLength) - matchIterator = (searchStream + matchIterator = ( + searchStream .recurse() .getElementsByOffsetInHierarchy( startOffsetInHierarchy, @@ -2967,7 +2966,7 @@ def testLineA(self): n3 = s.notes[-1] sp1 = Line(n1, n2, startTick='up', lineType='dotted') sp2 = Line(n2, n3, startTick='down', lineType='dashed', - endHeight=40) + endHeight=40) s.append(sp1) s.append(sp2) # s.show('t') diff --git a/music21/stream/base.py b/music21/stream/base.py index 18baebaf4..d9c919015 100644 --- a/music21/stream/base.py +++ b/music21/stream/base.py @@ -662,7 +662,6 @@ def __getitem__(self, still works until v9. This is an attempt to unify __getitem__ behavior in StreamIterators and Streams. - allowed iterables of qualified class names, e.g. `[note.Note, note.Rest]` - ''' # need to sort if not sorted, as this call may rely on index positions if not self.isSorted and self.autoSort: @@ -1557,7 +1556,6 @@ def index(self, el: base.Music21Object) -> int: >>> tuple(s).index(n3) 0 - ''' if not self.isSorted and self.autoSort: self.sort() # will set isSorted to True @@ -4317,7 +4315,6 @@ def getElementAfterElement(self, element, classList=None): Traceback (most recent call last): music21.exceptions21.StreamException: cannot find object () in Stream - ''' if classList is not None: classSet = set(classList) @@ -4412,13 +4409,13 @@ def hasMeasureNumberInformation(measureIterator: iterator.StreamIterator[Measure matches = [m for m in mStreamIter if m.number in matchingMeasureNumbers] else: matches = [m for i, m in enumerate(mStreamIter) - if i + 1 in matchingMeasureNumbers] + if i + 1 in matchingMeasureNumbers] else: if hasUniqueMeasureNumbers: matches = [m for m in mStreamIter if m.number >= numberStart] else: matches = [m for i, m in enumerate(mStreamIter) - if i + 1 >= numberStart] + if i + 1 >= numberStart] if startSuffix is not None: oldMatches = matches @@ -5813,7 +5810,7 @@ def getInstruments(self, if searchActiveSite: # if isinstance(self.activeSite, Stream) and self.activeSite != self: if (self.activeSite is not None - and self.activeSite.isStream + and self.activeSite.isStream and self.activeSite is not self): # environLocal.printDebug(['searching activeSite Stream', # self, self.activeSite]) @@ -6181,7 +6178,6 @@ def extractContext(self, searchElement, before=4.0, after=4.0, NOTE: RENAME: this probably should be renamed, as we use Context in a special way. Perhaps better is extractNeighbors? - ''' display = self.cloneEmpty('extractContext') @@ -6246,7 +6242,6 @@ def _uniqueOffsetsAndEndTimes(self, offsetsOnly=False, endTimesOnly=False): >>> s.flatten()._uniqueOffsetsAndEndTimes(offsetsOnly=True, endTimesOnly=True) [] - ''' offsetDictValues = self._offsetDict.values() if endTimesOnly: @@ -6258,7 +6253,7 @@ def _uniqueOffsetsAndEndTimes(self, offsetsOnly=False, endTimesOnly=False): endTimes = set() else: endTimes = {opFrac(v[0] + v[1].duration.quarterLength) - for v in offsetDictValues} + for v in offsetDictValues} return sorted(offsets.union(endTimes)) def chordify( @@ -9631,7 +9626,6 @@ def sliceByQuarterLengths(self, quarterLengthList, *, target=None, If `target` is None, the entire Stream is processed. Otherwise, only the element specified is manipulated. - ''' if not inPlace: # make a copy returnObj = self.coreCopyAsDerivation('sliceByQuarterLengths') @@ -10837,7 +10831,6 @@ def getOverlaps(self): >>> d = a.getOverlaps() >>> len(d[0]) 7 - ''' overlapMap = self._findLayering() # environLocal.printDebug(['overlapMap', overlapMap]) @@ -11151,7 +11144,6 @@ def allPlayingWhileSounding(self, el, elStream=None): is list, it is used like classList in elsewhere in stream to provide a list of classes that the el must be a part of. - ''' if elStream is not None: # a bit of safety elOffset = el.getOffsetBySite(elStream) @@ -11567,7 +11559,7 @@ def doOneMeasureWithVoices(mInner): mEmpty.mergeAttributes(m) # Propagate bar, meter, key elements to lower parts mEmpty.mergeElements(m, classFilterList=('Barline', - 'TimeSignature', 'KeySignature')) + 'TimeSignature', 'KeySignature')) s.parts[i].insert(self.elementOffset(m), mEmpty) # if part has no measures but has voices, contents of each voice go into the part elif self.hasVoices(): @@ -11734,7 +11726,6 @@ def lyrics( >>> list(scr.lyrics(ignoreBarlines=True, recurse=False).keys()) [] - ''' returnLists: dict[int, list[RecursiveLyricList]] = {} numNotes = 0 @@ -12316,7 +12307,6 @@ def _insertDeletionVariant(self, v, matchBySpan=True): {1.0} {2.0} {3.0} - ''' from music21 import variant @@ -12452,7 +12442,6 @@ def _insertInsertionVariant(self, v, matchBySpan=True): {1.0} {2.0} {3.0} - ''' from music21 import variant @@ -12734,7 +12723,6 @@ def _fixMeasureNumbers(self, deletedMeasures, insertedMeasures): ... fixedNumbers.append( m.number ) >>> fixedNumbers [1, 2, 3, 4, 5] - ''' deletedMeasures.extend(insertedMeasures) allMeasures = deletedMeasures @@ -12857,7 +12845,6 @@ def showVariantAsOssialikePart(self, containedPart, variantGroups, *, inPlace=Fa >>> streamWithOssia = s.showVariantAsOssialikePart(sPart, ... ['variant1', 'variant2', 'variant3'], inPlace=False) >>> #_DOCS_SHOW streamWithOssia.show() - ''' from music21 import variant @@ -13460,7 +13447,6 @@ def bestTimeSignature(self): For further details about complex time signatures, etc. see `meter.bestTimeSignature()` - ''' return meter.bestTimeSignature(self) @@ -14193,7 +14179,6 @@ def partsToVoices(self, 4 >>> len(post.flatten().notes) 165 - ''' from music21 import spanner diff --git a/music21/stream/core.py b/music21/stream/core.py index fac17154a..4fd3e901f 100644 --- a/music21/stream/core.py +++ b/music21/stream/core.py @@ -403,7 +403,6 @@ def coreGuardBeforeAddElement(self, element, *, checkRedundancy=True): music21.exceptions21.StreamException: The object you tried to add to the Stream, 3.14159, is not a Music21Object. Use an ElementWrapper object if this is what you intend. - ''' if element is self: # cannot add this Stream into itself raise StreamException('this Stream cannot be contained within itself') diff --git a/music21/stream/filters.py b/music21/stream/filters.py index aee1f5553..37c2392e9 100644 --- a/music21/stream/filters.py +++ b/music21/stream/filters.py @@ -63,7 +63,6 @@ class StreamFilter(prebase.ProtoM21Object): True >>> sf.classes ('StreamFilter', 'ProtoM21Object', 'object') - ''' derivationStr = 'streamFilter' @@ -115,7 +114,6 @@ class IsFilter(StreamFilter): ... print(el) - ''' derivationStr = 'is' @@ -193,7 +191,6 @@ class IdFilter(StreamFilter): No corresponding iterator call. Only a single ID can be passed in. Always returns a single item. - ''' derivationStr = 'getElementById' @@ -241,7 +238,6 @@ class ClassFilter(StreamFilter): ... print(x) - ''' derivationStr = 'getElementsByClass' diff --git a/music21/stream/iterator.py b/music21/stream/iterator.py index 3686214b2..898d95d4e 100644 --- a/music21/stream/iterator.py +++ b/music21/stream/iterator.py @@ -466,7 +466,6 @@ def __bool__(self) -> bool: 0 >>> bool(iterator.getElementsByClass(chord.Chord)) False - ''' if self._len is not None: return bool(self._len) diff --git a/music21/stream/makeNotation.py b/music21/stream/makeNotation.py index b3523a440..c681463fb 100644 --- a/music21/stream/makeNotation.py +++ b/music21/stream/makeNotation.py @@ -1701,9 +1701,11 @@ def makeAccidentalsInMeasureStream( # just get the chromatic pitches from previous measure # G-naturals in C major following G-flats in F major need cautionary # G-naturals in C major following G-flats in Db major don't - pitchPastMeasure = [p for p in - measuresOnly[i - 1].pitches + ornamentalPitches(measuresOnly[i - 1]) - if p.name not in ksLastDiatonic] + previousMeasure = measuresOnly[i - 1] + pitchPastMeasure = [ + p for p in previousMeasure.pitches + ornamentalPitches(previousMeasure) + if p.name not in ksLastDiatonic + ] # Get tiePitchSet from previous measure try: previousNoteOrChord = measuresOnly[i - 1][note.NotRest][-1] @@ -2319,7 +2321,7 @@ def testStreamExceptions(self): with self.assertRaises(stream.StreamException) as cm: p.makeMeasures(meterStream=duration.Duration()) self.assertEqual(str(cm.exception), - 'meterStream is neither a Stream nor a TimeSignature!') + 'meterStream is neither a Stream nor a TimeSignature!') def testMakeTiesChangingTimeSignatures(self): ''' diff --git a/music21/stream/streamStatus.py b/music21/stream/streamStatus.py index 1830ec5cf..36a4d18d1 100644 --- a/music21/stream/streamStatus.py +++ b/music21/stream/streamStatus.py @@ -138,7 +138,6 @@ def haveTupletBracketsBeenMade(self): >>> nTuplet.duration.tuplets[0].type = 'start' >>> s.streamStatus.haveTupletBracketsBeenMade() True - ''' foundTuplet = False for n in self.client.recurse(classFilter='GeneralNote', restoreActiveSites=False): diff --git a/music21/stream/tests.py b/music21/stream/tests.py index 0686170f9..6e49f3617 100644 --- a/music21/stream/tests.py +++ b/music21/stream/tests.py @@ -526,8 +526,8 @@ def testStreamSortRecursion(self): offsets = [a.offset for a in fs_fs] # safer is a.getOffsetBySite(fs_fs) offsetsBrief = offsets[:20] self.assertEqual(offsetsBrief, - [0, 2, 4, 5, 6, 7, 9, 10, - 11, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19]) + [0, 2, 4, 5, 6, 7, 9, 10, + 11, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19]) def testOverlapsA(self): a = Stream() @@ -1045,7 +1045,8 @@ def testFindConsecutiveNotes(self): consec = m.findConsecutiveNotes() - self.assertEqual([repr(x) for x in consec], + self.assertEqual( + [repr(x) for x in consec], ['', '', '', @@ -1355,7 +1356,8 @@ def testStripTiesClearBeaming(self): self.assertEqual(p.streamStatus.beams, False) p = p.splitAtDurations(recurse=True)[0] p.makeBeams(inPlace=True) - self.assertEqual([repr(el.beams) for el in p[note.Note]], + self.assertEqual( + [repr(el.beams) for el in p[note.Note]], ['', '>', '>', @@ -2219,17 +2221,18 @@ def testMakeRestsB(self): # m2.show() match = str(list(s.flatten().notesAndRests)) - self.assertEqual(match, '[, , ' - + ', , ' - + ', ]') + self.assertEqual(match, + '[, , ' + + ', , ' + + ', ]') match = str([(n, n.duration) for n in s.flatten().notesAndRests]) self.assertEqual(match, '[(, ), ' - + '(, ), ' - + '(, ), ' - + '(, ), ' - + '(, ), ' - + '(, )]') + + '(, ), ' + + '(, ), ' + + '(, ), ' + + '(, ), ' + + '(, )]') GEX = m21ToXml.GeneralObjectExporter() unused_mx = GEX.parse(s).decode('utf-8') @@ -2738,7 +2741,7 @@ def testMakeAccidentalsB(self): c = m34.getElementsByClass(chord.Chord) # assuming not showing accidental b/c of key self.assertEqual(str(c[1].pitches), '(, ' - + ', )') + + ', )') # because of key self.assertEqual(str(c[1].pitches[0].accidental.displayStatus), 'False') @@ -2748,7 +2751,7 @@ def testMakeAccidentalsB(self): # has correct pitches but natural not showing on C self.assertEqual(str(c[0].pitches), '(, , ' - + ')') + + ')') self.assertEqual(str(c[0].pitches[0].accidental), 'None') def testMakeAccidentalsC(self): @@ -4140,7 +4143,7 @@ def testAnalyze(self): s = corpus.parse('bach/bwv66.6') sub = [s.parts[0], s.parts[1], s.measures(4, 5), - s.parts[2].measures(4, 5)] + s.parts[2].measures(4, 5)] matchAmbitus = [interval.Interval(12), interval.Interval(15), @@ -4866,11 +4869,11 @@ def testMakeChordsBuiltC(self): sMod = s1.chordify(removeRedundantPitches=True) self.assertEqual([p.nameWithOctave for p in sMod.getElementsByClass(chord.Chord)[0].pitches], - ['C2', 'G2']) + ['C2', 'G2']) self.assertEqual([p.nameWithOctave for p in sMod.getElementsByClass(chord.Chord)[1].pitches], - ['E4', 'F#4']) + ['E4', 'F#4']) # without redundant pitch gathering sMod = s1.chordify(removeRedundantPitches=False) @@ -5529,8 +5532,8 @@ def testChordifyImported(self): 21.0, 21.5, 22.0, 22.5, 23.0, 23.5, 24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 30.0, 33.0, 34.5, 35.5, 36.0, 37.5, 38.0, 39.0, 40.0, 40.5, 41.0, 42.0, 43.5, 45.0, 45.5, 46.0, 46.5, - 47.0, 47.5, 48.0, 49.5, 51.0, 51.5, 52.0, 52.5, 53.0, 53.5, - 54.0, 54.5, 55.0, 55.5, 56.0, 56.5, 57.0, 58.5, 59.5]) + 47.0, 47.5, 48.0, 49.5, 51.0, 51.5, 52.0, 52.5, 53.0, 53.5, + 54.0, 54.5, 55.0, 55.5, 56.0, 56.5, 57.0, 58.5, 59.5]) self.assertEqual(len(post[chord.Chord]), 71) # Careful! one version of the caching is screwing up m. 20 which definitely should # not have rests in it -- was creating 69 notes, not 71. @@ -6341,7 +6344,7 @@ def testStripTiesBuiltB(self): self.assertEqual([n.offset for n in first_m_notesAndRests], [0.0, 1.0, 3.0]) self.assertEqual([n.quarterLength - for n in first_m_notesAndRests], + for n in first_m_notesAndRests], [1.0, 2.0, 2.0]) self.assertEqual([n.beatStr for n in first_m_notesAndRests], ['1', '2', '4']) @@ -6440,7 +6443,7 @@ def testDerivationA(self): m4 = p1.measure(4) self.assertIs(m4.flatten().notesAndRests.stream().derivation.rootDerivation, m4, - list(m4.flatten().notesAndRests.stream().derivation.chain())) + list(m4.flatten().notesAndRests.stream().derivation.chain())) # part is the root derivation of a measures() call mRange = p1.measures(4, 6) @@ -7549,12 +7552,12 @@ def testTransposeByPitchB(self): self.assertEqual([str(p) for p in s.parts[0].pitches], ['D4', 'E4', 'F#4', 'G4', 'A4', 'B4', 'C#5', 'D5']) self.assertEqual([None if p.accidental is None else p.accidental.displayStatus - for p in s.parts[0].pitches], + for p in s.parts[0].pitches], [True, None, False, None, None, None, False, None]) self.assertEqual([str(p) for p in s.parts[1].pitches], ['A4', 'B4', 'C#5', 'D5', 'E5', 'F#5', 'G#5', 'A5']) self.assertEqual([None if p.accidental is None else p.accidental.displayStatus - for p in s.parts[1].pitches], + for p in s.parts[1].pitches], [True, None, False, None, None, False, False, None]) self.assertEqual(s.atSoundingPitch, 'unknown') @@ -7563,12 +7566,12 @@ def testTransposeByPitchB(self): self.assertEqual([str(p) for p in s.parts[0].pitches], ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5']) self.assertEqual([None if p.accidental is None else p.accidental.displayStatus - for p in s.parts[0].pitches], + for p in s.parts[0].pitches], [True, None, None, None, None, None, None, None]) self.assertEqual([str(p) for p in s.parts[1].pitches], ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5']) self.assertEqual([None if p.accidental is None else p.accidental.displayStatus - for p in s.parts[1].pitches], + for p in s.parts[1].pitches], [True, None, None, None, None, None, None, None]) def testTransposeByPitchC(self): @@ -7609,9 +7612,9 @@ def testExtendTiesA(self): '' ], '', - ['None', - '' - ] + ['None', + '' + ] ]) def testExtendTiesB(self): @@ -7889,7 +7892,7 @@ def testChordifyF(self): self.maxDiff = None self.assertMultiLineEqual( s.parts[0].getElementsByClass(Measure)[0]._reprText(addEndTimes=True, - useMixedNumerals=True), + useMixedNumerals=True), '''{0 - 0} {0 - 0} {0 - 0} diff --git a/music21/stream/tools.py b/music21/stream/tools.py index efd1f3fe6..1fa145f8d 100644 --- a/music21/stream/tools.py +++ b/music21/stream/tools.py @@ -154,7 +154,6 @@ def removeDuplicates(thisStream: stream.Stream, >>> t = stream.tools.removeDuplicates(s, inPlace=False) >>> s.parts[0] == testInPlace True - ''' supportedClasses = (meter.TimeSignature, key.KeySignature, clef.Clef) diff --git a/music21/style.py b/music21/style.py index d4f6fb1f4..dfdb43db8 100644 --- a/music21/style.py +++ b/music21/style.py @@ -61,7 +61,6 @@ class Style(ProtoM21Object): >>> st.absoluteX = 20.4 >>> st.absoluteX 20.4 - ''' _DOC_ATTR: dict[str, str] = { 'hideObjectOnPrint': ''' diff --git a/music21/tempo.py b/music21/tempo.py index bba4a40a8..0e2a6db74 100644 --- a/music21/tempo.py +++ b/music21/tempo.py @@ -107,7 +107,6 @@ def convertTempoByReferent( >>> tempo.convertTempoByReferent(60, 1.5, common.opFrac(1/3)) 270.0 - ''' # find duration in seconds of quarter length srcDurPerBeat = 60 / numberSrc @@ -754,7 +753,6 @@ def getEquivalentByReferent(self, referent): >>> mm1.getEquivalentByReferent('longa') - ''' if common.isNum(referent): # assume quarter length quarterLength = referent @@ -1157,7 +1155,6 @@ def setEqualityByReferent(self, side=None, referent=1.0): => - ''' if side is None: if self._oldMetronome is None: diff --git a/music21/test/multiprocessTest.py b/music21/test/multiprocessTest.py index bfec2e3de..f45cbaa14 100644 --- a/music21/test/multiprocessTest.py +++ b/music21/test/multiprocessTest.py @@ -158,7 +158,7 @@ def mainPoolRunner(testGroup=('test',), restoreEnvironmentDefaults=False, leaveO # unordered says that results can RETURN in any order; not that # they'd be pooled out in any order. res = pool.imap_unordered(runOneModuleWithoutImp, - ((modGather, fp) for fp in pathsToRun)) + ((modGather, fp) for fp in pathsToRun)) continueIt = True timeouts = 0 diff --git a/music21/test/testRunner.py b/music21/test/testRunner.py index 62c822ba4..190256e01 100644 --- a/music21/test/testRunner.py +++ b/music21/test/testRunner.py @@ -253,8 +253,8 @@ def testHello(self): # search all names for case-insensitive match for name in dir(tObj): if (name.lower() == runThisTest.lower() - or name.lower() == ('test' + runThisTest.lower()) - or name.lower() == ('xtest' + runThisTest.lower())): + or name.lower() == ('test' + runThisTest.lower()) + or name.lower() == ('xtest' + runThisTest.lower())): runThisTest = name break if hasattr(tObj, runThisTest): diff --git a/music21/test/test_chord.py b/music21/test/test_chord.py index 3c06f08ac..caa50790e 100644 --- a/music21/test/test_chord.py +++ b/music21/test/test_chord.py @@ -619,15 +619,15 @@ def testVolumePerPitchC(self): amps = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8] for accent in [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 1, 0.5, 0.5, 0.5, - 1, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 0.5, - None, None, None, None, - None, None, None, None, - None, None, None, None, - None, None, None, None, - 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0.5, 0.5, 0.5, 0.5, - 0.5, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 1, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 0.5, + None, None, None, None, + None, None, None, None, + None, None, None, None, + None, None, None, None, + 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0.5, 0.5, 0.5, 0.5, + 0.5, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, ]: cNew = copy.deepcopy(c) if accent is not None: diff --git a/music21/test/test_metadata.py b/music21/test/test_metadata.py index 3784dd4e3..06e21df60 100644 --- a/music21/test/test_metadata.py +++ b/music21/test/test_metadata.py @@ -430,7 +430,7 @@ def checkUniqueNamedItem( # self.assertIsInstance isn't sufficient, apparently. assert isinstance(itemNamespaceName, metadata.Contributor) self.assertEqual(itemNamespaceName.role, - contributorRole if contributorRole else uniqueName) + contributorRole if contributorRole else uniqueName) def testUniqueNameAccess(self): self.checkUniqueNamedItem('abstract', 'dcterms') diff --git a/music21/test/test_note.py b/music21/test/test_note.py index 35fa34cc6..7c039df7a 100644 --- a/music21/test/test_note.py +++ b/music21/test/test_note.py @@ -246,7 +246,7 @@ def testNoteEquality(self): articulations.StrongAccent()] for a, b, c, d, match in [(n1, n4, a1, a1, True), - (n1, n2, a1, a1, False), (n1, n3, a1, a1, False), + (n1, n2, a1, a1, False), (n1, n3, a1, a1, False), # same pitch different orderings (n1, n4, a2, a3, True), (n1, n4, a4, a5, True), # different pitch same orderings diff --git a/music21/test/test_pitch.py b/music21/test/test_pitch.py index 309fe3f3c..fbd4379bb 100644 --- a/music21/test/test_pitch.py +++ b/music21/test/test_pitch.py @@ -266,7 +266,7 @@ def compare(_past, _result): pList = [Pitch('f#3'), Pitch('f3'), Pitch('f#3'), Pitch('g3'), Pitch('f#4'), Pitch('f#4')] result = [('sharp', False), ('natural', True), ('sharp', True), - (None, None), ('sharp', True), ('sharp', False)] + (None, None), ('sharp', True), ('sharp', False)] # no 4 is a dicey affair; could go either way ks = key.KeySignature(1) proc(pList, [], ks.alteredPitches) diff --git a/music21/text.py b/music21/text.py index 92426e02f..28a6dfab0 100644 --- a/music21/text.py +++ b/music21/text.py @@ -291,7 +291,6 @@ class TextBox(base.Music21Object): .. image:: images/textBoxes-01.* :width: 600 - ''' _styleClass = style.TextStyle classSortOrder = -31 # text expressions are -30 @@ -417,7 +416,7 @@ def readExcerpts(cls): ''' for languageCode in cls.languageCodes: thisExcerpt = (common.getSourceFilePath() / 'languageExcerpts' - / 'trainingData' / (languageCode + '.txt')) + / 'trainingData' / (languageCode + '.txt')) with thisExcerpt.open(encoding='utf-8') as f: excerptWords = f.read().split() diff --git a/music21/tree/core.py b/music21/tree/core.py index 5de72e465..ec6980294 100644 --- a/music21/tree/core.py +++ b/music21/tree/core.py @@ -378,7 +378,6 @@ def update(self) -> None: child notes of `n` then this would not fix that node's balance/height. This method assumes that children have the correct information and only updates the information for this node. - ''' leftHeight = self.leftChild.height if self.leftChild else -1 rightHeight = self.rightChild.height if self.rightChild else -1 diff --git a/music21/tree/fromStream.py b/music21/tree/fromStream.py index 46ab6da85..f1bcb407b 100644 --- a/music21/tree/fromStream.py +++ b/music21/tree/fromStream.py @@ -207,7 +207,6 @@ def asTree( >>> etFlatNotes = tree.fromStream.asTree(score, flatten=True, classList=(note.Note,)) >>> etFlatNotes to 8.0) > - ''' def recurseGetTreeByClass( innerStream, diff --git a/music21/tree/spans.py b/music21/tree/spans.py index 36ed0e273..4c34d892b 100644 --- a/music21/tree/spans.py +++ b/music21/tree/spans.py @@ -560,7 +560,6 @@ def pitches(self) -> tuple[pitch.Pitch, ...]: True >>> pts.pitches is c.pitches False - ''' return self.element.pitches @@ -623,7 +622,6 @@ def canMerge(self, other: Timespan) -> tuple[bool, str]: > >>> print(timespan_twoWrong.part) - ''' can, message = super().canMerge(other) if can is True: diff --git a/music21/tree/trees.py b/music21/tree/trees.py index 2cae3ecf1..c9d5b4f30 100644 --- a/music21/tree/trees.py +++ b/music21/tree/trees.py @@ -400,7 +400,6 @@ def __iter__(self): ... - ''' for node in self.iterNodes(): yield node.payload @@ -736,7 +735,6 @@ def _getPositionsFromElements(self, elements): In an ElementTree, this will be a list of .sortTuple() calls. In an OffsetTree, this will be a list of .offset calls - ''' return [self.getPositionFromElementUnsafe(el) for el in elements] @@ -1077,7 +1075,6 @@ def __iter__(self): ... - ''' for node in self.iterNodes(): for el in node.payload: @@ -1381,7 +1378,6 @@ def overlapTimePoints(self, includeStopPoints=False, returnVerticality=False): >>> otp = scoreOffsetTree.overlapTimePoints(returnVerticality=True) >>> otp[0] {0.5: } - ''' checkPoints = self.allOffsets() if includeStopPoints is False else self.allTimePoints() overlaps = [] diff --git a/music21/tree/verticality.py b/music21/tree/verticality.py index 789d6466a..07d6f1f92 100644 --- a/music21/tree/verticality.py +++ b/music21/tree/verticality.py @@ -1064,7 +1064,7 @@ def getAllVoiceLeadingQuartets( if ((verticalityStreamParts[pp[0]] == thisQuartetTopPart or verticalityStreamParts[pp[0]] == thisQuartetBottomPart) and (verticalityStreamParts[pp[1]] == thisQuartetTopPart - or verticalityStreamParts[pp[1]] == thisQuartetBottomPart)): + or verticalityStreamParts[pp[1]] == thisQuartetBottomPart)): isAppropriate = True break if not isAppropriate: diff --git a/music21/variant.py b/music21/variant.py index f365d25af..77f997c8c 100644 --- a/music21/variant.py +++ b/music21/variant.py @@ -469,7 +469,9 @@ def replacedElements(self, contextStream=None, classList=None, classes.append(e.classes[0]) if classList is not None: classes.extend(classList) - returnStream = contextStream.getElementsByOffset(vStart, vEnd, + returnStream = contextStream.getElementsByOffset( + vStart, + vEnd, includeEndBoundary=False, mustFinishInSpan=False, mustBeginInSpan=True, @@ -483,12 +485,16 @@ def replacedElements(self, contextStream=None, classList=None, classes.append(e.classes[0]) if classList is not None: classes.extend(classList) - returnPart1 = contextStream.getElementsByOffset(vStart, vMiddle, + returnPart1 = contextStream.getElementsByOffset( + vStart, + vMiddle, includeEndBoundary=False, mustFinishInSpan=False, mustBeginInSpan=True, classList=classes).stream() - returnPart2 = contextStream.getElementsByOffset(vMiddle, vEnd, + returnPart2 = contextStream.getElementsByOffset( + vMiddle, + vEnd, includeEndBoundary=False, mustFinishInSpan=False, mustBeginInSpan=True).stream() @@ -1327,7 +1333,6 @@ def mergePartAsOssia(mainPart, ossiaPart, ossiaName, {0.0} {2.0} ... - ''' if inPlace: returnObj = mainPart @@ -1588,7 +1593,6 @@ def refineVariant(s, sVariant, *, inPlace=False): {1.0} {2.0} {3.0} - ''' # stream that will be returned if sVariant not in s.getElementsByClass(Variant): @@ -1682,7 +1686,6 @@ def _mergeVariantMeasureStreamsCarefully(streamX, streamY, variantName, *, inPla ''' There seem to be some problems with this function, and it isn't well tested. It is not recommended to use it at this time. - ''' # stream that will be returned if inPlace: @@ -1863,7 +1866,7 @@ def _getBestListAndScore(streamX, streamY, badnessDict, listDict, # Check the added bar case: kList, kBadness = _getBestListAndScore(streamX, streamY, badnessDict, listDict, - isNone=True, streamXIndex=streamXIndex, streamYIndex=streamYIndex + 1) + isNone=True, streamXIndex=streamXIndex, streamYIndex=streamYIndex + 1) if kList is None: kList = [] if kList: @@ -1922,7 +1925,6 @@ def _diffScore(measureX, measureY): >>> m2.append([note.Note('e'), note.Note('f'), note.Note('g#'), note.Note('a')]) >>> variant._diffScore(m1, m2) 0.4... - ''' hashes = getMeasureHashes([measureX, measureY]) if hashes[0] == hashes[1]: @@ -1957,7 +1959,6 @@ def _getRegionsFromStreams(streamX, streamY): ('replace', 1, 3, 1, 2), ('equal', 3, 6, 2, 5), ('insert', 6, 6, 5, 6)] - ''' hashesX = getMeasureHashes(streamX) hashesY = getMeasureHashes(streamY) @@ -2170,7 +2171,6 @@ def _generateVariant(noteList, originStream, start, variantName=None): >>> v.groups ['paris'] - ''' returnVariant = Variant() for n in noteList: @@ -2230,7 +2230,6 @@ def makeAllVariantsReplacements(streamWithVariants, (4.0, 'replacement', 4.0, 4.0) (12.0, 'elongation', 4.0, 12.0) (20.0, 'deletion', 8.0, 4.0) - ''' if inPlace: @@ -2433,23 +2432,25 @@ def _getNextElements(s, v, numberOfElements=1): # Get next element in s after v which is of type vClass if lengthType == 'elongation': variantOffset = v.getOffsetBySite(s) - potentialTargets = s.getElementsByOffset(variantOffset, - offsetEnd=s.highestTime, - includeEndBoundary=True, - mustFinishInSpan=False, - mustBeginInSpan=True, - classList=[vClass]) + potentialTargets = s.getElementsByOffset( + variantOffset, + offsetEnd=s.highestTime, + includeEndBoundary=True, + mustFinishInSpan=False, + mustBeginInSpan=True, + classList=[vClass]) returnElement = potentialTargets.first() else: replacementDuration = v.replacementQuarterLength variantOffset = v.getOffsetBySite(s) - potentialTargets = s.getElementsByOffset(variantOffset + replacementDuration, - offsetEnd=s.highestTime, - includeEndBoundary=True, - mustFinishInSpan=False, - mustBeginInSpan=True, - classList=[vClass]) + potentialTargets = s.getElementsByOffset( + variantOffset + replacementDuration, + offsetEnd=s.highestTime, + includeEndBoundary=True, + mustFinishInSpan=False, + mustBeginInSpan=True, + classList=[vClass]) returnElement = potentialTargets.first() @@ -2535,12 +2536,13 @@ def makeVariantBlocks(s): for v in variantsToBeDone: startOffset = s.elementOffset(v) endOffset = v.replacementQuarterLength + startOffset - conflictingVariants = s.getElementsByOffset(offsetStart=startOffset, - offsetEnd=endOffset, - includeEndBoundary=False, - mustFinishInSpan=False, - mustBeginInSpan=True, - classList=[Variant]) + conflictingVariants = s.getElementsByOffset( + offsetStart=startOffset, + offsetEnd=endOffset, + includeEndBoundary=False, + mustFinishInSpan=False, + mustBeginInSpan=True, + classList=[Variant]) for cV in conflictingVariants: oldReplacementDuration = cV.replacementQuarterLength if s.elementOffset(cV) == startOffset: @@ -2650,19 +2652,19 @@ def testDeepCopyVariantA(self): # normal in-place variant functionality s.insert(5, v1) self.assertEqual(self.pitchOut(s.pitches), - '[G4, G4, G4, G4, G4, G4, G4, G4]') + '[G4, G4, G4, G4, G4, G4, G4, G4]') sv = s.activateVariants(inPlace=False) self.assertEqual(self.pitchOut(sv.pitches), - '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') + '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') # test functionality on a deepcopy sCopy = copy.deepcopy(s) self.assertEqual(len(sCopy.getElementsByClass(Variant)), 1) self.assertEqual(self.pitchOut(sCopy.pitches), - '[G4, G4, G4, G4, G4, G4, G4, G4]') + '[G4, G4, G4, G4, G4, G4, G4, G4]') sCopy.activateVariants(inPlace=True) self.assertEqual(self.pitchOut(sCopy.pitches), - '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') + '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') def testDeepCopyVariantB(self): s = stream.Stream() @@ -2678,11 +2680,11 @@ def testDeepCopyVariantB(self): sCopy = copy.deepcopy(s) sCopy.activateVariants(inPlace=True) self.assertEqual(self.pitchOut(sCopy.pitches), - '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') + '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') # can transpose the note in place sCopy.notes[5].transpose(12, inPlace=True) self.assertEqual(self.pitchOut(sCopy.pitches), - '[G4, G4, G4, G4, G4, F#5, A-4, G4, G4]') + '[G4, G4, G4, G4, G4, F#5, A-4, G4, G4]') # however, if the Variant deepcopy still references the original # notes it had, then when we try to activate the variant in the @@ -2690,7 +2692,7 @@ def testDeepCopyVariantB(self): s.activateVariants(inPlace=True) self.assertEqual(self.pitchOut(s.pitches), - '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') + '[G4, G4, G4, G4, G4, F#4, A-4, G4, G4]') class TestExternal(unittest.TestCase): diff --git a/music21/voiceLeading.py b/music21/voiceLeading.py index 0387ac771..7a137cf30 100644 --- a/music21/voiceLeading.py +++ b/music21/voiceLeading.py @@ -577,15 +577,15 @@ def parallelMotion( if isinstance(requiredInterval, str): requiredInterval = interval.Interval(requiredInterval) intervalsAreValid = (vInt0.semiSimpleName - == requiredInterval.semiSimpleName + == requiredInterval.semiSimpleName and vInt1.semiSimpleName - == requiredInterval.semiSimpleName) + == requiredInterval.semiSimpleName) elif isinstance(requiredInterval, (interval.Interval, interval.DiatonicInterval)): intervalsAreValid = (vInt0.semiSimpleName - == requiredInterval.semiSimpleName + == requiredInterval.semiSimpleName and vInt1.semiSimpleName - == requiredInterval.semiSimpleName) + == requiredInterval.semiSimpleName) return intervalsAreValid @@ -1161,7 +1161,7 @@ def isProperResolution(self) -> bool: if keyScale and n2degree != 3: return False return (self.outwardContraryMotion() - and secondHarmony == 6) + and secondHarmony == 6) elif firstHarmony == 'd5': if keyScale and n1degree != 7: @@ -1169,7 +1169,7 @@ def isProperResolution(self) -> bool: if keyScale and n2degree != 1: return False return (self.inwardContraryMotion() - and secondHarmony == 3) + and secondHarmony == 3) elif firstHarmony == 'm7': if keyScale and n1degree != 5: @@ -1291,9 +1291,9 @@ def modalOpening(self) -> bool: openingIntervals = ('P1', 'P5') openingFunctions = ('I', 'V') return ((v0.simpleName in openingIntervals - or v1.simpleName in openingIntervals) - and (r1[0].upper() in openingFunctions if r1 is not False else False - or r2[0].upper() in openingFunctions if r2 is not False else False)) + or v1.simpleName in openingIntervals) + and (r1[0].upper() in openingFunctions if r1 is not False else False + or r2[0].upper() in openingFunctions if r2 is not False else False)) @common.decorators.deprecated( 'June 2026', 'v12', 'Use `not vlq.modalOpening()` instead.' @@ -1367,10 +1367,10 @@ def clausulaVera(self) -> bool: tonicName = self.key.tonic.name hIntervalNames = {self.hIntervals[0].name, self.hIntervals[1].name} return (hIntervalNames == {'m2', 'M2'} - and self.contraryMotion() - and self.vIntervals[1].name in ('P1', 'P8') - and self.v1n2.name == tonicName - and self.v2n2.name == tonicName) + and self.contraryMotion() + and self.vIntervals[1].name in ('P1', 'P8') + and self.v1n2.name == tonicName + and self.v2n2.name == tonicName) @common.decorators.deprecated( 'June 2026', 'v12', 'Use `not vlq.clausulaVera()` instead.' @@ -1684,7 +1684,6 @@ def getObjectsByClass(self, classFilterList, partNums=None): , ] >>> vs1.getObjectsByClass('Note', [1, 2]) [, , ] - ''' if not common.isIterable(classFilterList): classFilterList = [classFilterList] @@ -1883,8 +1882,8 @@ def _calcTNLS(self): Calculates the three note linear segments if only three Verticalities provided. ''' for partNum in range(min(len(self.verticalities[0].getObjectsByClass(note.Note)), - len(self.verticalities[1].getObjectsByClass(note.Note)), - len(self.verticalities[2].getObjectsByClass(note.Note))) + len(self.verticalities[1].getObjectsByClass(note.Note)), + len(self.verticalities[2].getObjectsByClass(note.Note))) ): self.tnlsDict[partNum] = ThreeNoteLinearSegment( [ @@ -1916,7 +1915,6 @@ def hasPassingTone(self, partNumToIdentify, unaccentedOnly=False): True >>> vt.hasPassingTone(1) False - ''' if partNumToIdentify in self.tnlsDict: ret = self.tnlsDict[partNumToIdentify].couldBePassingTone() @@ -2082,7 +2080,6 @@ class ThreeNoteLinearSegment(NNoteLinearSegment): >>> defaults.pitchOctave 4 - ''' _DOC_ORDER = ['couldBePassingTone', 'couldBeDiatonicPassingTone', @@ -2342,10 +2339,10 @@ def couldBeDiatonicNeighborTone(self) -> bool: ''' return (self._isComplete() - and self.n1.nameWithOctave == self.n3.nameWithOctave - and self.iLeft.chromatic.undirected == 2 - and self.iRight.chromatic.undirected == 2 - and self.iLeft.direction * self.iRight.direction == -1) + and self.n1.nameWithOctave == self.n3.nameWithOctave + and self.iLeft.chromatic.undirected == 2 + and self.iRight.chromatic.undirected == 2 + and self.iLeft.direction * self.iRight.direction == -1) def couldBeChromaticNeighborTone(self) -> bool: @@ -2363,10 +2360,10 @@ def couldBeChromaticNeighborTone(self) -> bool: False ''' return (self._isComplete() - and (self.n1.nameWithOctave == self.n3.nameWithOctave - and self.iLeft.isChromaticStep - and self.iRight.isChromaticStep - and (self.iLeft.direction * self.iRight.direction == -1))) + and (self.n1.nameWithOctave == self.n3.nameWithOctave + and self.iLeft.isChromaticStep + and self.iRight.isChromaticStep + and (self.iLeft.direction * self.iRight.direction == -1))) # Below: beginnings of an implementation for any object segments, diff --git a/music21/volpiano.py b/music21/volpiano.py index 58f8b30e9..2c12459ee 100644 --- a/music21/volpiano.py +++ b/music21/volpiano.py @@ -392,8 +392,8 @@ def setAccFromPitch(dist, setNatural=False): continue if n.notehead == 'x' or (n.hasEditorialInformation - and 'liquescence' in n.editorial - and n.editorial.liquescence): + and 'liquescence' in n.editorial + and n.editorial.liquescence): tokenName = liquescentPitches[indexInPitchString] else: tokenName = normalPitches[indexInPitchString] diff --git a/music21/volume.py b/music21/volume.py index 6b08dcd51..85f81ba61 100644 --- a/music21/volume.py +++ b/music21/volume.py @@ -231,7 +231,6 @@ def getRealized( >>> s.notes[7].volume.velocityIsRelative = False >>> s.notes[7].volume.getRealized() 0.1574803... - ''' # velocityIsRelative might be best set at import. e.g., from MIDI, # velocityIsRelative is False, but in other applications, it may not