summaryrefslogtreecommitdiff
path: root/networkx/utils
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2022-05-12 17:45:54 -0400
committerGitHub <noreply@github.com>2022-05-12 14:45:54 -0700
commitde1d00f20e0bc14f1cc911b3486e50225a8fa168 (patch)
tree9b4f7ba7c04c206769dbc98fc54edce3a2953268 /networkx/utils
parentf6c27bb24ee49c3bc31d91994502e4411a990145 (diff)
downloadnetworkx-de1d00f20e0bc14f1cc911b3486e50225a8fa168.tar.gz
Adjust the usage of nodes_or_number decorator (#5599)
* recorrect typo in decorators.py * Update tests to show troubles in current code * fix troubles with usage of nodes_or_number * fix typo * remove nodes_or_number where that makes sense * Reinclude nodes_or_numbers and add some tests for nonstandard usage * fix typowq * hopefully final tweaks (no behavior changes * Update test_classic.py Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
Diffstat (limited to 'networkx/utils')
-rw-r--r--networkx/utils/decorators.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/networkx/utils/decorators.py b/networkx/utils/decorators.py
index b8561b56..dd9c1c91 100644
--- a/networkx/utils/decorators.py
+++ b/networkx/utils/decorators.py
@@ -245,8 +245,7 @@ def nodes_or_number(which_args):
nodes = tuple(n)
else:
if n < 0:
- msg = f"Negative number of nodes not valid: {n}"
- raise nx.NetworkXError(msg)
+ raise nx.NetworkXError(f"Negative number of nodes not valid: {n}")
return (n, nodes)
try: