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

Update pyright #931

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Update pyright #931

merged 2 commits into from
Jan 7, 2025

Conversation

ItsDrike
Copy link
Member

@ItsDrike ItsDrike commented Jan 6, 2025

This PR performs a long-awaited pyright update & fixes all of the issues that have accumulated over time.

The most notable change here is to the pinger.py and querier.py files, where the old classes were turned into data-classes, with a new base class, to better handle the weird sync -> async inheritance. This approach still requires type ignores in the method overrides, but it is a lot more sensible and clean.

Note that I've added a "disableBytesTypePromotions": false pyright setting, which was newly introduced (well, at least newly compared to the version we're updating from) and re-introduces the old technically type-incorrect approach that treats bytearray as a subtype of bytes. It would be possible to fix this instead, but it would affect a lot of the existing code. If desired, this can be done at later time.

Finally, on top of just the necessary changes to make pyright pass, I have made a few slight improvements to typing in some places, these are generally very minor.

Superseds & closes: #923

Copy link
Contributor

@kevinkjt2000 kevinkjt2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up. I forgot about pyright update PR that I self-assigned a while back.

mcstatus/address.py Outdated Show resolved Hide resolved
tests/test_address.py Show resolved Hide resolved
Copy link
Member

@PerchunPak PerchunPak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

mcstatus/pinger.py Show resolved Hide resolved
@ItsDrike ItsDrike merged commit 4defba5 into master Jan 7, 2025
11 checks passed
@ItsDrike ItsDrike deleted the update-pyright branch January 7, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants