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
More informative GraphML exceptions #5058
More informative GraphML exceptions #5058
Conversation
Nice approach! -- I like it. Would it help backward compatibility if we could tell people (who have adapted the public I'm not actually sure we want to advertise this way of doing things, but have I understood the backward compatibility issue? Are there other things people may have used the public I'm definitely good for leaving it as you have proposed. I'm not sure a deprecation is even needed. Maybe a release note and a discussion of the extent of backward incompatibility here in this PR will be sufficient....??.. |
Thanks for the feedback @dschult , you're right that there's actually a very straightforward way to do this without breaking compatibility by simply changing the naming scheme around a little bit. The way I've done it in 8a739f9 will break anyone who is modifying/extending/inheriting from GraphML class downstream if they're expecting I've changed the naming around a bit in 42968da to avoid this problem. Adding a method that starts with |
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.
Clever! :}
I approve this PR.
* Add tests that fail on uninformative exception. * Raise informative exception when non-supported type used. * Add importorskip to new tests. * Change naming scheme for backward compatibility.
* Add tests that fail on uninformative exception. * Raise informative exception when non-supported type used. * Add importorskip to new tests. * Change naming scheme for backward compatibility.
* Add tests that fail on uninformative exception. * Raise informative exception when non-supported type used. * Add importorskip to new tests. * Change naming scheme for backward compatibility.
Closes #5024
Modifies how the dict that defines supported GraphML types is accessed so that an informative exception is raised if a user tries to save an attribute of an unsupported type.
This solution is technically backward incompatible, as it changes the (currently public)
xml_types
attr of theGraphML
class from a dict to a method. The reason for doing it this way is that it provides an easy way to ensure that the exception is raised for all of node, edge, and graph attrs. If this is a problem though, we can always go with the clunkier (but backward compatible) approach which would add try-excepts each time the dict is accessed. LMK what you think!