PHP 8.5.2
Preview: deprecation.py Size: 1.70 KB
//lib/python3/dist-packages/debian/deprecation.py

# -*- coding: utf-8 -*- vim: fileencoding=utf-8 :

""" Utility module to deprecate features """

# Copyright © Ben Finney <ben+debian@benfinney.id.au>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


import warnings

try:
    # pylint: disable=unused-import
    from typing import (
        Any,
        Callable,
    )
except ImportError:
    # Missing types aren't important at runtime
    pass


def function_deprecated_by(func):
    # type: (Callable[..., Any]) -> Callable[..., Any]
    """ Return a function that warns it is deprecated by another function.

        Returns a new function that warns it is deprecated by function
        ``func``, then acts as a pass-through wrapper for ``func``.

    """
    try:
        func_name = func.__name__
    except AttributeError:
        func_name = func.__func__.__name__  # type: ignore
    warn_msg = "Use %s instead" % func_name
    def deprecated_func(*args, **kwargs):        # type: ignore
        warnings.warn(warn_msg, DeprecationWarning, stacklevel=2)
        return func(*args, **kwargs)
    return deprecated_func

Directory Contents

Dirs: 2 × Files: 15

Name Size Perms Modified Actions
- drwxr-xr-x 2026-01-08 12:56:13
Edit Download
- drwxr-xr-x 2026-01-08 12:56:13
Edit Download
13.48 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
38.10 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
30.69 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
94.59 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
18.92 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
26.79 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
18.58 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
1.70 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
0 B lrw-r--r-- 2023-01-31 19:04:35
Edit Download
14.53 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
9.31 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
18.04 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
13.23 KB lrw-r--r-- 2023-01-31 19:04:35
Edit Download
63 B lrw-r--r-- 2023-02-01 09:32:24
Edit Download
1012 B lrw-r--r-- 2023-01-31 19:04:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).