Specify `Any` for `PyGraph` and `PyDiGraph` type annotations for pyright compatibility
Closes #1242
This is a pretty annoying PR but it avoids pyright from infering the types as Unknown. Although we will only keep mypy in the CI, pyright is the base for pylance which ships with VSCode. And we got VSCode issues in the past (#832), so I think it's worth supporting.
Pull Request Test Coverage Report for Build 12661348679
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage remained the same at 95.825%
| Totals | |
|---|---|
| Change from base Build 12653809774: | 0.0% |
| Covered Lines: | 18360 |
| Relevant Lines: | 19160 |
💛 - Coveralls
Now that we are doing a major release, I might use the suggestion from https://github.com/Qiskit/rustworkx/issues/1242#issuecomment-2231841772 to fix it in a more proper way using TypeVar
I tested with pyright, I don't want to add it to the Nox file as of now because of the Node.js aspect but it worked. Now we get:
0 errors, 0 warnings, 0 informations
Instead of the original error. If I use the wheel from PyPI it fails with the same error message from the Issue so I am confident the fix work. It also has a much smaller diff than the original solution so that is a win