summaryrefslogtreecommitdiff
path: root/networkx/utils
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2022-03-27 13:52:22 -0700
committerGitHub <noreply@github.com>2022-03-28 00:52:22 +0400
commit6801db694e6a3603ab943079c3399baa0c5ff686 (patch)
tree759b60206f22151a2d80a3abe423ac5b42c0fe21 /networkx/utils
parent72b1dca7d7d4d8bab519d55541d981d2f4f61365 (diff)
downloadnetworkx-6801db694e6a3603ab943079c3399baa0c5ff686.tar.gz
Deprecate `to_tuple` (#5430)
* Add _to_tuple private fn to node_link.py. * Deprecate utils.misc.to_tuple. * Add deprecation note. * Add release note.
Diffstat (limited to 'networkx/utils')
-rw-r--r--networkx/utils/misc.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/networkx/utils/misc.py b/networkx/utils/misc.py
index d98e6c35..e2392a0a 100644
--- a/networkx/utils/misc.py
+++ b/networkx/utils/misc.py
@@ -437,6 +437,10 @@ def groups(many_to_one):
def to_tuple(x):
"""Converts lists to tuples.
+ .. deprecated:: 2.8
+
+ to_tuple is deprecated and will be removed in NetworkX 3.0.
+
Examples
--------
>>> from networkx.utils import to_tuple
@@ -444,6 +448,12 @@ def to_tuple(x):
>>> to_tuple(a_list)
(1, 2, (1, 4))
"""
+ warnings.warn(
+ "to_tuple is deprecated and will be removed in NetworkX 3.0.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+
if not isinstance(x, (tuple, list)):
return x
return tuple(map(to_tuple, x))