Skip to content
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

Warn on unknown type of degree assortativity #533

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

doabell
Copy link
Contributor

@doabell doabell commented Apr 15, 2024

When calling xgi.degree_assortativity() with exact=True and an unknown kind, the code raises an UnboundLocalError that is hard to debug.
This PR fixes that behavior.

Unknown kind-s are handled in _choose_degrees, but after #526, when exact=True, _choose_degrees is no longer called.

I also changed the message from

Invalid choice function!

to

Invalid type of degree assortativity!

to better describe the error.

(I found this because I made a typo in kind=.)

Copy link
Collaborator

@nwlandry nwlandry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution, @doabell! Looks great!

@nwlandry nwlandry merged commit 6ef9084 into xgi-org:main Apr 15, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants