Skip to content

Commit

Permalink
lint and flake
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Jun 27, 2023
1 parent 7cca013 commit 8028a86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions music21/common/stringTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def parenthesesMatch(
* New in v9.3.
'''
if not len(open) or not len(close):
if not open or not close:
raise ValueError('Neither open nor close can be empty.')

mainMatch = ParenthesesMatch(-1, -1, '', [])
Expand All @@ -446,13 +446,13 @@ def parenthesesMatch(
i = 0
while i < len(s):
if (not lastCharWasBackslash
and s[i:i+len(open)] == open):
and s[i:i + len(open)] == open):
curPM = ParenthesesMatch(i + len(open), -1, '', [])
stack.append(curPM)
i += len(open)
continue
elif (not lastCharWasBackslash
and s[i:i+len(close)] == close):
and s[i:i + len(close)] == close):
if len(stack) <= 1:
raise ValueError(f'Closing {close!r} without {open!r} at index {i}.')
curPM = stack.pop()
Expand All @@ -473,8 +473,8 @@ def parenthesesMatch(

return mainMatch.nested

# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
if __name__ == '__main__':
import music21
music21.mainTest()

0 comments on commit 8028a86

Please sign in to comment.