403Webshell
Server IP : 37.9.174.138  /  Your IP : 216.73.216.117
Web Server : Apache
System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64
User : ftpuser ( 1001)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/bs4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/bs4/_deprecation.py
"""Helper functions for deprecation.

This interface is itself unstable and may change without warning. Do
not use these functions yourself, even as a joke. The underscores are
there for a reason. No support will be given.

In particular, most of this will go away without warning once
Beautiful Soup drops support for Python 3.11, since Python 3.12
defines a `@typing.deprecated()
decorator. <https://peps.python.org/pep-0702/>`_
"""

import functools
import warnings

from typing import (
    Any,
    Callable,
)


def _deprecated_alias(old_name: str, new_name: str, version: str):
    """Alias one attribute name to another for backward compatibility

    :meta private:
    """

    @property
    def alias(self) -> Any:
        ":meta private:"
        warnings.warn(
            f"Access to deprecated property {old_name}. (Replaced by {new_name}) -- Deprecated since version {version}.",
            DeprecationWarning,
            stacklevel=2,
        )
        return getattr(self, new_name)

    @alias.setter
    def alias(self, value: str) -> None:
        ":meta private:"
        warnings.warn(
            f"Write to deprecated property {old_name}. (Replaced by {new_name}) -- Deprecated since version {version}.",
            DeprecationWarning,
            stacklevel=2,
        )
        return setattr(self, new_name, value)

    return alias


def _deprecated_function_alias(
    old_name: str, new_name: str, version: str
) -> Callable[[Any], Any]:
    def alias(self, *args: Any, **kwargs: Any) -> Any:
        ":meta private:"
        warnings.warn(
            f"Call to deprecated method {old_name}. (Replaced by {new_name}) -- Deprecated since version {version}.",
            DeprecationWarning,
            stacklevel=2,
        )
        return getattr(self, new_name)(*args, **kwargs)

    return alias


def _deprecated(replaced_by: str, version: str) -> Callable:
    def deprecate(func: Callable) -> Callable:
        @functools.wraps(func)
        def with_warning(*args: Any, **kwargs: Any) -> Any:
            ":meta private:"
            warnings.warn(
                f"Call to deprecated method {func.__name__}. (Replaced by {replaced_by}) -- Deprecated since version {version}.",
                DeprecationWarning,
                stacklevel=2,
            )
            return func(*args, **kwargs)

        return with_warning

    return deprecate

Youez - 2016 - github.com/yon3zu
LinuXploit