Skip to content

Commit

Permalink
Remove tons of ellipses
Browse files Browse the repository at this point in the history
There were a number of places in the code where ellipses were being used to hide differences among Python versions (we added two more to turn on 3.13 just now).

Remove places that were still being used for differences with 3.9 and below (including some 2.7!)

And just generally get out of the old sloppy habit of using ... instead of knowing what the sentence actually says.
  • Loading branch information
mscuthbert committed Oct 29, 2024
1 parent 6235b41 commit dc3ee80
Show file tree
Hide file tree
Showing 147 changed files with 848 additions and 783 deletions.
4 changes: 3 additions & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
15. PR and Commit to GitHub at this point w/ commit comment of the new version,
then don't change anything until the next step is done.
(.gitignore will avoid uploading the large files created here...)
(.gitignore will avoid uploading the large files created here.)
16. Switch back to master/main branch
Expand All @@ -71,7 +71,7 @@
Drag in this order: .tar.gz, -docs.zip, no-corpus.tar.gz
Finish this before doing the next step, even though it looks like it could be done in parallel.
20. Upload the new file to PyPI with "twine upload music21-7.3.5a2.tar.gz", and same for the
whl file (but NOT no corpus) [*]
Expand All @@ -87,7 +87,7 @@
username:your_username
password:your_password
21. Delete the two .tar.gz files and .whl file in dist...
21. Delete the two .tar.gz files and .whl file in dist.
22. For starting a new major release create a GitHub branch for the old one.
Expand Down
4 changes: 2 additions & 2 deletions documentation/docbuild/documenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def inheritedDocAttrMapping(self):
'''
# if one of the _DOC_ATTRs is exactly the same as the previous base class,
# only show it once.
# TODO: do this on an attribute by attribute basis...
# TODO: do this on an attribute by attribute basis
seenBaseClassDocAttrs = []

if self._inheritedDocAttrMapping is None:
Expand Down Expand Up @@ -1501,7 +1501,7 @@ def run(self):
result.extend(self.makeHeading(self.headingText, 1))
result.extend(self.rstEditingWarningFormat)
result.extend(self.rstCorpusIntroductionFormat)
# TODO: use... common.getCorpusContentDirs to make sure nothing is missed.
# TODO: use common.getCorpusContentDirs to make sure nothing is missed.
for directoryInformation in corpus.corpora.CoreCorpus().getWorkReferences():
result.extend(self.getRstComposerDictFormat(directoryInformation))
return result
Expand Down
2 changes: 1 addition & 1 deletion documentation/docbuild/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
eval "${SCRIPT}";
Otherwise just contact MSC...
Otherwise just contact MSAC.
'''
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion documentation/docbuild/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def write(self, filePath, rst):
shouldWrite = False
else:
pass
# # uncomment for help in figuring out why a file keeps being different...
# # uncomment for help in figuring out why a file keeps being different
# import difflib
# print(common.relativepath(filePath))
# print('\n'.join(difflib.ndiff(rst.split('\n'), oldRst.split('\n'))))
Expand Down
2 changes: 1 addition & 1 deletion documentation/testDocumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def getDocumentationFiles(runOne=False):
fullModulePath = os.path.join(root, module)
if not module.endswith('.rst'):
continue
if module.startswith('module'): # we have this already...
if module.startswith('module'): # we have this already
continue
if module in skipModules:
continue
Expand Down
2 changes: 1 addition & 1 deletion music21/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
'mainTest',

'prebase', # before all
'base', # top...
'base', # top
'sites', # important

# sub folders
Expand Down
6 changes: 3 additions & 3 deletions music21/abcFormat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def getMetronomeMarkObject(self) -> tempo.MetronomeMark|None:
else: # this is an error case
environLocal.printDebug(['incorrectly encoded / unparsable duration:', dur])
n, d = '1', '1'
# n and d might be strings...
# n and d might be strings
referent += (float(n) / float(d)) * 4
else: # assume we just have a quarter definition, e.g., Q:90
number = float(nonText)
Expand Down Expand Up @@ -2323,7 +2323,7 @@ def tokenize(self, strSrc: str) -> None:
self.skipAhead = j - self.pos # not + 1
break
j += 1
# not found, continue...
# not found, continue
continue

# get slurs, ensuring that they're not confused for tuplets
Expand Down Expand Up @@ -3013,7 +3013,7 @@ def splitByVoice(self) -> list[ABCHandler]:
'D3', 'D3', '|', 'D6', '|',
'D3', 'D3', '|', 'D6', '||']
Then later the metadata can be merged at the start of each voice...
Then later the metadata can be merged at the start of each voice:
>>> mergedTokens = tokenColls[0] + tokenColls[1]
>>> mergedTokens
Expand Down
8 changes: 4 additions & 4 deletions music21/abcFormat/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def abcToStreamPart(
try:
p.makeBeams(inPlace=True)
except (meter.MeterException, stream.StreamException) as e:
environLocal.warn(f'Error in beaming...ignoring: {e}')
environLocal.warn(f'Error in beaming. Ignoring: {e}')

# copy spanners into topmost container; here, a part
rm = []
Expand Down Expand Up @@ -371,7 +371,7 @@ def parseABCNote(
n.tie.style = 'normal'
elif t.tie == 'stop':
n.tie = tie.Tie(t.tie)
# Was: Extremely Slow for large Opus files... why?
# Was: Extremely Slow for large Opus files. Why?
# Answer: some pieces didn't close all their spanners, so
# everything was in a Slur/Diminuendo, etc.
for span in t.applicableSpanners:
Expand Down Expand Up @@ -587,7 +587,7 @@ def reBar(music21Part, *, inPlace=False):
to the last time signature, in this case 2/4. The default is to reBar in place.
The measure numbers are updated accordingly.
(NOTE: reBar is called automatically in abcToStreamPart, hence not demonstrated below...)
(NOTE: reBar is called automatically in abcToStreamPart, hence not demonstrated below.)
The key signature and clef are assumed to be the same in the second measure after the
split, so both are omitted. If the time signature is not the same in the second measure,
Expand Down Expand Up @@ -1157,7 +1157,7 @@ def testTiesTranslate(self):
def xtestMergeScores(self):
from music21 import corpus
unused = corpus.parse('josquin/laDeplorationDeLaMorteDeJohannesOckeghem')
# this was getting incorrect Clefs...
# this was getting incorrect Clefs


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions music21/analysis/discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,9 @@ def getPitchSpan(self, subStream) -> tuple[pitch.Pitch, pitch.Pitch]|None:
For a given subStream, return a tuple consisting of the two pitches
with the minimum and maximum pitch space value.
This public method may be used by other classes.
This public method may be used by other classes. It ignores ChordSymbol objects.
ignores ChordSymbol objects...
Demonstration:
>>> s = corpus.parse('bach/bwv66.6')
>>> p = analysis.discrete.Ambitus()
Expand Down Expand Up @@ -1362,7 +1362,7 @@ def analysisClassFromMethodName(method: str) -> type[DiscreteAnalysis]|None:
>>> acfmn('span')
<class 'music21.analysis.discrete.Ambitus'>
This one is fundamentally important...
This one is fundamentally important:
>>> acfmn('key')
<class 'music21.analysis.discrete.AardenEssen'>
Expand Down
2 changes: 1 addition & 1 deletion music21/analysis/floatingKey.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class KeyAnalyzer:
<music21.key.Key of b minor>, <music21.key.Key of C# major>,
<music21.key.Key of F# major>, <music21.key.Key of b minor>]
Major smoothing...
Major smoothing:
>>> ka.windowSize = ka.numMeasures // 2
>>> ka.run() # only the pickup seems to be in A major by this approach
Expand Down
2 changes: 1 addition & 1 deletion music21/analysis/reduceChords.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def reduceMeasureToNChords(
if currentGreedyChord is not None:
currentGreedyChord.quarterLength = currentGreedyChordNewLength
currentGreedyChordNewLength = 0.0
# even chord lengths...
# even chord lengths
for i in range(1, len(measureObject)):
c = measureObject[i]
cOffsetCurrent = c.offset
Expand Down
4 changes: 2 additions & 2 deletions music21/analysis/reduceChordsOld.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
self.positionInMeasure = None
self.numberOfElementsInMeasure = None

# for working...
# for working
self._lastPitchedObject = None
self._lastTs = None

Expand Down Expand Up @@ -136,7 +136,7 @@ def reduceMeasureToNChords(self,
currentGreedyChord.quarterLength = currentGreedyChordNewLength
currentGreedyChordNewLength = 0.0

# even chord lengths...
# even chord lengths
for i in range(1, len(mObj)):
c = mObj[i]
cOffsetCurrent = c.offset
Expand Down
6 changes: 3 additions & 3 deletions music21/analysis/windowed.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def analyze(self, windowSize, windowType='overlap'):
try:
data[i], color[i] = self.processor.process(current)
except DiscreteAnalysisException:
# current might have no notes...all rests?
# current might have no notes: all rests?
data[i], color[i] = (None, None, 0), '#ffffff'

elif windowType == 'noOverlap':
Expand All @@ -203,7 +203,7 @@ def analyze(self, windowSize, windowType='overlap'):
try:
data[i], color[i] = self.processor.process(current)
except DiscreteAnalysisException:
# current might have no notes...all rests?
# current might have no notes: all rests?
data[i], color[i] = (None, None, 0), '#ffffff'

start = end
Expand Down Expand Up @@ -232,7 +232,7 @@ def analyze(self, windowSize, windowType='overlap'):
try:
data[i], color[i] = self.processor.process(current)
except DiscreteAnalysisException:
# current might have no notes...all rests?
# current might have no notes: all rests?
data[i], color[i] = (None, None, 0), '#ffffff'

return data, color
Expand Down
4 changes: 2 additions & 2 deletions music21/articulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class Spiccato(Staccato, Accent):
def __init__(self, **keywords):
Staccato.__init__(self)
with tempAttribute(self, 'lengthShift'):
Accent.__init__(self) # order matters...
Accent.__init__(self) # order matters!


class Tenuto(LengthArticulation):
Expand Down Expand Up @@ -405,7 +405,7 @@ class TechnicalIndication(Articulation):

class Harmonic(TechnicalIndication):
'''
A general harmonic indicator -- StringHarmonic is probably what you want...
A general harmonic indicator -- StringHarmonic is probably what you want.
'''

class Bowing(TechnicalIndication):
Expand Down
12 changes: 6 additions & 6 deletions music21/audioSearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def autocorrelationFunction(recordedSignal, recordSampleRateIn):
+ f'numpy installed (scipy recommended). Missing {base._missingImport}')
import numpy
try:
with warnings.catch_warnings(): # scipy.signal gives ImportWarning...
with warnings.catch_warnings(): # scipy.signal gives ImportWarning
warnings.simplefilter('ignore', ImportWarning)
# numpy warns scipy that oldnumeric will be dropped soon.
warnings.simplefilter('ignore', DeprecationWarning)
Expand Down Expand Up @@ -351,7 +351,7 @@ def getFrequenciesFromMicrophone(length=10.0, storeWaveFilename=None):
Returns a list of frequencies detected.
TODO -- find a way to test... or at least demo
TODO -- find a way to test or at least demo
'''
if 'numpy' in base._missingImport:
raise AudioSearchException(
Expand Down Expand Up @@ -436,7 +436,7 @@ def getFrequenciesFromPartialAudioFile(waveFilenameOrHandle='temp', length=10.0,
>>> print(currentSample) # should be near 44100, but probably not exact
44032
Now read the next 1 second...
Now read the next 1 second:
>>> fTup = audioSearch.getFrequenciesFromPartialAudioFile(pachelbelFileHandle, length=1.0,
... startSample=currentSample)
Expand Down Expand Up @@ -534,7 +534,7 @@ def smoothFrequencies(
Smooths the shape of the signal in order to avoid false detections in the fundamental
frequency. Takes in a list of ints or floats.
The second pitch below is obviously too low. It will be smoothed out...
The second pitch below is obviously too low. It will be smoothed out:
>>> inputPitches = [440, 220, 440, 440, 442, 443, 441, 470, 440, 441, 440,
... 442, 440, 440, 440, 397, 440, 440, 440, 442, 443, 441,
Expand Down Expand Up @@ -971,11 +971,11 @@ def decisionProcess(
countdown = countdown + 1
elif dist > 20 and countdown == 0:
countdown += 1
environLocal.printDebug(f'Excessive distance....? {dist=}')
environLocal.printDebug(f'Excessive distance? {dist=}')

elif dist > 30 and countdown == 1:
countdown += 1
environLocal.printDebug(f'Excessive distance....? {dist=}')
environLocal.printDebug(f'Excessive distance? {dist=}')

elif ((firstNotePage is not None and lastNotePage is not None)
and ((positionBeginningData < firstNotePage
Expand Down
6 changes: 3 additions & 3 deletions music21/audioSearch/scoreFollower.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def repeatTranscription(self):
notesList, durationList = audioSearch.joinConsecutiveIdenticalPitches(
detectedPitchObjects)
self.silencePeriodDetection(notesList)
environLocal.printDebug('made it to here...')
environLocal.printDebug('made it to here.')
excerpt = self.scoreStream[self.lastNotePosition:self.lastNotePosition + len(notesList)]
scNotes = stream.Part(excerpt)
# print('1')
Expand All @@ -178,12 +178,12 @@ def repeatTranscription(self):
)
# print('3')
self.processing_time = time() - time_start
environLocal.printDebug('and even to here...')
environLocal.printDebug('and even to here.')
if END_OF_SCORE is True:
exitType = 'endOfScore' # 'endOfScore'
return exitType

# estimate position, or exit if we can't at all...
# estimate position, or exit if we can't at all
exitType = self.updatePosition(prob, totalLengthPeriod, time_start)

if self.useMic is False: # reading from the disc (only for TESTS)
Expand Down
2 changes: 1 addition & 1 deletion music21/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self,
**keywords):
super().__init__(**keywords)

self._type = None # same as style...
self._type = None # same as style
# this will raise an exception on error from property
self.type = type

Expand Down
Loading

0 comments on commit dc3ee80

Please sign in to comment.