From 81ed29cc3825cf7fae1bcecfa4f11b8dd860b3de Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sat, 3 Oct 2015 10:01:00 +0700 Subject: [PATCH] Add deprecation warning for Cell.add_surface() --- openmc/universe.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openmc/universe.py b/openmc/universe.py index c03e1305c6..d7988c8d90 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -3,6 +3,7 @@ from collections import OrderedDict, Iterable from numbers import Real, Integral from xml.etree import ElementTree as ET import sys +import warnings import numpy as np @@ -181,6 +182,12 @@ class Cell(object): """ + warnings.simplefilter('always', 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.", + DeprecationWarning) + if not isinstance(surface, openmc.Surface): msg = 'Unable to add Surface "{0}" to Cell ID="{1}" since it is ' \ 'not a Surface object'.format(surface, self._id)