SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > pydantic > >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic//

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
_internal Directory - -
deprecated Directory - -
plugin Directory - -
v1 Directory - -
__init__.py File 5814 bytes March 06 2024 00:27:04.
_migration.py File 11899 bytes March 06 2024 00:27:04.
alias_generators.py File 1141 bytes March 06 2024 00:27:04.
annotated_handlers.py File 4346 bytes March 06 2024 00:27:04.
class_validators.py File 147 bytes March 06 2024 00:27:04.
color.py File 21493 bytes March 06 2024 00:27:04.
config.py File 24737 bytes March 06 2024 00:27:04.
dataclasses.py File 11490 bytes March 06 2024 00:27:04.
datetime_parse.py File 149 bytes March 06 2024 00:27:04.
decorator.py File 144 bytes March 06 2024 00:27:04.
env_settings.py File 147 bytes March 06 2024 00:27:04.
error_wrappers.py File 149 bytes March 06 2024 00:27:04.
errors.py File 4595 bytes March 06 2024 00:27:04.
fields.py File 45513 bytes March 06 2024 00:27:04.
functional_serializers.py File 10780 bytes March 06 2024 00:27:04.
functional_validators.py File 20471 bytes March 06 2024 00:27:04.
generics.py File 143 bytes March 06 2024 00:27:04.
json.py File 139 bytes March 06 2024 00:27:04.
json_schema.py File 100686 bytes March 06 2024 00:27:04.
main.py File 62260 bytes March 06 2024 00:27:04.
mypy.py File 50721 bytes March 06 2024 00:27:04.
networks.py File 20543 bytes March 06 2024 00:27:04.
parse.py File 140 bytes March 06 2024 00:27:04.
py.typed File 0 bytes March 06 2024 00:27:04.
root_model.py File 4949 bytes March 06 2024 00:27:04.
schema.py File 141 bytes March 06 2024 00:27:04.
tools.py File 140 bytes March 06 2024 00:27:04.
type_adapter.py File 18818 bytes March 06 2024 00:27:04.
types.py File 72231 bytes March 06 2024 00:27:04.
typing.py File 137 bytes March 06 2024 00:27:04.
utils.py File 140 bytes March 06 2024 00:27:04.
validate_call.py File 1780 bytes March 06 2024 00:27:04.
validators.py File 145 bytes March 06 2024 00:27:04.
version.py File 2307 bytes March 06 2024 00:27:04.
warnings.py File 1947 bytes March 06 2024 00:27:04.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic///errors.py

"""Pydantic-specific errors."""
from __future__ import annotations as _annotations

import re

from typing_extensions import Literal, Self

from ._migration import getattr_migration
from .version import version_short

__all__ = (
    'PydanticUserError',
    'PydanticUndefinedAnnotation',
    'PydanticImportError',
    'PydanticSchemaGenerationError',
    'PydanticInvalidForJsonSchema',
    'PydanticErrorCodes',
)

# We use this URL to allow for future flexibility about how we host the docs, while allowing for Pydantic
# code in the while with "old" URLs to still work.
# 'u' refers to "user errors" - e.g. errors caused by developers using pydantic, as opposed to validation errors.
DEV_ERROR_DOCS_URL = f'https://errors.pydantic.dev/{version_short()}/u/'
PydanticErrorCodes = Literal[
    'class-not-fully-defined',
    'custom-json-schema',
    'decorator-missing-field',
    'discriminator-no-field',
    'discriminator-alias-type',
    'discriminator-needs-literal',
    'discriminator-alias',
    'discriminator-validator',
    'typed-dict-version',
    'model-field-overridden',
    'model-field-missing-annotation',
    'config-both',
    'removed-kwargs',
    'invalid-for-json-schema',
    'json-schema-already-used',
    'base-model-instantiated',
    'undefined-annotation',
    'schema-for-unknown-type',
    'import-error',
    'create-model-field-definitions',
    'create-model-config-base',
    'validator-no-fields',
    'validator-invalid-fields',
    'validator-instance-method',
    'root-validator-pre-skip',
    'model-serializer-instance-method',
    'validator-field-config-info',
    'validator-v1-signature',
    'validator-signature',
    'field-serializer-signature',
    'model-serializer-signature',
    'multiple-field-serializers',
    'invalid_annotated_type',
    'type-adapter-config-unused',
    'root-model-extra',
]


class PydanticErrorMixin:
    """A mixin class for common functionality shared by all Pydantic-specific errors.

    Attributes:
        message: A message describing the error.
        code: An optional error code from PydanticErrorCodes enum.
    """

    def __init__(self, message: str, *, code: PydanticErrorCodes | None) -> None:
        self.message = message
        self.code = code

    def __str__(self) -> str:
        if self.code is None:
            return self.message
        else:
            return f'{self.message}\n\nFor further information visit {DEV_ERROR_DOCS_URL}{self.code}'


class PydanticUserError(PydanticErrorMixin, TypeError):
    """An error raised due to incorrect use of Pydantic."""


class PydanticUndefinedAnnotation(PydanticErrorMixin, NameError):
    """A subclass of `NameError` raised when handling undefined annotations during `CoreSchema` generation.

    Attributes:
        name: Name of the error.
        message: Description of the error.
    """

    def __init__(self, name: str, message: str) -> None:
        self.name = name
        super().__init__(message=message, code='undefined-annotation')

    @classmethod
    def from_name_error(cls, name_error: NameError) -> Self:
        """Convert a `NameError` to a `PydanticUndefinedAnnotation` error.

        Args:
            name_error: `NameError` to be converted.

        Returns:
            Converted `PydanticUndefinedAnnotation` error.
        """
        try:
            name = name_error.name  # type: ignore  # python > 3.10
        except AttributeError:
            name = re.search(r".*'(.+?)'", str(name_error)).group(1)  # type: ignore[union-attr]
        return cls(name=name, message=str(name_error))


class PydanticImportError(PydanticErrorMixin, ImportError):
    """An error raised when an import fails due to module changes between V1 and V2.

    Attributes:
        message: Description of the error.
    """

    def __init__(self, message: str) -> None:
        super().__init__(message, code='import-error')


class PydanticSchemaGenerationError(PydanticUserError):
    """An error raised during failures to generate a `CoreSchema` for some type.

    Attributes:
        message: Description of the error.
    """

    def __init__(self, message: str) -> None:
        super().__init__(message, code='schema-for-unknown-type')


class PydanticInvalidForJsonSchema(PydanticUserError):
    """An error raised during failures to generate a JSON schema for some `CoreSchema`.

    Attributes:
        message: Description of the error.
    """

    def __init__(self, message: str) -> None:
        super().__init__(message, code='invalid-for-json-schema')


__getattr__ = getattr_migration(__name__)

SILENT KILLER Tool