Skip to content

Commit

Permalink
Better typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Jun 14, 2024
1 parent d1ae529 commit 2b60acf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion music21/figuredBass/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
def augmentedSixthToDominant(
augSixthPossib,
augSixthType: int | None = None,
augSixthChordInfo: list[pitch.Pitch, None] | None = None
augSixthChordInfo: list[pitch.Pitch | None] | None = None
) -> tuple[pitch.Pitch, ...]:
'''
Resolves French (augSixthType = 1), German (augSixthType = 2), and Swiss (augSixthType = 3)
Expand Down Expand Up @@ -108,6 +108,9 @@ def augmentedSixthToDominant(
else:
raise ResolutionException(f'Unknown augSixthType: {augSixthType!r}')

if any(x is None for x in [bass, root, fifth, other]):
raise ResolutionException(f'Chord must have bass, root, fifth, and sixth or seventh')

howToResolve = [(lambda p: p.name == bass.name, '-m2'),
(lambda p: p.name == root.name, 'm2'),
(lambda p: p.name == fifth.name, '-m2'),
Expand Down Expand Up @@ -187,6 +190,9 @@ def augmentedSixthToMajorTonic(
else:
raise ResolutionException(f'Unknown augSixthType: {augSixthType!r}')

if any(x is None for x in [bass, root, fifth, other]):
raise ResolutionException(f'Chord must have bass, root, fifth, and sixth or seventh')

howToResolve = [(lambda p: p.name == bass.name, '-m2'),
(lambda p: p.name == root.name, 'm2'),
(lambda p: p.name == fifth.name, 'P1'),
Expand Down Expand Up @@ -266,6 +272,9 @@ def augmentedSixthToMinorTonic(
else:
raise ResolutionException(f'Unknown augSixthType: {augSixthType!r}')

if any(x is None for x in [bass, root, fifth, other]):
raise ResolutionException(f'Chord must have bass, root, fifth, and sixth or seventh')

howToResolve = [(lambda p: p.name == bass.name, '-m2'),
(lambda p: p.name == root.name, 'm2'),
(lambda p: p.name == fifth.name, 'P1'),
Expand Down

0 comments on commit 2b60acf

Please sign in to comment.