PHP 8.2.30
Preview: warnings.py Size: 2.65 KB
//opt/hc_python/lib64/python3.12/site-packages/pydantic/warnings.py

"""Pydantic-specific warnings."""

from __future__ import annotations as _annotations

from .version import version_short

__all__ = (
    'PydanticDeprecatedSince20',
    'PydanticDeprecationWarning',
    'PydanticDeprecatedSince26',
    'PydanticExperimentalWarning',
)


class PydanticDeprecationWarning(DeprecationWarning):
    """A Pydantic specific deprecation warning.

    This warning is raised when using deprecated functionality in Pydantic. It provides information on when the
    deprecation was introduced and the expected version in which the corresponding functionality will be removed.

    Attributes:
        message: Description of the warning.
        since: Pydantic version in what the deprecation was introduced.
        expected_removal: Pydantic version in what the corresponding functionality expected to be removed.
    """

    message: str
    since: tuple[int, int]
    expected_removal: tuple[int, int]

    def __init__(
        self, message: str, *args: object, since: tuple[int, int], expected_removal: tuple[int, int] | None = None
    ) -> None:
        super().__init__(message, *args)
        self.message = message.rstrip('.')
        self.since = since
        self.expected_removal = expected_removal if expected_removal is not None else (since[0] + 1, 0)

    def __str__(self) -> str:
        message = (
            f'{self.message}. Deprecated in Pydantic V{self.since[0]}.{self.since[1]}'
            f' to be removed in V{self.expected_removal[0]}.{self.expected_removal[1]}.'
        )
        if self.since == (2, 0):
            message += f' See Pydantic V2 Migration Guide at https://errors.pydantic.dev/{version_short()}/migration/'
        return message


class PydanticDeprecatedSince20(PydanticDeprecationWarning):
    """A specific `PydanticDeprecationWarning` subclass defining functionality deprecated since Pydantic 2.0."""

    def __init__(self, message: str, *args: object) -> None:
        super().__init__(message, *args, since=(2, 0), expected_removal=(3, 0))


class PydanticDeprecatedSince26(PydanticDeprecationWarning):
    """A specific `PydanticDeprecationWarning` subclass defining functionality deprecated since Pydantic 2.6."""

    def __init__(self, message: str, *args: object) -> None:
        super().__init__(message, *args, since=(2, 0), expected_removal=(3, 0))


class GenericBeforeBaseModelWarning(Warning):
    pass


class PydanticExperimentalWarning(Warning):
    """A Pydantic specific experimental functionality warning.

    This warning is raised when using experimental functionality in Pydantic.
    It is raised to warn users that the functionality may change or be removed in future versions of Pydantic.
    """

Directory Contents

Dirs: 6 × Files: 36

Name Size Perms Modified Actions
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
plugin DIR
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
v1 DIR
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
_internal DIR
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
- drwxr-xr-x 2025-04-04 08:02:07
Edit Download
4.71 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
2.07 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
4.25 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
148 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
20.99 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
34.29 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
13.58 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
150 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
145 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
148 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
4.72 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
150 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
50.53 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
14.27 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
23.66 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
144 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
140 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
103.81 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
68.46 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
55.64 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
22.18 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
141 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
0 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
6.05 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
142 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
141 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
93.50 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
24.39 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
138 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
141 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
2.08 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
146 B lrw-r--r-- 2025-04-04 08:02:07
Edit Download
2.38 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
2.65 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
11.63 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download
13.60 KB lrw-r--r-- 2025-04-04 08:02:07
Edit Download

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