-
Notifications
You must be signed in to change notification settings - Fork 151
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
Specify Any
for PyGraph
and PyDiGraph
type annotations for pyright compatibility
#1246
base: main
Are you sure you want to change the base?
Specify Any
for PyGraph
and PyDiGraph
type annotations for pyright compatibility
#1246
Conversation
Pull Request Test Coverage Report for Build 11604509124Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question inline about using the generic type var instead Any
. But if that doesn't work I'm fine with this.
@@ -552,39 +554,39 @@ def directed_gnm_random_graph( | |||
num_edges: int, | |||
/, | |||
seed: int | None = ..., | |||
) -> PyDiGraph: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So based on the earlier comment is this actually [Any, Any]
. The weights from the generator functions are a fixed type depending on the arguments. Like for this gnm random graph function the nodes and edges are always None
.
Closes #1242
This is a pretty annoying PR but it avoids
pyright
from infering the types asUnknown
. Although we will only keepmypy
in the CI,pyright
is the base forpylance
which ships with VSCode. And we got VSCode issues in the past (#832), so I think it's worth supporting.