Skip to content

Commit

Permalink
More lints
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Sep 17, 2024
1 parent a7058e5 commit 1394dbc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions music21/chord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

if t.TYPE_CHECKING:
from music21 import stream

from music21.style import Style

environLocal = environment.Environment('chord')

Expand Down Expand Up @@ -4195,9 +4195,12 @@ def setColor(self, value, pitchTarget=None):
# assign to base
if pitchTarget is None and self._notes:
chord_style = self.style
if t.TYPE_CHECKING:
assert isintance(chord_style, Style)
chord_style.color = value
for n in self._notes:
n.style.color = value
n_style = n.style
n_style.color = value

return
elif isinstance(pitchTarget, str):
Expand Down
2 changes: 2 additions & 0 deletions music21/derivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def chain(self) -> Generator[base.Music21Object, None, None]:
orig: base.Music21Object | None = self.origin
while orig is not None:
yield orig
if t.TYPE_CHECKING:
assert orig is not None
orig = orig.derivation.origin

@property
Expand Down
7 changes: 6 additions & 1 deletion music21/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
from music21 import chord
from music21 import instrument
from music21 import percussion
from music21.style import Style

_NotRestType = t.TypeVar('_NotRestType', bound='NotRest')

environLocal = environment.Environment('note')
Expand Down Expand Up @@ -2095,7 +2097,10 @@ def testBasic(self):
b = note.Note()
b.quarterLength = qLen
b.name = pitchName
b.style.color = '#FF00FF'
b_style = b.style
if t.TYPE_CHECKING:
assert isinstance(b_style, Style)
b_style.color = '#FF00FF'
a.append(b)

if self.show:
Expand Down

0 comments on commit 1394dbc

Please sign in to comment.