-
Notifications
You must be signed in to change notification settings - Fork 167
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
Numeric string node ID silently cast from str
to int
in in add_nodes
but not add_edges
, raises AssertionError
#276
Comments
norweeg
changed the title
Numeric string node ID silently cast to in in
Numeric string node ID silently cast from Apr 3, 2024
add_nodes
but not add_edges
, rasiesstr
to int
in in add_nodes
but not add_edges
, rasies AssertionError
norweeg
added a commit
to norweeg/pyvis
that referenced
this issue
Apr 3, 2024
* removes unnecessary and silent type conversion of numeric node IDs * add_edges using node IDs' original type no longer raises exception * refactored coincidental inappropriate usage of assert for type-checking/control logic in add_node and add_nodes to raise appropriate exceptions instead
norweeg
changed the title
Numeric string node ID silently cast from
Numeric string node ID silently cast from Apr 3, 2024
str
to int
in in add_nodes
but not add_edges
, rasies AssertionError
str
to int
in in add_nodes
but not add_edges
, raises AssertionError
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just my $0.02, pyvis should not be type-casting node IDs at all and especially not silently and inconsistently. I spent hours beating my head into the keyboard trying to figure out what was wrong with my code and why I was getting an exception for a missing node when adding edges to my network. I thought that I was somehow filtering my dataset in such a way that I was losing a node that would be in an edge. Additionally,
AssertionError
is inappropriate to use here because it is disabled if the Python interpreter is running in any optimization mode. RaisingTypeError
would be more appropriate as it will not be disabled if the Python interpreter is running in an optimization mode.The text was updated successfully, but these errors were encountered: