-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix(typing): update to latest version of Pyright and fix errors #1105
Changes from all commits
4821301
4e48d9f
9acd170
c695917
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,5 @@ reportMissingModuleSource = false | |
reportPrivateUsage = false | ||
reportUnnecessaryIsInstance = false | ||
reportUnnecessaryComparison = false | ||
disableBytesTypePromotions = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs (I had to look up what this did!) say the default is false. Why do we need to add it in here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's odd. When I comment out that line and leave it as the default, Pyright prints a bunch of this message:
Oh wait, it looks like the default is actually true in "strict" mode: https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-rule-defaults Makes me wonder if we're causing ourselves a bunch of extra pain by being in strict mode... |
||
stubPath = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the cleanest fix here is to remove the type from
RelationEvent
and add it toRelationChangedEvent
. The downside would be that I'm not sure if we can still then have the attribute have documentation in the base class, although it would be in all the subclasses.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I had a play with this, and I don't like the fact that then the docs for
RelationEvent
wouldn't have "unit" defined at all, which seems very weird. Or were you suggesting something else?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that was what I was suggesting, and I indeed wondered if that meant it was not possible to have it in the
RelationEvent
doc (unless there's some Sphinx trick for this I don't know). I agree that's not great.In balance, I'm fine keeping it how you have it with the ignores. The goal was to have the types correct in the various subclasses so people didn't need a bunch of
assert unit is not None
and that all still works, so there doesn't seem to be much value in trying too hard to get rids of the ignores.