Skip to content

Incorrect type hint for DS18X20 class constructor #33

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

Closed
Myoldmopar opened this issue Apr 6, 2025 · 1 comment · Fixed by #34
Closed

Incorrect type hint for DS18X20 class constructor #33

Myoldmopar opened this issue Apr 6, 2025 · 1 comment · Fixed by #34

Comments

@Myoldmopar
Copy link
Contributor

Super minor, but it shows up in my IDE when I use the stubs package. The third argument to the DS18X20 class constructor is named address and type hinted as an int. But right in the first line, it checks address.family_code. I think the type hint should be OneWireAddress. I could offer a minimal PR for this change if you agree, not sure if there's any CI testing for type hinting (I guess not because that probably would have been caught?).

def __init__(self, bus: OneWireBus, address: int) -> None:
if address.family_code in (0x10, 0x28):
self._address = address

Anyway, thanks for this library and all your contributions to this ecosystem.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Apr 6, 2025

I believe you are correct, PR would be appreciated. Thank you!

We do not currently have type annotation checking in the CI.

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 a pull request may close this issue.

2 participants