| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Diff from mypy_primer, showing the effect of this PR on open source code: streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/date_input_test.py: note: In member "test_range_session_state" of class "DateInputTest":
- lib/tests/streamlit/elements/date_input_test.py:174:16: error: Non-overlapping equality check (left operand type: "Union[date, Tuple[], Tuple[date], Tuple[date, date]]", right operand type: "List[datetime]") [comparison-overlap]
|
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Pyright has recently been trying to add some sophisticated understanding of how hashability works at runtime. Namely, if a class overrides __eq__ at runtime but doesn't override __hash__, the runtime views instances of the class as unhashable: if you override __eq__, you also have to explicitly override __hash__ as well if you want instances to be hashable. However, pyright is currently unable to implement its new feature, because of the fact that many classes in the stdlib override __hash__ at runtime, but don't currently include __hash__ in typeshed's stubs: microsoft/pyright#5513. Let's fix that.
I also added many missing __eq__ methods. As well as their relevance to hashability, these are also used as a heuristic for mypy's overlapping-equality check. Like with __hash__, therefore, it's important to include these in the stub even if the signature on a subclass is the same as on a superclass.
I found all these with the following stubtest patch:
DetailsCc. @TheTripleV