Skip to content

Commit 667a6a8

Browse files
committed
replace deprecationwarning with futurewarning
1 parent 2b92a05 commit 667a6a8

19 files changed

+40
-40
lines changed

pymc/backends/tracetab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def trace_to_dataframe(trace, chains=None, varnames=None, include_transformed=Fa
4545
"The `trace_to_dataframe` function will soon be removed. "
4646
"Please use ArviZ to save traces. "
4747
"If you have good reasons for using the `trace_to_dataframe` function, file an issue and tell us about them. ",
48-
DeprecationWarning,
48+
FutureWarning,
4949
)
5050
var_shapes = trace._straces[0].var_shapes
5151

pymc/distributions/dist_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def log_i0(x):
510510
def incomplete_beta(a, b, value):
511511
warnings.warn(
512512
"incomplete_beta has been deprecated. Use aesara.tensor.betainc instead.",
513-
DeprecationWarning,
513+
FutureWarning,
514514
stacklevel=2,
515515
)
516516
return at.betainc(a, b, value)

pymc/distributions/distribution.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __new__(cls, name, bases, clsdict):
7878
def _random(*args, **kwargs):
7979
warnings.warn(
8080
"The old `Distribution.random` interface is deprecated.",
81-
DeprecationWarning,
81+
FutureWarning,
8282
stacklevel=2,
8383
)
8484
return clsdict["random"](*args, **kwargs)
@@ -204,7 +204,7 @@ def __new__(
204204
initval = kwargs.pop("testval")
205205
warnings.warn(
206206
"The `testval` argument is deprecated; use `initval`.",
207-
DeprecationWarning,
207+
FutureWarning,
208208
stacklevel=2,
209209
)
210210

@@ -296,7 +296,7 @@ def dist(
296296
"The `.dist(testval=...)` argument is deprecated and has no effect. "
297297
"Initial values for sampling/optimization can be specified with `initval` in a modelcontext. "
298298
"For using Aesara's test value features, you must assign the `.tag.test_value` yourself.",
299-
DeprecationWarning,
299+
FutureWarning,
300300
stacklevel=2,
301301
)
302302
if "initval" in kwargs:

pymc/distributions/multivariate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ def __init__(self, eta=None, n=None, p=None, transform="interval", *args, **kwar
14101410
"Parameters to LKJCorr have changed: shape parameter n -> eta "
14111411
"dimension parameter p -> n. Please update your code. "
14121412
"Automatically re-assigning parameters for backwards compatibility.",
1413-
DeprecationWarning,
1413+
FutureWarning,
14141414
)
14151415
self.n = p
14161416
self.eta = n
@@ -1435,7 +1435,7 @@ def __init__(self, eta=None, n=None, p=None, transform="interval", *args, **kwar
14351435
warnings.warn(
14361436
"Parameters in LKJCorr have been rename: shape parameter n -> eta "
14371437
"dimension parameter p -> n. Please double check your initialization.",
1438-
DeprecationWarning,
1438+
FutureWarning,
14391439
)
14401440
self.tri_index = np.zeros([n, n], dtype="int32")
14411441
self.tri_index[np.triu_indices(n, k=1)] = np.arange(shape)
@@ -1665,7 +1665,7 @@ def dist(
16651665
"The shape argument in MatrixNormal is deprecated and will be ignored."
16661666
"MatrixNormal automatically derives the shape"
16671667
"from row and column matrix dimensions.",
1668-
DeprecationWarning,
1668+
FutureWarning,
16691669
)
16701670

16711671
# Among-row matrices

pymc/gp/gp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def marginal_likelihood(self, name, X, Xu, y, noise=None, is_observed=True, **kw
725725
self.sigma = sigma
726726
warnings.warn(
727727
"The 'sigma' argument has been deprecated. Use 'noise' instead.",
728-
DeprecationWarning,
728+
FutureWarning,
729729
)
730730
else:
731731
self.sigma = noise

pymc/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def invlogit(x, eps=None):
205205
if eps is not None:
206206
warnings.warn(
207207
"pymc.math.invlogit no longer supports the ``eps`` argument and it will be ignored.",
208-
DeprecationWarning,
208+
FutureWarning,
209209
stacklevel=2,
210210
)
211211
return at.sigmoid(x)

pymc/model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def datalogpt(self):
838838
def vars(self):
839839
warnings.warn(
840840
"Model.vars has been deprecated. Use Model.value_vars instead.",
841-
DeprecationWarning,
841+
FutureWarning,
842842
)
843843
return self.value_vars
844844

@@ -942,7 +942,7 @@ def test_point(self) -> Dict[str, np.ndarray]:
942942
"""Deprecated alias for `Model.recompute_initial_point(seed=None)`."""
943943
warnings.warn(
944944
"`Model.test_point` has been deprecated. Use `Model.recompute_initial_point(seed=None)`.",
945-
DeprecationWarning,
945+
FutureWarning,
946946
)
947947
return self.recompute_initial_point()
948948

@@ -951,7 +951,7 @@ def initial_point(self) -> Dict[str, np.ndarray]:
951951
"""Deprecated alias for `Model.recompute_initial_point(seed=None)`."""
952952
warnings.warn(
953953
"`Model.initial_point` has been deprecated. Use `Model.recompute_initial_point(seed=None)`.",
954-
DeprecationWarning,
954+
FutureWarning,
955955
)
956956
return self.recompute_initial_point()
957957

@@ -1548,7 +1548,7 @@ def update_start_vals(self, a: Dict[str, np.ndarray], b: Dict[str, np.ndarray]):
15481548
conditional on the values of `b` and stored in `b`.
15491549
15501550
"""
1551-
raise DeprecationWarning(
1551+
raise FutureWarning(
15521552
"The `Model.update_start_vals` method was removed."
15531553
" To change initial values you may set the items of `Model.initial_values` directly."
15541554
)
@@ -1630,7 +1630,7 @@ def check_start_vals(self, start):
16301630
def check_test_point(self, *args, **kwargs):
16311631
warnings.warn(
16321632
"`Model.check_test_point` has been deprecated. Use `Model.point_logps` instead.",
1633-
DeprecationWarning,
1633+
FutureWarning,
16341634
)
16351635
return self.point_logps(*args, **kwargs)
16361636

pymc/plots/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def alias_deprecation(func, alias: str):
3636

3737
@functools.wraps(func)
3838
def wrapped(*args, **kwargs):
39-
raise DeprecationWarning(
39+
raise FutureWarning(
4040
f"The function `{alias}` from PyMC was an alias for `{original}` from ArviZ. "
4141
"It was removed in PyMC 4.0. "
4242
f"Switch to `pymc.{original}` or `arviz.{original}`."

pymc/plots/posteriorplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def plot_posterior_predictive_glm(
5959
warnings.warn(
6060
"The `plot_posterior_predictive_glm` function will migrate to Arviz in a future release. "
6161
"\nKeep up to date with `ArviZ <https://arviz-devs.github.io/arviz/>`_ for future updates.",
62-
DeprecationWarning,
62+
FutureWarning,
6363
)
6464

6565
if lm is None:

pymc/sampling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ def sample_posterior_predictive(
16501650
warnings.warn(
16511651
"In this version, RNG seeding is managed by the Model objects. "
16521652
"See the `rng_seeder` argument in Model's constructor.",
1653-
DeprecationWarning,
1653+
FutureWarning,
16541654
stacklevel=2,
16551655
)
16561656

@@ -1806,7 +1806,7 @@ def sample_posterior_predictive_w(
18061806
warnings.warn(
18071807
"In this version, RNG seeding is managed by the Model objects. "
18081808
"See the `rng_seeder` argument in Model's constructor.",
1809-
DeprecationWarning,
1809+
FutureWarning,
18101810
stacklevel=2,
18111811
)
18121812

@@ -1973,7 +1973,7 @@ def sample_prior_predictive(
19731973
warnings.warn(
19741974
"In this version, RNG seeding is managed by the Model objects. "
19751975
"See the `rng_seeder` argument in Model's constructor.",
1976-
DeprecationWarning,
1976+
FutureWarning,
19771977
stacklevel=2,
19781978
)
19791979

pymc/smc/sample_smc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def sample_smc(
151151
warnings.warn(
152152
f'The kernel string argument "{kernel}" in sample_smc has been deprecated. '
153153
f"It is no longer needed to distinguish between `abc` and `metropolis`",
154-
DeprecationWarning,
154+
FutureWarning,
155155
stacklevel=2,
156156
)
157157
kernel = IMH
@@ -160,23 +160,23 @@ def sample_smc(
160160
warnings.warn(
161161
"save_sim_data has been deprecated. Use pm.sample_posterior_predictive "
162162
"to obtain the same type of samples.",
163-
DeprecationWarning,
163+
FutureWarning,
164164
stacklevel=2,
165165
)
166166

167167
if kernel_kwargs.pop("save_log_pseudolikelihood", None) is not None:
168168
warnings.warn(
169169
"save_log_pseudolikelihood has been deprecated. This information is "
170170
"now saved as log_likelihood in models with Simulator distributions.",
171-
DeprecationWarning,
171+
FutureWarning,
172172
stacklevel=2,
173173
)
174174

175175
parallel = kernel_kwargs.pop("parallel", None)
176176
if parallel is not None:
177177
warnings.warn(
178178
"The argument parallel is deprecated, use the argument cores instead.",
179-
DeprecationWarning,
179+
FutureWarning,
180180
stacklevel=2,
181181
)
182182
if parallel is False:

pymc/tests/test_dist_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,6 @@ def ref_multigammaln(a, b):
264264

265265

266266
def test_incomplete_beta_deprecation():
267-
with pytest.warns(DeprecationWarning, match="incomplete_beta has been deprecated"):
267+
with pytest.warns(FutureWarning, match="incomplete_beta has been deprecated"):
268268
res = incomplete_beta(3, 5, 0.5).eval()
269269
assert np.isclose(res, at.betainc(3, 5, 0.5).eval())

pymc/tests/test_distributions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ def test_dirichlet_shape(self):
21222122
dir_rv = Dirichlet.dist(a)
21232123
assert dir_rv.shape.eval() == (2,)
21242124

2125-
with pytest.warns(DeprecationWarning), aesara.change_flags(compute_test_value="ignore"):
2125+
with pytest.warns(FutureWarning), aesara.change_flags(compute_test_value="ignore"):
21262126
dir_rv = Dirichlet.dist(at.vector())
21272127

21282128
def test_dirichlet_2D(self):

pymc/tests/test_distributions_random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ def test_errors(self):
16351635
logpt(matrixnormal, aesara.tensor.ones((3, 3, 3)))
16361636

16371637
with pm.Model():
1638-
with pytest.warns(DeprecationWarning):
1638+
with pytest.warns(FutureWarning):
16391639
matrixnormal = pm.MatrixNormal(
16401640
"matnormal",
16411641
mu=np.random.random((3, 3)),

pymc/tests/test_initial_point.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def transform_back(rv, transformed) -> np.ndarray:
3232

3333
class TestInitvalAssignment:
3434
def test_dist_warnings_and_errors(self):
35-
with pytest.warns(DeprecationWarning, match="argument is deprecated and has no effect"):
35+
with pytest.warns(FutureWarning, match="argument is deprecated and has no effect"):
3636
rv = pm.Exponential.dist(lam=1, testval=0.5)
3737
assert not hasattr(rv.tag, "test_value")
3838

@@ -42,7 +42,7 @@ def test_dist_warnings_and_errors(self):
4242

4343
def test_new_warnings(self):
4444
with pm.Model() as pmodel:
45-
with pytest.warns(DeprecationWarning, match="`testval` argument is deprecated"):
45+
with pytest.warns(FutureWarning, match="`testval` argument is deprecated"):
4646
rv = pm.Uniform("u", 0, 1, testval=0.75)
4747
initial_point = pmodel.recompute_initial_point(seed=0)
4848
assert initial_point["u_interval__"] == transform_fwd(rv, 0.75)

pymc/tests/test_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def test_expand_packed_triangular():
255255

256256
def test_invlogit_deprecation_warning():
257257
with pytest.warns(
258-
DeprecationWarning,
258+
FutureWarning,
259259
match="pymc.math.invlogit no longer supports the",
260260
):
261261
res = invlogit(np.array(-750.0), 1e-5).eval()

pymc/tests/test_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def test_model_vars():
425425
a = pm.Normal("a")
426426
pm.Normal("x", a)
427427

428-
with pytest.warns(DeprecationWarning):
428+
with pytest.warns(FutureWarning):
429429
old_vars = model.vars
430430

431431
assert old_vars == model.value_vars
@@ -495,14 +495,14 @@ def test_initial_point():
495495
a = pm.Uniform("a")
496496
x = pm.Normal("x", a)
497497

498-
with pytest.warns(DeprecationWarning):
498+
with pytest.warns(FutureWarning):
499499
initial_point = model.test_point
500500

501501
assert all(var.name in initial_point for var in model.value_vars)
502502

503503
b_initval = np.array(0.3, dtype=aesara.config.floatX)
504504

505-
with pytest.warns(DeprecationWarning), model:
505+
with pytest.warns(FutureWarning), model:
506506
b = pm.Uniform("b", testval=b_initval)
507507

508508
b_value_var = model.rvs_to_values[b]
@@ -526,7 +526,7 @@ def test_point_logps():
526526
a = pm.Uniform("a")
527527
pm.Normal("x", a)
528528

529-
with pytest.warns(DeprecationWarning):
529+
with pytest.warns(FutureWarning):
530530
logp_vals = model.check_test_point()
531531

532532
assert "x" in logp_vals.keys()

pymc/tests/test_smc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,33 +212,33 @@ def test_convergence_checks(self):
212212
def test_deprecated_parallel_arg(self):
213213
with self.fast_model:
214214
with pytest.warns(
215-
DeprecationWarning,
215+
FutureWarning,
216216
match="The argument parallel is deprecated",
217217
):
218218
pm.sample_smc(draws=10, chains=1, parallel=False)
219219

220220
def test_deprecated_abc_args(self):
221221
with self.fast_model:
222222
with pytest.warns(
223-
DeprecationWarning,
223+
FutureWarning,
224224
match='The kernel string argument "ABC" in sample_smc has been deprecated',
225225
):
226226
pm.sample_smc(draws=10, chains=1, kernel="ABC")
227227

228228
with pytest.warns(
229-
DeprecationWarning,
229+
FutureWarning,
230230
match='The kernel string argument "Metropolis" in sample_smc has been deprecated',
231231
):
232232
pm.sample_smc(draws=10, chains=1, kernel="Metropolis")
233233

234234
with pytest.warns(
235-
DeprecationWarning,
235+
FutureWarning,
236236
match="save_sim_data has been deprecated",
237237
):
238238
pm.sample_smc(draws=10, chains=1, save_sim_data=True)
239239

240240
with pytest.warns(
241-
DeprecationWarning,
241+
FutureWarning,
242242
match="save_log_pseudolikelihood has been deprecated",
243243
):
244244
pm.sample_smc(draws=10, chains=1, save_log_pseudolikelihood=True)

pymc/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def enhanced(*args, **kwargs):
236236
def dataset_to_point_dict(ds: xarray.Dataset) -> List[Dict[str, np.ndarray]]:
237237
warnings.warn(
238238
"dataset_to_point_dict was renamed to dataset_to_point_list and will be removed!",
239-
DeprecationWarning,
239+
FutureWarning,
240240
)
241241
return dataset_to_point_list(ds)
242242

0 commit comments

Comments
 (0)