Return a method with a deprecation warning.
508374
def _new_name(method, old_name):
    """"""
    # Looks suspiciously like a decorator, but isn't!

    @wraps(method)
    def _method(*args, **kwargs):
        warnings.warn(
            "method '{}' has been deprecated, please rename to '{}'".format(
                old_name, method.__name__
            ),
            DeprecationWarning,
        )
        return method(*args, **kwargs)

    deprecated_msg = """
        Note:
            .. deprecated:: 2.2.0
                Please use `~{}`
""".format(
        method.__name__
    )
    if getattr(_method, "__doc__"):
        _method.__doc__ += deprecated_msg

    return _method
1352389
def GetMethod(self, name, descriptor):
        
        warnings.warn("deprecated, use get_method instead. This function might be removed in a later release!", DeprecationWarning)
        return self.get_method(name, descriptor)
720979
def _raise_deprecation_note(deprecated, replacement, soft=False):
    
    error_msg = ("`{deprecated}` is deprecated. Please use `{replacement}`. "
                 "`{deprecated}` will be removed in future versions of "
                 "Ray.".format(deprecated=deprecated, replacement=replacement))
    if soft:
        logger.warning(error_msg)
    else:
        raise DeprecationWarning(error_msg)
221170
def stop(self, *args, **kwargs):
        
        warnings.warn(
            "The 'stop()' method is deprecated, please use 'remove()' instead", DeprecationWarning
        )
        return self.remove(*args, **kwargs)
1329084
def __ordering_deprecated(self):
        """"""
        msg = _format("Ordering comparisons involving {0} objects are "
                      "deprecated.", self.__class__.__name__)
        if DEBUG_WARNING_ORIGIN:
            msg += "\nTraceback:\n" + ''.join(traceback.format_stack())
        warnings.warn(msg, DeprecationWarning, stacklevel=3)
1061240
private static function deprecationWarning() {
        $caller = next(debug_backtrace());
        $msg = 'Deprecated Db-function in function ' . $caller['function'] . ' called from ' . $caller['file'];
        $msg .= ' on line ' . $caller['line'];
        trigger_error($msg, E_USER_NOTICE);
    }
1053829
def _wrap(func, msg):
    """"""

    @functools.wraps(func)
    def new_func(*args, **kwargs):
        warnings.simplefilter('always', DeprecationWarning)     # turn off filter
        warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
        warnings.simplefilter('default', DeprecationWarning)    # reset filter
        return func(*args, **kwargs)
    return new_func
609095
def warn(self, msg, *args, **kwargs):
    """"""
    if six.PY3:
      warnings.warn("The 'warn' method is deprecated, use 'warning' instead",
                    DeprecationWarning, 2)
    self.log(logging.WARN, msg, *args, **kwargs)
1372124
def deprecated_for(replace_message):
    
    def decorator(to_wrap):
        @functools.wraps(to_wrap)
        def wrapper(*args, **kwargs):
            warnings.warn(
                "%s is deprecated in favor of %s" % (to_wrap.__name__, replace_message),
                category=DeprecationWarning,
                stacklevel=2)
            return to_wrap(*args, **kwargs)
        return wrapper
    return decorator
1326541
def _maybe_process_deprecations(r, how=None, fill_method=None, limit=None):
    

    if how is not None:

        # .resample(..., how='sum')
        if isinstance(how, str):
            method = "{0}()".format(how)

            # .resample(..., how=lambda x: ....)
        else:
            method = ".apply(<func>)"

        # if we have both a how and fill_method, then show
        # the following warning
        if fill_method is None:
            warnings.warn("how in .resample() is deprecated\n"
                          "the new syntax is "
                          ".resample(...).{method}".format(
                              method=method),
                          FutureWarning, stacklevel=3)
        r = r.aggregate(how)

    if fill_method is not None:

        # show the prior function call
        method = '.' + method if how is not None else ''

        args = "limit={0}".format(limit) if limit is not None else ""
        warnings.warn("fill_method is deprecated to .resample()\n"
                      "the new syntax is .resample(...){method}"
                      ".{fill_method}({args})".format(
                          method=method,
                          fill_method=fill_method,
                          args=args),
                      FutureWarning, stacklevel=3)

        if how is not None:
            r = getattr(r, fill_method)(limit=limit)
        else:
            r = r.aggregate(fill_method, limit=limit)

    return r
601465
def deprecated(context):
    """"""
    if 'fetchJsonPath' in context:
        context.assert_key_has_value(key='fetchJsonPath', caller=__name__)

        context['fetchJson'] = {'path': context['fetchJsonPath']}

        if 'fetchJsonKey' in context:
            context['fetchJson']['key'] = context.get('fetchJsonKey', None)

        logger.warning("fetchJsonPath and fetchJsonKey "
                       "are deprecated. They will stop working upon the next "
                       "major release. Use the new context key fetchJson "
                       "instead. It's a lot better, promise! For the moment "
                       "pypyr is creating the new fetchJson key for you "
                       "under the hood.")
807627
def deprecated(message=DEPRECATION_MESSAGE, logger=None):
    
    if logger is None:
        logger = default_logger
    def _deprecated(f):
        def _wrapper(*args, **kwargs):
            f_name = f.__name__
            logger.warning(message.format(name=f_name))
            result = f(*args, **kwargs)
            return result
        return _wrapper
    return _deprecated
763218
def deprecated(obj, message = nil)
      obj_class = obj.is_a?(Class) ? "#{obj}." : "#{obj.class}#"
      full_message = "DEPRECATION WARNING: #{obj_class}#{caller_info[2]} " +
        "will be removed in a future version of Sass.#{("\n" + message) if message}"
      Sass::Util.sass_warn full_message
    end
1302927
def deprecated(message=None):
    

    def decorated_method_to_deprecate(func):
        if inspect.isclass(func):
            # Handle a deprecated class differently from a deprecated method
            msg = "Class {}() is DEPRECATED! *** ".format(func.__name__)
            if message:
                msg += "<> %s <>" % message
            warnings.simplefilter('always', DeprecationWarning)  # See Warnings
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
            warnings.simplefilter('default', DeprecationWarning)  # Set Default
            return func

        @wraps(func)
        def new_func(*args, **kwargs):
            msg = "Method {}() is DEPRECATED! *** ".format(func.__name__)
            if message:
                msg += "<> %s <>" % message
            warnings.simplefilter('always', DeprecationWarning)  # See Warnings
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
            warnings.simplefilter('default', DeprecationWarning)  # Set Default
            return func(*args, **kwargs)
        return new_func
    return decorated_method_to_deprecate
901283
def deprecation(self, message, *args, **kws):
    """"""
    self._log(DEPRECATION, message, args, **kws)
602147
def deprecated(message=None):
    """"""
    def deco(func):
        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            warnings.warn(
                message or 'Call to deprecated function {}'.format(func.__name__),
                category=PubChemPyDeprecationWarning,
                stacklevel=2
            )
            return func(*args, **kwargs)
        return wrapped
    return deco
957137
def dedent(func):
    
    if isinstance(func, types.MethodType) and not six.PY3:
        func = func.im_func
    func.__doc__ = func.__doc__ and dedents(func.__doc__)
    return func