Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent inference results affecting redefined-variable-type messages #9309

Closed
jacobtylerwalls opened this issue Dec 17, 2023 · 6 comments
Labels
Astroid Related to astroid Bug 🪲 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@jacobtylerwalls
Copy link
Member

next on the list of offending messages(*) causing primer noise:

(*) likely nothing wrong with the message, just something wrong with inconsistent inference results

compare:

pylint music21 --enable=redefined-variable-type --disable=all --enable-all-extensions

to:

pylint music21 --enable=redefined-variable-type,no-member --disable=all --enable-all-extensions

Produces this diff:

diff --git a/a.out b/a.out
index b6688d824..623a87c89 100644
--- a/a.out
+++ b/a.out
@@ -154,8 +154,6 @@ music21/mei/test_base.py:5039: [R0204(redefined-variable-type), Test.testCoreInt
 music21/mei/base.py:1372: [R0204(redefined-variable-type), metaSetDate] Redefinition of meta.dateCreated type from music21.metadata.primitives.Date to music21.metadata.primitives.DateBetween
 music21/mei/base.py:2192: [R0204(redefined-variable-type), noteFromElement] Redefinition of theNote type from music21.pitch.Pitch to music21.note.Note
 music21/mei/base.py:2240: [R0204(redefined-variable-type), noteFromElement] Redefinition of theNote.duration type from music21.duration.Duration to music21.duration.GraceDuration
-music21/mei/base.py:2310: [R0204(redefined-variable-type), restFromElement] Redefinition of theRest type from music21.note.Rest to list
-music21/mei/base.py:2358: [R0204(redefined-variable-type), spaceFromElement] Redefinition of theSpace type from music21.note.Rest to list
 music21/mei/base.py:2450: [R0204(redefined-variable-type), chordFromElement] Redefinition of theChord type from list to music21.chord.Chord
 music21/mei/base.py:2483: [R0204(redefined-variable-type), chordFromElement] Redefinition of theChord.duration type from music21.duration.Duration to music21.duration.GraceDuration
 ************* Module music21.lily.translate
@@ -167,6 +165,7 @@ music21/search/segment.py:154: [R0204(redefined-variable-type), _indexSingleMult
 ************* Module music21.common.numberTools
 music21/common/numberTools.py:411: [R0204(redefined-variable-type), mixedNumeral] Redefinition of quotient type from float to int
 ************* Module music21.abcFormat.translate
+music21/abcFormat/translate.py:381: [R0204(redefined-variable-type), parseABCNote] Redefinition of n type from music21.note.Note to music21.note.GeneralNote
 music21/abcFormat/translate.py:554: [R0204(redefined-variable-type), abcToStreamOpus] Redefinition of opus type from music21.stream.base.Opus to music21.stream.base.Score
 ************* Module music21.abcFormat
 music21/abcFormat/__init__.py:967: [R0204(redefined-variable-type), ABCBar.getBarObject] Redefinition of m21bar type from music21.bar.Repeat to music21.bar.Barline
@@ -188,7 +187,7 @@ music21/humdrum/spineParser.py:667: [R0204(redefined-variable-type), HumdrumData
 music21/humdrum/spineParser.py:1276: [R0204(redefined-variable-type), HumdrumSpine.parse] Redefinition of thisObject type from music21.humdrum.spineParser.MiscTandem to music21.stream.base.Measure
 music21/humdrum/spineParser.py:1460: [R0204(redefined-variable-type), DynamSpine.parse] Redefinition of thisObject type from music21.humdrum.spineParser.MiscTandem to music21.humdrum.spineParser.SpineComment
 music21/humdrum/spineParser.py:1513: [R0204(redefined-variable-type), HarmSpine.parse] Redefinition of thisObject type from music21.humdrum.spineParser.MiscTandem to music21.stream.base.Measure
-music21/humdrum/spineParser.py:2386: [R0204(redefined-variable-type), hdStringToNote] Redefinition of thisObject type from music21.note.Note to music21.note.GeneralNote
+music21/humdrum/spineParser.py:2383: [R0204(redefined-variable-type), hdStringToNote] Redefinition of thisObject type from music21.note.Note to music21.note.Rest
 ************* Module music21.meter.tools
 music21/meter/tools.py:410: [R0204(redefined-variable-type), divisionOptionsAdditiveMultiples] Redefinition of seq type from list to tuple
 ************* Module music21.meter.core
@jacobtylerwalls jacobtylerwalls self-assigned this Dec 17, 2023
@jacobtylerwalls jacobtylerwalls added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Dec 17, 2023
@jacobtylerwalls jacobtylerwalls removed their assignment Sep 18, 2024
@jacobtylerwalls
Copy link
Member Author

Fixed in #9887. Thanks @akamat10!!

@jacobtylerwalls jacobtylerwalls added this to the 3.2.7 milestone Sep 29, 2024
@akamat10
Copy link
Contributor

No problem! Correction: Fixed in pylint-dev/astroid#2572

@jacobtylerwalls
Copy link
Member Author

Interesting. I reverted #9887 and it reproduced the issue for me.

@akamat10
Copy link
Contributor

Interesting! It also makes sense since it was causing non-deterministic behavior. pylint-dev/astroid#2572 addressed issue with errors caused by cache not clearing from previous repos in the primer run.

@jacobtylerwalls
Copy link
Member Author

Right, I was alerted to this by the primer, but the reproducer above doesn't involve the primer or cache clearing.

@jacobtylerwalls jacobtylerwalls changed the title [primer noise] redefined-variable-type Inconsistent inference results affecting redefined-variable-type messages Sep 29, 2024
@akamat10
Copy link
Contributor

Ah! I was confused. Glad this can be also closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Bug 🪲 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants