@return: The array with empty elements removed
"""
warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.strip_empty',), DeprecationWarning)
+ ('portage.dep.strip_empty',), DeprecationWarning, stacklevel=2)
return [x for x in myarr if x]
def paren_reduce(mystr):
@return: The reduced string in an array
"""
warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.paren_reduce',), DeprecationWarning)
+ ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2)
mysplit = mystr.split()
level = 0
stack = [[]]
and generate an equivalent structure that has no redundant lists."""
def __init__(self, src):
warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.paren_normalize',), DeprecationWarning)
+ ('portage.dep.paren_normalize',), DeprecationWarning, stacklevel=2)
list.__init__(self)
self._zap_parens(src, self)
if isinstance(depstr, list):
warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \
"Pass the original dep string instead.") % \
- ('portage.dep.use_reduce',), DeprecationWarning)
+ ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2)
depstr = paren_enclose(depstr)
def is_active(conditional):
# Fall back to legacy code for backward compatibility.
warnings.warn(_("%s is deprecated, use %s instead") % \
('portage.dep.get_operator()', 'portage.dep.Atom.operator'),
- DeprecationWarning)
+ DeprecationWarning, stacklevel=2)
operator = None
if mydep:
mydep = remove_slot(mydep)