Skip to content

Update _raise_on_directed to work with create_using pos arg - #7695

Merged
MridulS merged 1 commit into
networkx:mainfrom
eriknw:raise_on_directed_with_arg
Oct 25, 2024
Merged

MridulS merged 1 commit into
networkx:mainfrom
eriknw:raise_on_directed_with_arg

Conversation

@eriknw

@eriknw eriknw commented Oct 25, 2024

Copy link
Copy Markdown
Contributor

This decorator is only used by the "small" graph generators. We could update this to use argmap, but probably not worth the effort since all functions have create_using as the first positional argument.

If we were creating these functions today, we might make create_using keyword-only, but that would be a breaking change.

I came across this when running networkx tests with nx-cugraph with networkx 3.4.2. The test added in #7685 was failing for nx-cugraph, because cubical_graph isn't supposed to work with directed graphs and we were raising.

This decorator is only used by the "small" graph generators.
We could update this to use `argmap`, but probably not worth the effort
since all functions have create_using as the first positional argument.

If we were creating these functions today, we might make create_using
keyword-only, but that would be a breaking change.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks @eriknw !

In the longer term we should get rid of the module-specific decorator in favor of the "create-using-validation" we've begun working towards in #5672

@MridulS MridulS added this to the 3.5 milestone Oct 25, 2024
@MridulS
MridulS merged commit 478183c into networkx:main Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants