diff options
author | Jarrod Millman <jarrod.millman@gmail.com> | 2021-05-20 11:16:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 11:16:09 -0700 |
commit | b71df0db8729e2f24965bb15ced0d580390de99e (patch) | |
tree | 971b139b30115ae8fda88b56927590ed27bd88f0 /networkx | |
parent | debfe114314f0829dbf3d0d9b489172c8c60bed0 (diff) | |
download | networkx-b71df0db8729e2f24965bb15ced0d580390de99e.tar.gz |
Deprecate preserve_random_state (#4826)
Diffstat (limited to 'networkx')
-rw-r--r-- | networkx/conftest.py | 3 | ||||
-rw-r--r-- | networkx/utils/decorators.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/networkx/conftest.py b/networkx/conftest.py index f22d6b14..8b2bad9c 100644 --- a/networkx/conftest.py +++ b/networkx/conftest.py @@ -133,6 +133,9 @@ def set_warnings(): warnings.filterwarnings( "ignore", category=DeprecationWarning, message="\nThe `attrs` keyword" ) + warnings.filterwarnings( + "ignore", category=DeprecationWarning, message="preserve_random_state" + ) @pytest.fixture(autouse=True) diff --git a/networkx/utils/decorators.py b/networkx/utils/decorators.py index c1b61f33..8ab0a4d2 100644 --- a/networkx/utils/decorators.py +++ b/networkx/utils/decorators.py @@ -2,6 +2,7 @@ from collections import defaultdict from os.path import splitext from contextlib import contextmanager from pathlib import Path +import warnings import networkx as nx from decorator import decorator @@ -331,6 +332,9 @@ def preserve_random_state(func): ----- If numpy.random is not importable, the state is not saved or restored. """ + msg = "preserve_random_state is deprecated and will be removed in 3.0." + warnings.warn(msg, DeprecationWarning) + try: import numpy as np |