false-positive(reportArgumentType): `"__hash__" is not present`
type checking / lintingneeds investigation
### Description
This program works as expected at runtime:
```console
❯ pixi exec -w numpy ipython
```
```python
from collections.abc import Hashable
import numpy as np
def f(g: Hashable) -> int:
return hash(g)
assert hasattr(np, "__hash__")
assert isinstance(hash(np), int)
assert f(np) == hash(np)
```
but basedpyright reports:
```
Argument of type "Module("numpy")" cannot be assigned to parameter "g" of type "Hashable" in function "f"
"__hash__" is not present (basedpyright reportArgumentType)
```
on the `f(np)` call.
---
I couldn't find a duplicate issue here or upstream. I haven't checked whether this problem exists in `pyright` too.
1 条评论