Skip to content

Commit

Permalink
done playing nice w/ pylint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuthbert committed Sep 17, 2024
1 parent 1394dbc commit 5303e53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
14 changes: 5 additions & 9 deletions music21/chord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3684,7 +3684,7 @@ def removeRedundantPitches(self, *, inPlace=False):
note name in two different octaves is retained.
If `inPlace` is True, a copy is not made and a list of deleted pitches is returned;
otherwise a copy is made and that copy is returned.
otherwise make and return a copy.
>>> c1 = chord.Chord(['c2', 'e3', 'g4', 'e3'])
>>> c1
Expand Down Expand Up @@ -4194,14 +4194,10 @@ 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
# Pylint going crazy here
self.style.color = value # pylint: disable=attribute-defined-outside-init
for n in self._notes:
n_style = n.style
n_style.color = value

n.style.color = value # pylint: disable=attribute-defined-outside-init
return
elif isinstance(pitchTarget, str):
pitchTarget = pitch.Pitch(pitchTarget)
Expand Down Expand Up @@ -4351,7 +4347,7 @@ def setNoteheadFill(self, nh, pitchTarget):
None
False
By default assigns to first pitch:
By default, assigns to first pitch:
>>> c3 = chord.Chord('C3 F4')
>>> c3.setNoteheadFill(False, None)
Expand Down
4 changes: 1 addition & 3 deletions music21/derivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ 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
orig = orig.derivation.origin # pylint: disable=no-member

@property
def method(self) -> str|None:
Expand Down
6 changes: 2 additions & 4 deletions music21/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -2097,10 +2097,8 @@ def testBasic(self):
b = note.Note()
b.quarterLength = qLen
b.name = pitchName
b_style = b.style
if t.TYPE_CHECKING:
assert isinstance(b_style, Style)
b_style.color = '#FF00FF'
# Pylint going crazy here
b.style.color = '#FF00FF' # pylint: disable=attribute-defined-outside-init
a.append(b)

if self.show:
Expand Down

0 comments on commit 5303e53

Please sign in to comment.