Skip to content

Commit

Permalink
more mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Aug 18, 2022
1 parent e8928cf commit 90f481f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion music21/features/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def _getIntervalHistogram(self, algorithm='midi') -> t.List[int]:
# note that this does not optimize and cache part presentations
histo = [0] * 128
# if we have parts, must add one at a time
parts: t.List[stream.Stream]
if isinstance(self.prepared, stream.Score):
parts = list(self.prepared.parts)
else:
Expand All @@ -370,8 +371,13 @@ def _getIntervalHistogram(self, algorithm='midi') -> t.List[int]:

# noNone means that we will see all connections, even w/ a gap
post = p.findConsecutiveNotes(skipRests=True,
skipChords=True, skipGaps=True, noNone=True)
skipChords=True,
skipGaps=True,
noNone=True)
for i, n in enumerate(post):
if t.TYPE_CHECKING:
assert isinstance(n, note.Note)

if i < len(post) - 1: # if not last
iNext = i + 1
nNext = post[iNext]
Expand Down
4 changes: 3 additions & 1 deletion music21/stream/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9945,7 +9945,9 @@ def pitches(self) -> t.List[pitch.Pitch]:

# --------------------------------------------------------------------------
# interval routines

# TODO: override routine to show that if noNone is True that there is no None
# and if noNone and skipChords is True, then it can be typed as list[note.Note]

def findConsecutiveNotes(
self,
*,
Expand Down

0 comments on commit 90f481f

Please sign in to comment.