-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use of numbers.* encounters a bug in mypy #9
Comments
I don't know much about your use case (and don't even know if it's appropriate for a stubs library like this one), but you might want to see if |
I think numerary would be overkill here. The types pika supports are clearly documented as e.g. edit: I see that internally pika does check against |
I'd be happy with that compromise! |
This commit fixes the issue pointed out in: hahow/pika-stubs#9 Namely `int` and `float` not (statically) evaluating as subclasses of their abstract types in `numbers`: python/mypy#3186 These abstract types have been replaced with their concrete equivalent. Note that this does not match the code in pika, which *does* compare against e.g. `numbers.Integral` at runtime. But the documented API only mentions concret types (i.e. `int` and `float`) so this is considered a reasonable compromise. addresses hahow/pika-stubs/issues/9
FYI, I'm resolving this and the other outstanding issues in my fork, since the maintainer has been unresponsive and their github account no longer exists. (I assume they no longer work for hahow). Fixed up all the inconsistencies and incorrect type annotations I could find. Running mypy on our private codebase with the updated stubs seems to indicate they're reasonably correct. Not sure yet what I'll do about releasing, since the |
I'll try it! ( https://pypi.org/project/types-pika/ ) |
The issue with numbers is fixed. I opened another issue: baodrate/types-pika#11 |
python/mypy#3186
Could
Union[int, float]
be used instead ofnumbers.Real
?The text was updated successfully, but these errors were encountered: