From 5303e539423e9818d56f3484801c517a6901b4d9 Mon Sep 17 00:00:00 2001 From: Michael Scott Asato Cuthbert Date: Tue, 17 Sep 2024 00:27:33 -1000 Subject: [PATCH] done playing nice w/ pylint. --- music21/chord/__init__.py | 14 +++++--------- music21/derivation.py | 4 +--- music21/note.py | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/music21/chord/__init__.py b/music21/chord/__init__.py index 4ae6d64a9..37f7ad410 100644 --- a/music21/chord/__init__.py +++ b/music21/chord/__init__.py @@ -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 @@ -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) @@ -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) diff --git a/music21/derivation.py b/music21/derivation.py index b9d19ac9b..0ca9ba4d3 100644 --- a/music21/derivation.py +++ b/music21/derivation.py @@ -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: diff --git a/music21/note.py b/music21/note.py index 082eb2399..52b2c22b9 100644 --- a/music21/note.py +++ b/music21/note.py @@ -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: