From 9bf8964edd0522b106c3b6567b43b306fc26ad6f Mon Sep 17 00:00:00 2001 From: "wbinventor@gmail.com" Date: Sun, 6 Dec 2015 17:45:27 -0500 Subject: [PATCH 1/2] Made DeprecationWarning for Cell.add_surface(...) only print once --- openmc/universe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/universe.py b/openmc/universe.py index 0e405e9f18..7e93981afa 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -240,7 +240,7 @@ class Cell(object): """ - warnings.simplefilter('always', DeprecationWarning) + warnings.simplefilter('once', DeprecationWarning) warnings.warn("Cell.add_surface(...) has been deprecated and may be " "removed in a future version. The region for a Cell " "should be defined using the region property directly.", From f822a221527986826a450885be0d089c3609bb79 Mon Sep 17 00:00:00 2001 From: "wbinventor@gmail.com" Date: Mon, 7 Dec 2015 08:53:36 -0500 Subject: [PATCH 2/2] Moved DeprecationWarning filter to top of universe module --- openmc/universe.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openmc/universe.py b/openmc/universe.py index 7e93981afa..98367c381b 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -15,6 +15,10 @@ from openmc.region import Region, Intersection, Complement if sys.version_info[0] >= 3: basestring = str + +# DeprecationWarning filter for the Cell.add_surface(...) method +warnings.simplefilter('always', DeprecationWarning) + # A static variable for auto-generated Cell IDs AUTO_CELL_ID = 10000 @@ -240,7 +244,6 @@ class Cell(object): """ - warnings.simplefilter('once', DeprecationWarning) warnings.warn("Cell.add_surface(...) has been deprecated and may be " "removed in a future version. The region for a Cell " "should be defined using the region property directly.",