def deprecated(warning=None):
  warning = warning or ''
  # This closure is what is returned from the deprecated function.
  def mark_deprecated(f):
    # The deprecated_function wraps the actual call to f.
    def deprecated_function(*args, **kwargs):
      warnings.warn(warning, DeprecationWarning, stacklevel=2)
      return f(*args, **kwargs)
    # Preserve the original name to avoid masking all decorated functions as
    # 'deprecated_function'
    try:
      deprecated_function.func_name = f.func_name
    except TypeError:
      # Setting the func_name is not allowed in Python2.3.
      pass
    return deprecated_function
  return mark_deprecated
Switch Cases
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/atom/__init__.py/deprecated--crossover with--dataset/ETHPy150Open tmr232/Sark/sark/code/switch.py/Switch.cases