-
Notifications
You must be signed in to change notification settings - Fork 594
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
Type-hinting of filter
regression
#4269
Comments
hmm, both pyright and mypy report this as
mypy |
Hi @tybug ; I'm using setup ~/work/hypothesis via 🐍 v3.11.10 (python-3.11)
❯ which python
/Users/derekwan/work/hypothesis/.direnv/python-3.11/bin/python
~/work/hypothesis via 🐍 v3.11.10 (python-3.11)
❯ uv pip install hypothesis
Using Python 3.11.10 environment at: .direnv/python-3.11
Resolved 3 packages in 62ms
Installed 3 packages in 7ms
+ attrs==25.1.0
+ hypothesis==6.125.3
+ sortedcontainers==2.4.0
~/work/hypothesis via 🐍 v3.11.10 (python-3.11)
❯ which pyright
/opt/homebrew/bin/pyright
~/work/hypothesis via 🐍 v3.11.10 (python-3.11)
❯ pyright --version
pyright 1.1.393
~/work/hypothesis via 🐍 v3.11.10 (python-3.11)
❯ cat foo.py
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: foo.py
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ from hypothesis.strategies import booleans
2 │
3 │ reveal_type(booleans().filter(lambda n: n))
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── In normal mode:
Now in strict mode:
|
Thanks. I still can't reproduce: ~/Desktop/temp λ pyright --verbose '/Users/tybug/Desktop/temp/main.py'
Loading pyproject.toml file at /Users/tybug/Desktop/temp/pyproject.toml
Auto-excluding **/node_modules
Auto-excluding **/__pycache__
Auto-excluding **/.*
Assuming Python version 3.13.1.final.0
Execution environment: python
Extra paths:
(none)
Python version: 3.13.1.final.0
Python platform: Darwin
Search paths:
/opt/homebrew/lib/python3.11/site-packages/pyright/dist/dist/typeshed-fallback/stdlib
/Users/tybug/Desktop/temp
/Users/tybug/Desktop/temp/typings
/opt/homebrew/lib/python3.11/site-packages/pyright/dist/dist/typeshed-fallback/stubs/...
/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13
/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dynload
/opt/homebrew/lib/python3.13/site-packages
/opt/homebrew/Cellar/openvino/2024.6.0_1/libexec/lib/python3.13/site-packages
Found 1 source file
pyright 1.1.394
/Users/tybug/Desktop/temp/main.py
/Users/tybug/Desktop/temp/main.py:3:13 - information: Type of "booleans().filter(lambda n: n)" is "SearchStrategy[bool]"
0 errors, 0 warnings, 1 information
Completed in 0.31sec
~/Desktop/temp λ cat pyproject.toml
[tool.pyright]
typeCheckingMode = "strict"
~/Desktop/temp λ cat main.py
from hypothesis.strategies import booleans
reveal_type(booleans().filter(lambda n: n))
~/Desktop/temp λ python3
Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import hypothesis
>>> hypothesis.__version__
'6.125.3'
>>> ^D
~/Desktop/temp λ I also tried |
Hi all,
I have noticed a regression in the type-hinting of
filter
. More precisely, on 6.125.0:But on 6.125.1:
I suppose it must be in hypothesis-python-6.125.0...hypothesis-python-6.125.1 ?
The text was updated successfully, but these errors were encountered: