Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remedy flake8 warnings: missing whitespace after keyword #1347

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/docbuild/documenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ def classDocumenters(self):
for referent in self.memberOrder:
if referent in classDocumenters:
result.append(classDocumenters[referent])
del(classDocumenters[referent])
del classDocumenters[referent]
for documenter in sorted(
classDocumenters.values(),
key=lambda x: x.referentPackageSystemPath):
Expand Down Expand Up @@ -1427,7 +1427,7 @@ def functionDocumenters(self):
for referent in self.memberOrder:
if referent in functionDocumenters:
result.append(functionDocumenters[referent])
del(functionDocumenters[referent])
del functionDocumenters[referent]
for documenter in sorted(
functionDocumenters.values(),
key=lambda x: x.referentPackageSystemPath
Expand Down
2 changes: 1 addition & 1 deletion music21/braille/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def noteToBraille(
noteTrans.append(symbols['opening_single_slur'])
music21Note.editorial.brailleEnglish.append(
f'Opening single slur {symbols["opening_single_slur"]}')
if not(beamStatus['endLongBracketSlur'] and beamStatus['beginLongBracketSlur']):
if not (beamStatus['endLongBracketSlur'] and beamStatus['beginLongBracketSlur']):
if beamStatus['endLongDoubleSlur']:
noteTrans.append(symbols['closing_double_slur'])
music21Note.editorial.brailleEnglish.append(
Expand Down
14 changes: 7 additions & 7 deletions music21/braille/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,27 +1178,27 @@ def matchOther(thisKey_inner, otherKey):
if thisKey.hand == 'right':
if storedLeft is not None:
if matchOther(thisKey, storedLeft):
yield(thisKey, storedLeft)
yield (thisKey, storedLeft)
elif (thisKey.affinity == Affinity.NOTEGROUP
and matchOther(thisKey._replace(affinity=Affinity.INACCORD), storedLeft)):
# r.h. notegroup goes before an l.h. inaccord,
# despite this being out of order
yield(thisKey, storedLeft)
yield (thisKey, storedLeft)
else:
yield(None, storedLeft)
yield (None, storedLeft)
storedRight = thisKey
storedLeft = None
else:
storedRight = thisKey
elif thisKey.hand == 'left':
if storedRight is not None:
if matchOther(thisKey, storedRight):
yield(storedRight, thisKey)
yield (storedRight, thisKey)
elif storedRight.affinity < Affinity.INACCORD:
yield(storedRight, None)
yield(None, thisKey)
yield (storedRight, None)
yield (None, thisKey)
else:
yield(storedRight, None)
yield (storedRight, None)
storedLeft = thisKey
storedRight = None
else:
Expand Down
6 changes: 3 additions & 3 deletions music21/converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,20 +1243,20 @@ def parse(value: t.Union[bundles.MetadataEntry, bytes, str, pathlib.Path],
# environLocal.printDebug(['attempting to parse()', value])
if 'forceSource' in keywords:
forceSource = keywords['forceSource']
del(keywords['forceSource'])
del keywords['forceSource']
else:
forceSource = False

# see if a work number is defined; for multi-work collections
if 'number' in keywords:
number = keywords['number']
del(keywords['number'])
del keywords['number']
else:
number = None

if 'format' in keywords:
m21Format = keywords['format']
del(keywords['format'])
del keywords['format']
else:
m21Format = None

Expand Down
2 changes: 1 addition & 1 deletion music21/corpus/corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _removeNameFromCache(self, name):
keysToRemove.append(key)

for key in keysToRemove:
del(Corpus._pathsCache[key])
del Corpus._pathsCache[key]

def _findPaths(
self,
Expand Down
2 changes: 1 addition & 1 deletion music21/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def unitSpec(durationObjectOrObjects):
return ret
else:
dO = durationObjectOrObjects
if not(hasattr(dO, 'tuplets')) or dO.tuplets is None or not dO.tuplets:
if (not hasattr(dO, 'tuplets')) or dO.tuplets is None or not dO.tuplets:
return (dO.quarterLength, dO.type, dO.dots, None, None, None)
else:
return (dO.quarterLength,
Expand Down
2 changes: 1 addition & 1 deletion music21/humdrum/spineParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def parseNonOpus(self, dataStream):
self.parsePositionInStream = 0
self.parseEventListFromDataStream(dataStream) # sets self.eventList and fileLength
try:
assert(self.parsePositionInStream == self.fileLength)
assert self.parsePositionInStream == self.fileLength
except AssertionError: # pragma: no cover
raise HumdrumException('getEventListFromDataStream failed: did not parse entire file')
self.parseProtoSpinesAndEventCollections()
Expand Down
2 changes: 1 addition & 1 deletion music21/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def all(self, skipContributors=False):

if 'title' in allOut and 'movementName' in allOut:
if allOut['movementName'] == allOut['title']:
del(allOut['title'])
del allOut['title']

return list(sorted(allOut.items()))

Expand Down
2 changes: 1 addition & 1 deletion music21/metadata/bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ def validate(self):

validatedPaths.add(metadataEntry.sourcePath)
for key in invalidatedKeys:
del(self._metadataEntries[key])
del self._metadataEntries[key]
message = f'MetadataBundle: finished validating in {timer} seconds.'
environLocal.printDebug(message)
return len(invalidatedKeys)
Expand Down
4 changes: 2 additions & 2 deletions music21/search/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _indexSingleMulticore(filePath, *args, **keywords):
'''
keywords2 = copy.copy(keywords)
if 'failFast' in keywords2:
del(keywords2['failFast'])
del keywords2['failFast']

if not isinstance(filePath, pathlib.Path):
filePath = pathlib.Path(filePath)
Expand All @@ -159,7 +159,7 @@ def _indexSingleMulticore(filePath, *args, **keywords):
indexOutput = ''
else:
raise e
return(shortFp, indexOutput, filePath)
return (shortFp, indexOutput, filePath)


def _giveUpdatesMulticore(numRun, totalRun, latestOutput):
Expand Down
2 changes: 1 addition & 1 deletion music21/search/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def getActiveMatchedRows(self):
matchedRow = self.matchedSegment
else:
matchedRow = pcToToneRow(self.matchedSegment)
return(activeRow, matchedRow)
return (activeRow, matchedRow)

@property
def zeroCenteredTransformationsFromMatched(self):
Expand Down
8 changes: 4 additions & 4 deletions music21/stream/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,7 @@ def replaceDerived(startSite=self):
target.sites.remove(self)
target.activeSite = None
if id(target) in self._offsetDict:
del(self._offsetDict[id(target)])
del self._offsetDict[id(target)]

updateIsFlat = False
if replacement.isStream:
Expand Down Expand Up @@ -9834,7 +9834,7 @@ def findConsecutiveNotes(
returnList.append(None)
lastWasNone = True
if isinstance(e, note.Note):
if not(skipUnisons is False
if not (skipUnisons is False
or len(lastPitches) != 1
or e.pitch.pitchClass != lastPitches[0].pitchClass
or (skipOctaves is False
Expand Down Expand Up @@ -12328,7 +12328,7 @@ def showVariantAsOssialikePart(self, containedPart, variantGroups, *, inPlace=Fa
eClasses = e.classes
if 'Variant' in eClasses:
elementGroups = e.groups
if (not(variantGroup in elementGroups)
if (not (variantGroup in elementGroups)
or e.lengthType in ['elongation', 'deletion']):
newPart.remove(e)
else:
Expand Down Expand Up @@ -12665,7 +12665,7 @@ def makeNotation(self,

for illegalKey in ('meterStream', 'refStreamOrTimeRange', 'bestClef'):
if illegalKey in srkCopy:
del(srkCopy[illegalKey])
del srkCopy[illegalKey]

m.makeAccidentals(searchKeySignatureByContext=True, inPlace=True, **srkCopy)
# makeTies is for cross-bar associations, and cannot be used
Expand Down
4 changes: 2 additions & 2 deletions music21/stream/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def testFlatSimple(self):
# print(n4.sites.getOffsetBySite(site))

self.assertEqual(len(sf1), 4)
assert(sf1[1] is n2)
assert sf1[1] is n2

def testActiveSiteCopiedStreams(self):
srcStream = Stream()
Expand Down Expand Up @@ -4458,7 +4458,7 @@ def testMakeNotationKeySignatureMultiVoice(self):

self.assertEqual(len(sPost.getElementsByClass(Measure)), 1)
m1 = sPost.getElementsByClass(Measure).first()
assert(m1.keySignature is not None)
assert m1.keySignature is not None
self.assertEqual(m1.keySignature.sharps, sharpsInKey)

def testMakeTies(self):
Expand Down