id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14,000 | samuelcolvin/pydantic | pydantic/_internal/_schema_generation_shared.py | pydantic._internal._schema_generation_shared.GenerateJsonSchemaHandler | from ..annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
from pydantic_core import core_schema
class GenerateJsonSchemaHandler(GetJsonSchemaHandler):
"""JsonSchemaHandler implementation that doesn't do ref unwrapping by default.
This is used for any Annotated metadata so that we don't end u... |
class GenerateJsonSchemaHandler(GetJsonSchemaHandler):
'''JsonSchemaHandler implementation that doesn't do ref unwrapping by default.
This is used for any Annotated metadata so that we don't end up with conflicting
modifications to the definition schema.
Used internally by Pydantic, please do not rely ... | 4 | 2 | 10 | 1 | 6 | 3 | 2 | 0.83 | 1 | 1 | 0 | 0 | 3 | 3 | 3 | 3 | 42 | 9 | 18 | 9 | 14 | 15 | 15 | 9 | 11 | 3 | 1 | 1 | 5 |
14,001 | samuelcolvin/pydantic | pydantic/_internal/_utils.py | pydantic._internal._utils.SafeGetItemProxy | import dataclasses
from collections.abc import Callable, Iterable, Mapping
from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload
@dataclasses.dataclass(frozen=True)
class SafeGetItemProxy:
"""Wrapper redirecting `__getitem__` to `get` with a sentinel value as default
This makes is safe to use in `... | @dataclasses.dataclass(frozen=True)
class SafeGetItemProxy:
'''Wrapper redirecting `__getitem__` to `get` with a sentinel value as default
This makes is safe to use in `operator.itemgetter` when some keys may be missing
'''
def __getitem__(self, key: str, /) -> Any:
pass
def __contains... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 1.13 | 0 | 3 | 0 | 0 | 2 | 0 | 2 | 2 | 23 | 6 | 8 | 4 | 5 | 9 | 8 | 4 | 5 | 1 | 0 | 1 | 2 |
14,002 | samuelcolvin/pydantic | pydantic/_internal/_utils.py | pydantic._internal._utils.ValueItems | from . import _repr, _typing_extra
from collections.abc import Callable, Iterable, Mapping
from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload
from collections.abc import Set as AbstractSet
class ValueItems(_repr.Representation):
"""Class for more convenient calculation of excluded or included fields... |
class ValueItems(_repr.Representation):
'''Class for more convenient calculation of excluded or included fields on values.'''
def __init__(self, value: Any, items: AbstractSetIntStr | MappingIntStrAny) -> None:
pass
def is_excluded(self, item: Any) -> bool:
'''Check if item is fully exclu... | 15 | 6 | 11 | 1 | 8 | 3 | 3 | 0.41 | 1 | 9 | 0 | 0 | 6 | 1 | 10 | 18 | 132 | 23 | 81 | 27 | 66 | 33 | 71 | 23 | 60 | 11 | 1 | 2 | 32 |
14,003 | samuelcolvin/pydantic | pydantic/_internal/_utils.py | pydantic._internal._utils.deprecated_instance_property | import sys
import warnings
from typing_extensions import TypeAlias, TypeGuard, deprecated
from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload
from pydantic import PydanticDeprecatedSince211
from collections.abc import Callable, Iterable, Mapping
class deprecated_instance_property(Generic[_ModelT, _RT]):
... |
class deprecated_instance_property(Generic[_ModelT, _RT]):
'''A decorator exposing the decorated class method as a property, with a warning on instance access.
This decorator takes a class method defined on the `BaseModel` class and transforms it into
an attribute. The attribute can be accessed on both the... | 8 | 1 | 4 | 0 | 3 | 0 | 1 | 0.29 | 1 | 1 | 0 | 0 | 4 | 1 | 4 | 6 | 30 | 3 | 21 | 8 | 11 | 6 | 11 | 6 | 6 | 2 | 1 | 1 | 5 |
14,004 | samuelcolvin/pydantic | pydantic/_internal/_validate_call.py | pydantic._internal._validate_call.ValidateCallWrapper | from functools import partial
from ._namespace_utils import MappingNamespace, NsResolver, ns_for_function
from typing import Any, Callable
import pydantic_core
from ..config import ConfigDict
from ._config import ConfigWrapper
from collections.abc import Awaitable
from ..plugin._schema_validator import create_schema_va... |
class ValidateCallWrapper:
'''This is a wrapper around a function that validates the arguments passed to it, and optionally the return value.'''
def __init__(self, function: ValidateCallSupportedTypes, config: ConfigDict | None, validate_return: bool, parent_namespace: MappingNamespace | None) -> None:
... | 5 | 1 | 21 | 2 | 19 | 0 | 3 | 0.02 | 0 | 8 | 4 | 0 | 2 | 2 | 2 | 2 | 68 | 9 | 58 | 25 | 48 | 1 | 32 | 19 | 28 | 5 | 0 | 2 | 8 |
14,005 | samuelcolvin/pydantic | pydantic/aliases.py | pydantic.aliases.AliasChoices | from ._internal import _internal_dataclass
import dataclasses
@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasChoices:
"""!!! abstract "Usage Documentation"
[`AliasPath` and `AliasChoices`](../concepts/alias.md#aliaspath-and-aliaschoices)
A data class used by `validation_alias` as ... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasChoices:
'''!!! abstract "Usage Documentation"
[`AliasPath` and `AliasChoices`](../concepts/alias.md#aliaspath-and-aliaschoices)
A data class used by `validation_alias` as a convenience to create aliases.
Attributes:
choices... | 4 | 2 | 8 | 1 | 5 | 2 | 2 | 0.83 | 0 | 4 | 1 | 0 | 2 | 0 | 2 | 2 | 28 | 6 | 12 | 5 | 9 | 10 | 11 | 5 | 8 | 3 | 0 | 2 | 4 |
14,006 | samuelcolvin/pydantic | pydantic/aliases.py | pydantic.aliases.AliasGenerator | import dataclasses
from typing import Any, Callable, Literal
from ._internal import _internal_dataclass
@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasGenerator:
"""!!! abstract "Usage Documentation"
[Using an `AliasGenerator`](../concepts/alias.md#using-an-aliasgenerator)
A data ... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasGenerator:
'''!!! abstract "Usage Documentation"
[Using an `AliasGenerator`](../concepts/alias.md#using-an-aliasgenerator)
A data class used by `alias_generator` as a convenience to create various aliases.
Attributes:
alias:... | 4 | 3 | 15 | 2 | 10 | 5 | 2 | 0.74 | 0 | 6 | 2 | 0 | 2 | 0 | 2 | 2 | 47 | 8 | 23 | 16 | 15 | 17 | 16 | 10 | 13 | 3 | 0 | 2 | 4 |
14,007 | samuelcolvin/pydantic | pydantic/aliases.py | pydantic.aliases.AliasPath | from pydantic_core import PydanticUndefined
from typing import Any, Callable, Literal
from ._internal import _internal_dataclass
import dataclasses
@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasPath:
"""!!! abstract "Usage Documentation"
[`AliasPath` and `AliasChoices`](../concepts/al... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasPath:
'''!!! abstract "Usage Documentation"
[`AliasPath` and `AliasChoices`](../concepts/alias.md#aliaspath-and-aliaschoices)
A data class used by `validation_alias` as a convenience to create aliases.
Attributes:
path: A li... | 5 | 3 | 8 | 1 | 5 | 3 | 2 | 0.94 | 0 | 7 | 0 | 0 | 3 | 0 | 3 | 3 | 39 | 8 | 16 | 6 | 12 | 15 | 16 | 6 | 12 | 4 | 0 | 2 | 6 |
14,008 | samuelcolvin/pydantic | pydantic/annotated_handlers.py | pydantic.annotated_handlers.GetCoreSchemaHandler | from typing import TYPE_CHECKING, Any, Union
from pydantic_core import core_schema
class GetCoreSchemaHandler:
"""Handler to call into the next CoreSchema schema generation function."""
def __call__(self, source_type: Any, /) -> core_schema.CoreSchema:
"""Call the inner handler and get the CoreSchema ... |
class GetCoreSchemaHandler:
'''Handler to call into the next CoreSchema schema generation function.'''
def __call__(self, source_type: Any, /) -> core_schema.CoreSchema:
'''Call the inner handler and get the CoreSchema it returns.
This will call the next CoreSchema modifying function up until ... | 7 | 6 | 10 | 1 | 2 | 6 | 1 | 2.75 | 0 | 3 | 1 | 0 | 5 | 0 | 5 | 5 | 57 | 12 | 12 | 7 | 5 | 33 | 11 | 6 | 5 | 1 | 0 | 0 | 5 |
14,009 | samuelcolvin/pydantic | pydantic/annotated_handlers.py | pydantic.annotated_handlers.GetJsonSchemaHandler | class GetJsonSchemaHandler:
"""Handler to call into the next JSON schema generation function.
Attributes:
mode: Json schema mode, can be `validation` or `serialization`.
"""
mode: JsonSchemaMode
def __call__(self, core_schema: CoreSchemaOrField, /) -> JsonSchemaValue:
"""Call the i... | class GetJsonSchemaHandler:
'''Handler to call into the next JSON schema generation function.
Attributes:
mode: Json schema mode, can be `validation` or `serialization`.
'''
def __call__(self, core_schema: CoreSchemaOrField, /) -> JsonSchemaValue:
'''Call the inner handler and get the J... | 3 | 3 | 15 | 3 | 2 | 11 | 1 | 4.17 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 40 | 9 | 6 | 3 | 3 | 25 | 6 | 3 | 3 | 1 | 0 | 0 | 2 |
14,010 | samuelcolvin/pydantic | pydantic/color.py | pydantic.color.Color | from pydantic_core import CoreSchema, PydanticCustomError, core_schema
from ._internal._schema_generation_shared import GetJsonSchemaHandler as _GetJsonSchemaHandler
from .json_schema import JsonSchemaValue
from .warnings import PydanticDeprecatedSince20
from ._internal import _repr
from typing import Any, Callable, Op... | null | 21 | 8 | 10 | 1 | 6 | 3 | 2 | 0.48 | 1 | 11 | 1 | 0 | 13 | 2 | 16 | 24 | 179 | 31 | 103 | 36 | 79 | 49 | 77 | 28 | 60 | 4 | 1 | 3 | 33 |
14,011 | samuelcolvin/pydantic | pydantic/color.py | pydantic.color.RGBA | from typing import Any, Callable, Optional, Union, cast
class RGBA:
"""Internal use only as a representation of a color."""
__slots__ = ('r', 'g', 'b', 'alpha', '_tuple')
def __init__(self, r: float, g: float, b: float, alpha: Optional[float]):
self.r = r
self.g = g
self.b = b
... |
class RGBA:
'''Internal use only as a representation of a color.'''
def __init__(self, r: float, g: float, b: float, alpha: Optional[float]):
pass
def __getitem__(self, item: Any) -> Any:
pass | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.1 | 0 | 2 | 0 | 0 | 2 | 5 | 2 | 2 | 15 | 4 | 10 | 9 | 7 | 1 | 10 | 9 | 7 | 1 | 0 | 0 | 2 |
14,012 | samuelcolvin/pydantic | pydantic/config.py | pydantic.config.ConfigDict | from typing_extensions import TypeAlias, TypedDict, Unpack, deprecated
from .aliases import AliasGenerator
from re import Pattern
from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, Union, cast, overload
class ConfigDict(TypedDict, total=False):
"""A TypedDict for configuring Pydantic behaviour."""
... |
class ConfigDict(TypedDict, total=False):
'''A TypedDict for configuring Pydantic behaviour.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 17.17 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 993 | 230 | 42 | 1 | 41 | 721 | 42 | 1 | 41 | 0 | 1 | 0 | 0 |
14,013 | samuelcolvin/pydantic | pydantic/deprecated/config.py | pydantic.deprecated.config.BaseConfig | from typing_extensions import deprecated
from .._internal import _config
from typing import TYPE_CHECKING, Any, Literal
from ..warnings import PydanticDeprecatedSince20
import warnings
@deprecated('BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead.', category=PydanticDeprecatedSince20)
class BaseConfig(m... | @deprecated('BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead.', category=PydanticDeprecatedSince20)
class BaseConfig(metaclass=_ConfigMetaclass):
'''This class is only retained for backwards compatibility.
!!! Warning "Deprecated"
BaseConfig is deprecated. Use the [`pydantic.ConfigDict`]... | 4 | 1 | 7 | 0 | 7 | 1 | 2 | 0.36 | 1 | 5 | 0 | 0 | 2 | 0 | 2 | 16 | 22 | 3 | 14 | 5 | 11 | 5 | 14 | 4 | 11 | 3 | 3 | 2 | 4 |
14,014 | samuelcolvin/pydantic | pydantic/deprecated/config.py | pydantic.deprecated.config.Extra | from typing import TYPE_CHECKING, Any, Literal
from ..warnings import PydanticDeprecatedSince20
from typing_extensions import deprecated
@deprecated("Extra is deprecated. Use literal values instead (e.g. `extra='allow'`)", category=PydanticDeprecatedSince20)
class Extra(metaclass=_ExtraMeta):
allow: Literal['allow... | @deprecated("Extra is deprecated. Use literal values instead (e.g. `extra='allow'`)", category=PydanticDeprecatedSince20)
class Extra(metaclass=_ExtraMeta):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 3 | 0 | 0 |
14,015 | samuelcolvin/pydantic | pydantic/deprecated/config.py | pydantic.deprecated.config._ConfigMetaclass | from typing import TYPE_CHECKING, Any, Literal
import warnings
from .._internal import _config
class _ConfigMetaclass(type):
def __getattr__(self, item: str) -> Any:
try:
obj = _config.config_defaults[item]
warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)
... |
class _ConfigMetaclass(type):
def __getattr__(self, item: str) -> Any:
pass | 2 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 5 | 0 | 1 | 1 | 0 | 1 | 14 | 8 | 0 | 8 | 4 | 6 | 0 | 8 | 3 | 6 | 2 | 2 | 1 | 2 |
14,016 | samuelcolvin/pydantic | pydantic/deprecated/config.py | pydantic.deprecated.config._ExtraMeta | from typing import TYPE_CHECKING, Any, Literal
import warnings
class _ExtraMeta(type):
def __getattribute__(self, __name: str) -> Any:
if __name in {'allow', 'ignore', 'forbid'}:
warnings.warn("`pydantic.config.Extra` is deprecated, use literal values instead (e.g. `extra='allow'`)", Deprecati... |
class _ExtraMeta(type):
def __getattribute__(self, __name: str) -> Any:
pass | 2 | 0 | 9 | 0 | 8 | 1 | 2 | 0.11 | 1 | 4 | 0 | 1 | 1 | 0 | 1 | 14 | 10 | 0 | 9 | 2 | 7 | 1 | 5 | 2 | 3 | 2 | 2 | 1 | 2 |
14,017 | samuelcolvin/pydantic | pydantic/deprecated/decorator.py | pydantic.deprecated.decorator.ValidatedFunction | from ..errors import PydanticUserError
from ..functional_validators import field_validator
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, Union, overload
from ..alias_generators import to_pascal
from ..main import BaseModel, create_model
from collections.abc import Mapping
from .._internal import _... |
class ValidatedFunction:
def __init__(self, function: 'AnyCallable', config: 'ConfigType'):
pass
def init_model_instance(self, *args: Any, **kwargs: Any) -> BaseModel:
pass
def call(self, *args: Any, **kwargs: Any) -> Any:
pass
def build_values(self, args: tuple[Any, ...], k... | 20 | 0 | 23 | 3 | 20 | 0 | 5 | 0.02 | 0 | 16 | 4 | 0 | 6 | 6 | 6 | 6 | 209 | 30 | 175 | 60 | 154 | 4 | 139 | 54 | 126 | 13 | 0 | 3 | 49 |
14,018 | samuelcolvin/pydantic | pydantic/deprecated/parse.py | pydantic.deprecated.parse.Protocol | import json
import pickle
from enum import Enum
class Protocol(str, Enum):
json = 'json'
pickle = 'pickle' |
class Protocol(str, Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
14,019 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticErrorMixin | 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 |... | 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 | ... | 3 | 1 | 4 | 0 | 4 | 0 | 2 | 0.56 | 0 | 1 | 0 | 3 | 2 | 2 | 2 | 2 | 17 | 3 | 9 | 5 | 6 | 5 | 8 | 5 | 5 | 2 | 0 | 1 | 3 |
14,020 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticImportError | 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 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:
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1.33 | 2 | 2 | 0 | 0 | 1 | 0 | 1 | 15 | 9 | 2 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
14,021 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticInvalidForJsonSchema | 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-schem... | 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:
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1.33 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 14 | 9 | 2 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,022 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticSchemaGenerationError | 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 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:
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1.33 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 14 | 9 | 2 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,023 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticUndefinedAnnotation | import re
from typing_extensions import Self
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.
"""... |
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: s... | 4 | 2 | 9 | 1 | 5 | 4 | 2 | 1.18 | 2 | 3 | 0 | 0 | 1 | 1 | 2 | 15 | 27 | 5 | 11 | 6 | 7 | 13 | 10 | 5 | 7 | 2 | 4 | 1 | 3 |
14,024 | samuelcolvin/pydantic | pydantic/errors.py | pydantic.errors.PydanticUserError | class PydanticUserError(PydanticErrorMixin, TypeError):
"""An error raised due to incorrect use of Pydantic.""" | class PydanticUserError(PydanticErrorMixin, TypeError):
'''An error raised due to incorrect use of Pydantic.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 13 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 4 | 0 | 0 |
14,025 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._Constraint | from dataclasses import dataclass
@dataclass(**_slots_frozen)
class _Constraint:
constraint: _ConstraintAnnotation | @dataclass(**_slots_frozen)
class _Constraint:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,026 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._Eq | from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
@dataclass(**_slots_frozen)
class _Eq:
value: Any | @dataclass(**_slots_frozen)
class _Eq:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,027 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._FieldTypeMarker | class _FieldTypeMarker:
pass | class _FieldTypeMarker:
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,028 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._In | from collections.abc import Container
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
from dataclasses import dataclass
@dataclass(**_slots_frozen)
class _In:
values: Container[Any] | @dataclass(**_slots_frozen)
class _In:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,029 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._NotEq | from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
from dataclasses import dataclass
@dataclass(**_slots_frozen)
class _NotEq:
value: Any | @dataclass(**_slots_frozen)
class _NotEq:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,030 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._NotIn | from collections.abc import Container
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
from dataclasses import dataclass
@dataclass(**_slots_frozen)
class _NotIn:
values: Container[Any] | @dataclass(**_slots_frozen)
class _NotIn:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,031 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._Pipeline | from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
from collections.abc import Container
import datetime
from dataclasses import dataclass
from re import Pattern
import re
from collections import deque
from pydantic._internal._internal_dataclass import slots_true as ... | @dataclass(**_slots_true)
class _Pipeline(Generic[_InT, _OutT]):
'''Abstract representation of a chain of validation, transformation, and parsing steps.'''
def transform(self, func: Callable[[_OutT], _NewOutT]) -> _Pipeline[_InT, _NewOutT]:
'''Transform the output of the previous step.
If used ... | 69 | 18 | 3 | 0 | 2 | 1 | 1 | 0.31 | 1 | 31 | 11 | 0 | 49 | 0 | 49 | 51 | 225 | 62 | 127 | 89 | 60 | 39 | 111 | 56 | 60 | 2 | 1 | 1 | 51 |
14,032 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._PipelineAnd | from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
from dataclasses import dataclass
@dataclass(**_slots_frozen)
class _PipelineAnd:
left: _Pipeline[Any, Any]
right: _Pipeline[Any, Any] | @dataclass(**_slots_frozen)
class _PipelineAnd:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
14,033 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._PipelineOr | from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
@dataclass(**_slots_frozen)
class _PipelineOr:
left: _Pipeline[Any, Any]
right: _Pipeline[Any, Any] | @dataclass(**_slots_frozen)
class _PipelineOr:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
14,034 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._SupportsLen | from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
class _SupportsLen(Protocol):
def __len__(self) -> int:
... |
class _SupportsLen(Protocol):
def __len__(self) -> int:
pass | 2 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 25 | 2 | 0 | 2 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,035 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._SupportsRange | from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
import annotated_types
class _SupportsRange(annotated_types.SupportsLe, annotated_types.SupportsGe, Protocol):
pass |
class _SupportsRange(annotated_types.SupportsLe, annotated_types.SupportsGe, Protocol):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
14,036 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._Transform | from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
@dataclass(**_slots_frozen)
class _Transform:
func: Callable[[Any], Any] | @dataclass(**_slots_frozen)
class _Transform:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
14,037 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._ValidateAs | from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
@dataclass(**_slots_frozen)
class _ValidateAs:
tp: type[Any]
strict: bool = False | @dataclass(**_slots_frozen)
class _ValidateAs:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 2 | 2 | 0 | 3 | 2 | 2 | 0 | 0 | 0 | 0 |
14,038 | samuelcolvin/pydantic | pydantic/experimental/pipeline.py | pydantic.experimental.pipeline._ValidateAsDefer | from dataclasses import dataclass
from functools import cached_property, partial
from typing import TYPE_CHECKING, Annotated, Any, Callable, Generic, Protocol, TypeVar, Union, overload
@dataclass
class _ValidateAsDefer:
func: Callable[[], type[Any]]
@cached_property
def tp(self) -> type[Any]:
retu... | @dataclass
class _ValidateAsDefer:
@cached_property
def tp(self) -> type[Any]:
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 5 | 3 | 2 | 0 | 4 | 2 | 2 | 1 | 0 | 0 | 1 |
14,039 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields.ComputedFieldInfo | import dataclasses
from ._internal import _decorators, _fields, _generics, _internal_dataclass, _repr, _typing_extra, _utils
from .aliases import AliasChoices, AliasGenerator, AliasPath
from typing_extensions import Self, TypeAlias, Unpack, deprecated
from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal,... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class ComputedFieldInfo:
'''A container for data from `@computed_field` so that we can access it while building the pydantic-core schema.
Attributes:
decorator_repr: A class variable representing the decorator string, '@computed_field'.
wr... | 6 | 4 | 7 | 0 | 6 | 1 | 5 | 0.85 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 40 | 3 | 20 | 4 | 17 | 17 | 19 | 3 | 17 | 5 | 0 | 1 | 5 |
14,040 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields.FieldInfo | import annotated_types
from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal, TypedDict, TypeVar, cast, final, overload
from typing_inspection import typing_objects
from copy import copy
from typing_inspection.introspection import UNKNOWN, AnnotationSource, ForbiddenQualifier, Qualifier, inspect_annotatio... | @final
class FieldInfo(_repr.Representation):
'''This class holds information about a field.
`FieldInfo` is used for any field definition regardless of whether the [`Field()`][pydantic.fields.Field]
function is explicitly used.
!!! warning
You generally shouldn't be creating `FieldInfo` directly... | 32 | 16 | 30 | 4 | 16 | 9 | 5 | 0.54 | 1 | 13 | 4 | 0 | 10 | 4 | 16 | 24 | 607 | 93 | 339 | 76 | 307 | 183 | 245 | 59 | 228 | 14 | 1 | 4 | 80 |
14,041 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields.ModelPrivateAttr | from pydantic_core import MISSING, PydanticUndefined
from collections.abc import Callable, Mapping
from ._internal import _decorators, _fields, _generics, _internal_dataclass, _repr, _typing_extra, _utils
from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal, TypedDict, TypeVar, cast, final, overload
cla... |
class ModelPrivateAttr(_repr.Representation):
'''A descriptor for private attributes in class models.
!!! warning
You generally shouldn't be creating `ModelPrivateAttr` instances directly, instead use
`pydantic.fields.PrivateAttr`. (This is similar to `FieldInfo` vs. `Field`.)
Attributes:
... | 6 | 4 | 8 | 1 | 5 | 2 | 2 | 0.67 | 1 | 4 | 0 | 0 | 5 | 2 | 5 | 13 | 62 | 12 | 30 | 13 | 22 | 20 | 24 | 11 | 18 | 3 | 1 | 2 | 11 |
14,042 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields._EmptyKwargs | from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal, TypedDict, TypeVar, cast, final, overload
class _EmptyKwargs(TypedDict):
"""This class exists solely to ensure that type checking warns about passing `**extra` in `Field`.""" |
class _EmptyKwargs(TypedDict):
'''This class exists solely to ensure that type checking warns about passing `**extra` in `Field`.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
14,043 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields._FieldInfoInputs | from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal, TypedDict, TypeVar, cast, final, overload
class _FieldInfoInputs(_FromFieldInfoInputs, total=False):
"""This class exists solely to add type checking for the `**kwargs` in `FieldInfo.__init__`."""
default: Any |
class _FieldInfoInputs(_FromFieldInfoInputs, total=False):
'''This class exists solely to add type checking for the `**kwargs` in `FieldInfo.__init__`.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
14,044 | samuelcolvin/pydantic | pydantic/fields.py | pydantic.fields._FromFieldInfoInputs | from .config import JsonDict
from typing_extensions import Self, TypeAlias, Unpack, deprecated
import re
import annotated_types
from .aliases import AliasChoices, AliasGenerator, AliasPath
from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal, TypedDict, TypeVar, cast, final, overload
from collections.abc... |
class _FromFieldInfoInputs(TypedDict, total=False):
'''This class exists solely to add type checking for the `**kwargs` in `FieldInfo.from_field`.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.06 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 39 | 1 | 36 | 1 | 35 | 2 | 36 | 1 | 35 | 0 | 1 | 0 | 0 |
14,045 | samuelcolvin/pydantic | pydantic/functional_serializers.py | pydantic.functional_serializers.PlainSerializer | from pydantic_core.core_schema import SerializationInfo, SerializerFunctionWrapHandler, WhenUsed
import dataclasses
from pydantic_core import PydanticUndefined, core_schema
from ._internal import _decorators, _internal_dataclass
from . import PydanticUndefinedAnnotation
from typing import TYPE_CHECKING, Annotated, Any,... | @dataclasses.dataclass(**_internal_dataclass.slots_true, frozen=True)
class PlainSerializer:
'''Plain serializers use a function to modify the output of serialization.
This is particularly helpful when you want to customize the serialization for annotated types.
Consider an input of `list`, which will be se... | 3 | 2 | 30 | 2 | 18 | 10 | 3 | 1.41 | 0 | 3 | 2 | 0 | 1 | 0 | 1 | 1 | 64 | 11 | 22 | 8 | 20 | 31 | 13 | 7 | 11 | 3 | 0 | 1 | 3 |
14,046 | samuelcolvin/pydantic | pydantic/functional_serializers.py | pydantic.functional_serializers.WrapSerializer | from pydantic_core.core_schema import SerializationInfo, SerializerFunctionWrapHandler, WhenUsed
from .annotated_handlers import GetCoreSchemaHandler
import dataclasses
from pydantic_core import PydanticUndefined, core_schema
from ._internal import _decorators, _internal_dataclass
from typing import TYPE_CHECKING, Anno... | @dataclasses.dataclass(**_internal_dataclass.slots_true, frozen=True)
class WrapSerializer:
'''Wrap serializers receive the raw inputs along with a handler function that applies the standard serialization
logic, and can modify the resulting value before returning it as the final output of serialization.
For... | 3 | 2 | 31 | 2 | 19 | 10 | 3 | 2.65 | 0 | 3 | 2 | 0 | 1 | 0 | 1 | 1 | 98 | 14 | 23 | 9 | 21 | 61 | 14 | 8 | 12 | 3 | 0 | 1 | 3 |
14,047 | samuelcolvin/pydantic | pydantic/functional_validators.py | pydantic.functional_validators.FreeModelBeforeValidatorWithoutInfo | from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, TypeVar, Union, cast, overload
class FreeModelBeforeValidatorWithoutInfo(Protocol):
"""A `@model_validator` decorated function signature.
This is used when `mode='before'` and the function does not have info argument.
"""
def __call_... |
class FreeModelBeforeValidatorWithoutInfo(Protocol):
'''A `@model_validator` decorated function signature.
This is used when `mode='before'` and the function does not have info argument.
'''
def __call__(self, value: Any, /) -> Any:
pass | 2 | 1 | 8 | 0 | 5 | 4 | 1 | 1.17 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 23 | 13 | 1 | 6 | 6 | 1 | 7 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
14,048 | samuelcolvin/pydantic | pydantic/functional_validators.py | pydantic.functional_validators.ModelBeforeValidatorWithoutInfo | from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, TypeVar, Union, cast, overload
class ModelBeforeValidatorWithoutInfo(Protocol):
"""A `@model_validator` decorated function signature.
This is used when `mode='before'` and the function does not have info argument.
"""
def __call__(se... |
class ModelBeforeValidatorWithoutInfo(Protocol):
'''A `@model_validator` decorated function signature.
This is used when `mode='before'` and the function does not have info argument.
'''
def __call__(self, cls: Any, value: Any, /) -> Any:
pass | 2 | 1 | 9 | 0 | 6 | 4 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 23 | 14 | 1 | 7 | 7 | 1 | 7 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
14,049 | samuelcolvin/pydantic | pydantic/functional_validators.py | pydantic.functional_validators.ModelWrapValidatorHandler | from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, TypeVar, Union, cast, overload
from pydantic_core import PydanticUndefined, core_schema
class ModelWrapValidatorHandler(core_schema.ValidatorFunctionWrapHandler, Protocol[_ModelTypeCo]):
"""`@model_validator` decorated function handler argument t... |
class ModelWrapValidatorHandler(core_schema.ValidatorFunctionWrapHandler, Protocol[_ModelTypeCo]):
'''`@model_validator` decorated function handler argument type. This is used when `mode='wrap'`.'''
def __call__(self, value: Any, outer_location: str | int | None=None, /) -> _ModelTypeCo:
pass | 2 | 1 | 7 | 0 | 7 | 2 | 1 | 0.38 | 2 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 10 | 1 | 8 | 7 | 1 | 3 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,050 | samuelcolvin/pydantic | pydantic/functional_validators.py | pydantic.functional_validators.ModelWrapValidatorWithoutInfo | from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, TypeVar, Union, cast, overload
class ModelWrapValidatorWithoutInfo(Protocol[_ModelType]):
"""A `@model_validator` decorated function signature.
This is used when `mode='wrap'` and the function does not have info argument.
"""
def __c... |
class ModelWrapValidatorWithoutInfo(Protocol[_ModelType]):
'''A `@model_validator` decorated function signature.
This is used when `mode='wrap'` and the function does not have info argument.
'''
def __call__(self, cls: type[_ModelType], value: Any, handler: ModelWrapValidatorHandler[_ModelType], /) ->... | 2 | 1 | 10 | 0 | 7 | 4 | 1 | 0.88 | 1 | 2 | 1 | 0 | 1 | 0 | 1 | 23 | 15 | 1 | 8 | 8 | 1 | 7 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
14,051 | samuelcolvin/pydantic | pydantic/json_schema.py | pydantic.json_schema.Examples | from .annotated_handlers import GetJsonSchemaHandler
from pydantic.warnings import PydanticDeprecatedSince26, PydanticDeprecatedSince29
import warnings
from pydantic_core import MISSING, CoreSchema, PydanticOmit, core_schema, to_jsonable_python
from typing_extensions import TypeAlias, assert_never, deprecated, final
fr... |
class Examples:
'''Add examples to a JSON schema.
If the JSON Schema already contains examples, the provided examples
will be appended.
If `mode` is set this will only apply to that schema generation mode,
allowing you to add different examples for validation and serialization.
'''
@overloa... | 9 | 1 | 11 | 0 | 11 | 0 | 3 | 0.1 | 0 | 7 | 0 | 0 | 5 | 2 | 5 | 5 | 72 | 8 | 58 | 20 | 45 | 6 | 31 | 11 | 25 | 8 | 0 | 2 | 13 |
14,052 | samuelcolvin/pydantic | pydantic/json_schema.py | pydantic.json_schema.GenerateJsonSchema | from .errors import PydanticInvalidForJsonSchema, PydanticSchemaGenerationError, PydanticUserError
from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, NewType, TypeVar, Union, cast, overload
from .config import JsonDict, JsonValue
from re import Pattern
from .annotated_handlers import GetJsonSchemaHand... |
class GenerateJsonSchema:
'''!!! abstract "Usage Documentation"
[Customizing the JSON Schema Generation Process](../concepts/json_schema.md#customizing-the-json-schema-generation-process)
A class for generating JSON schemas.
This class generates JSON schemas based on configured parameters. The defa... | 114 | 88 | 20 | 3 | 11 | 7 | 3 | 0.66 | 0 | 32 | 10 | 0 | 93 | 15 | 94 | 94 | 2,118 | 387 | 1,061 | 387 | 911 | 700 | 849 | 331 | 742 | 20 | 0 | 4 | 321 |
14,053 | samuelcolvin/pydantic | pydantic/json_schema.py | pydantic.json_schema.PydanticJsonSchemaWarning | class PydanticJsonSchemaWarning(UserWarning):
"""This class is used to emit warnings produced during JSON schema generation.
See the [`GenerateJsonSchema.emit_warning`][pydantic.json_schema.GenerateJsonSchema.emit_warning] and
[`GenerateJsonSchema.render_warning_message`][pydantic.json_schema.GenerateJsonSc... | class PydanticJsonSchemaWarning(UserWarning):
'''This class is used to emit warnings produced during JSON schema generation.
See the [`GenerateJsonSchema.emit_warning`][pydantic.json_schema.GenerateJsonSchema.emit_warning] and
[`GenerateJsonSchema.render_warning_message`][pydantic.json_schema.GenerateJsonSc... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 6 | 0 | 1 | 1 | 0 | 5 | 1 | 1 | 0 | 0 | 5 | 0 | 0 |
14,054 | samuelcolvin/pydantic | pydantic/json_schema.py | pydantic.json_schema.WithJsonSchema | from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, NewType, TypeVar, Union, cast, overload
from .annotated_handlers import GetJsonSchemaHandler
import dataclasses
from pydantic_core import MISSING, CoreSchema, PydanticOmit, core_schema, to_jsonable_python
from ._internal import _config, _core_metadata... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class WithJsonSchema:
'''!!! abstract "Usage Documentation"
[`WithJsonSchema` Annotation](../concepts/json_schema.md#withjsonschema-annotation)
Add this as an annotation on a field to override the (base) JSON schema that would be generated for tha... | 4 | 1 | 7 | 0 | 6 | 1 | 2 | 0.8 | 0 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 32 | 5 | 15 | 7 | 10 | 12 | 12 | 5 | 9 | 3 | 0 | 1 | 4 |
14,055 | samuelcolvin/pydantic | pydantic/json_schema.py | pydantic.json_schema._DefinitionsRemapping | from .errors import PydanticInvalidForJsonSchema, PydanticSchemaGenerationError, PydanticUserError
from ._internal import _config, _core_metadata, _core_utils, _decorators, _internal_dataclass, _mock_val_ser, _schema_generation_shared
from typing import TYPE_CHECKING, Annotated, Any, Callable, Literal, NewType, TypeVar... | @dataclasses.dataclass(**_internal_dataclass.slots_true)
class _DefinitionsRemapping:
@staticmethod
def from_prioritized_choices(prioritized_choices: dict[DefsRef, list[DefsRef]], defs_to_json: dict[DefsRef, JsonRef], definitions: dict[DefsRef, JsonSchemaValue]) -> _DefinitionsRemapping:
'''
Th... | 7 | 2 | 18 | 1 | 12 | 5 | 4 | 0.36 | 0 | 5 | 1 | 0 | 3 | 0 | 4 | 4 | 78 | 7 | 53 | 24 | 43 | 19 | 41 | 19 | 36 | 7 | 0 | 3 | 16 |
14,056 | samuelcolvin/pydantic | pydantic/main.py | pydantic.main.BaseModel | from typing_extensions import Self, TypeAlias, Unpack
from .annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
from pydantic_core import PydanticUndefined, ValidationError
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, Generic, Literal, TypeVar, Union, cast, overload
from .json_schem... | null | 102 | 26 | 22 | 2 | 14 | 6 | 3 | 0.47 | 1 | 32 | 11 | 2 | 31 | 1 | 54 | 82 | 1,460 | 199 | 887 | 311 | 620 | 418 | 440 | 142 | 375 | 20 | 4 | 5 | 158 |
14,057 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.ModelConfigData | from typing import Any, Callable
class ModelConfigData:
"""Pydantic mypy plugin model config class."""
def __init__(self, forbid_extra: bool | None=None, frozen: bool | None=None, from_attributes: bool | None=None, populate_by_name: bool | None=None, validate_by_alias: bool | None=None, validate_by_name: bool... |
class ModelConfigData:
'''Pydantic mypy plugin model config class.'''
def __init__(self, forbid_extra: bool | None=None, frozen: bool | None=None, from_attributes: bool | None=None, populate_by_name: bool | None=None, validate_by_alias: bool | None=None, validate_by_name: bool | None=None, has_alias_generator... | 5 | 4 | 8 | 0 | 6 | 1 | 2 | 0.23 | 0 | 3 | 0 | 0 | 4 | 6 | 4 | 4 | 37 | 5 | 26 | 20 | 13 | 6 | 18 | 12 | 13 | 3 | 0 | 1 | 7 |
14,058 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.PydanticModelClassVar | from mypy.nodes import ARG_NAMED, ARG_NAMED_OPT, ARG_OPT, ARG_POS, ARG_STAR2, INVARIANT, MDEF, Argument, AssignmentStmt, Block, CallExpr, ClassDef, Context, Decorator, DictExpr, EllipsisExpr, Expression, FuncDef, IfStmt, JsonDict, MemberExpr, NameExpr, PassStmt, PlaceholderNode, RefExpr, Statement, StrExpr, SymbolTable... |
class PydanticModelClassVar:
'''Based on mypy.plugins.dataclasses.DataclassAttribute.
ClassVars are ignored by subclasses.
Attributes:
name: the ClassVar name
'''
def __init__(self, name):
pass
@classmethod
def deserialize(cls, data: JsonDict) -> PydanticModelClassVar:
... | 5 | 3 | 4 | 0 | 3 | 1 | 1 | 0.64 | 0 | 0 | 0 | 0 | 2 | 1 | 3 | 3 | 23 | 5 | 11 | 6 | 6 | 7 | 8 | 5 | 4 | 1 | 0 | 0 | 3 |
14,059 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.PydanticModelField | from mypy.plugin import CheckerPluginInterface, ClassDefContext, MethodContext, Plugin, ReportConfigContext, SemanticAnalyzerPluginInterface
from mypy.types import AnyType, CallableType, Instance, NoneType, Type, TypeOfAny, TypeType, TypeVarType, UnionType, get_proper_type
from mypy.state import state
from mypy.nodes i... |
class PydanticModelField:
'''Based on mypy.plugins.dataclasses.DataclassAttribute.'''
def __init__(self, name: str, alias: str | None, is_frozen: bool, has_dynamic_alias: bool, has_default: bool, strict: bool | None, line: int, column: int, type: Type | None, info: TypeInfo):
pass
def to_argument... | 9 | 7 | 18 | 1 | 15 | 3 | 3 | 0.19 | 0 | 3 | 0 | 0 | 6 | 10 | 7 | 7 | 138 | 12 | 106 | 60 | 67 | 20 | 56 | 29 | 48 | 8 | 0 | 5 | 20 |
14,060 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.PydanticModelTransformer | from mypy.typeops import map_type_from_supertype
from mypy.typevars import fill_typevars
from mypy.expandtype import expand_type, expand_type_by_instance
from mypy.nodes import ARG_NAMED, ARG_NAMED_OPT, ARG_OPT, ARG_POS, ARG_STAR2, INVARIANT, MDEF, Argument, AssignmentStmt, Block, CallExpr, ClassDef, Context, Decorator... |
class PydanticModelTransformer:
'''Transform the BaseModel subclass according to the plugin settings.
Attributes:
tracked_config_fields: A set of field configs that the plugin has to track their value.
'''
def __init__(self, cls: ClassDef, reason: Expression | Statement, api: SemanticAnalyzerP... | 26 | 18 | 34 | 3 | 24 | 8 | 7 | 0.31 | 0 | 15 | 4 | 0 | 15 | 4 | 20 | 20 | 725 | 91 | 493 | 147 | 439 | 154 | 339 | 114 | 318 | 24 | 0 | 5 | 137 |
14,061 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.PydanticPlugin | from mypy.nodes import ARG_NAMED, ARG_NAMED_OPT, ARG_OPT, ARG_POS, ARG_STAR2, INVARIANT, MDEF, Argument, AssignmentStmt, Block, CallExpr, ClassDef, Context, Decorator, DictExpr, EllipsisExpr, Expression, FuncDef, IfStmt, JsonDict, MemberExpr, NameExpr, PassStmt, PlaceholderNode, RefExpr, Statement, StrExpr, SymbolTable... |
class PydanticPlugin(Plugin):
'''The Pydantic mypy plugin.'''
def __init__(self, options: Options) -> None:
pass
def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:
'''Update Pydantic model class.'''
pass
def get_metaclass_hook(self, full... | 8 | 6 | 6 | 0 | 4 | 2 | 2 | 0.42 | 1 | 5 | 2 | 0 | 7 | 2 | 7 | 7 | 52 | 9 | 31 | 13 | 23 | 13 | 31 | 13 | 23 | 3 | 1 | 2 | 13 |
14,062 | samuelcolvin/pydantic | pydantic/mypy.py | pydantic.mypy.PydanticPluginConfig | from mypy.options import Options
from typing import Any, Callable
from configparser import ConfigParser
class PydanticPluginConfig:
"""A Pydantic mypy plugin config holder.
Attributes:
init_forbid_extra: Whether to add a `**kwargs` at the end of the generated `__init__` signature.
init_typed: ... |
class PydanticPluginConfig:
'''A Pydantic mypy plugin config holder.
Attributes:
init_forbid_extra: Whether to add a `**kwargs` at the end of the generated `__init__` signature.
init_typed: Whether to annotate fields in the generated `__init__`.
warn_required_dynamic_aliases: Whether to... | 3 | 2 | 11 | 1 | 10 | 1 | 4 | 0.37 | 0 | 5 | 0 | 0 | 2 | 0 | 2 | 2 | 44 | 5 | 30 | 9 | 27 | 11 | 24 | 9 | 21 | 6 | 0 | 3 | 7 |
14,063 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.AmqpDsn | class AmqpDsn(AnyUrl):
"""A type that will accept any AMQP DSN.
* User info required
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['amqp', 'amqps']) | class AmqpDsn(AnyUrl):
'''A type that will accept any AMQP DSN.
* User info required
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 9 | 2 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,064 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.AnyHttpUrl | class AnyHttpUrl(AnyUrl):
"""A type that will accept any http or https URL.
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['http', 'https']) | class AnyHttpUrl(AnyUrl):
'''A type that will accept any http or https URL.
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 8 | 2 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,065 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.AnyUrl | class AnyUrl(_BaseUrl):
"""Base type for all URLs.
* Any scheme allowed
* Top-level domain (TLD) not required
* Host not required
Assuming an input URL of `http://samuel:pass@example.com:8000/the/path/?query=here#fragment=is;this=bit`,
the types export the following properties:
- `scheme`... | class AnyUrl(_BaseUrl):
'''Base type for all URLs.
* Any scheme allowed
* Top-level domain (TLD) not required
* Host not required
Assuming an input URL of `http://samuel:pass@example.com:8000/the/path/?query=here#fragment=is;this=bit`,
the types export the following properties:
- `scheme`: t... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 15 | 1 | 0 | 0 | 14 | 0 | 0 | 0 | 26 | 19 | 3 | 1 | 1 | 0 | 15 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
14,066 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.AnyWebsocketUrl | class AnyWebsocketUrl(AnyUrl):
"""A type that will accept any ws or wss URL.
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['ws', 'wss']) | class AnyWebsocketUrl(AnyUrl):
'''A type that will accept any ws or wss URL.
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 8 | 2 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,067 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.ClickHouseDsn | class ClickHouseDsn(AnyUrl):
"""A type that will accept any ClickHouse DSN.
* User info required
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['clickhouse+native', 'clickhouse+asynch', 'clickhouse+http', 'clickhouse', 'clickhouses', 'clickhousedb'], d... | class ClickHouseDsn(AnyUrl):
'''A type that will accept any ClickHouse DSN.
* User info required
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.38 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 20 | 2 | 13 | 2 | 12 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,068 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.CockroachDsn | class CockroachDsn(AnyUrl):
"""A type that will accept any Cockroach DSN.
* User info required
* TLD not required
* Host required
"""
_constraints = UrlConstraints(host_required=True, allowed_schemes=['cockroachdb', 'cockroachdb+psycopg2', 'cockroachdb+asyncpg'])
@property
def host(sel... | class CockroachDsn(AnyUrl):
'''A type that will accept any Cockroach DSN.
* User info required
* TLD not required
* Host required
'''
@property
def host(self) -> str:
'''The required URL host.'''
pass | 3 | 2 | 3 | 0 | 2 | 2 | 1 | 0.58 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 27 | 21 | 3 | 12 | 4 | 9 | 7 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
14,069 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.FileUrl | class FileUrl(AnyUrl):
"""A type that will accept any file URL.
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['file']) | class FileUrl(AnyUrl):
'''A type that will accept any file URL.
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 7 | 2 | 2 | 2 | 1 | 3 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,070 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.FtpUrl | class FtpUrl(AnyUrl):
"""A type that will accept ftp URL.
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['ftp']) | class FtpUrl(AnyUrl):
'''A type that will accept ftp URL.
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 8 | 2 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,071 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.HttpUrl | class HttpUrl(AnyUrl):
"""A type that will accept any http or https URL.
* TLD not required
* Host not required
* Max length 2083
```python
from pydantic import BaseModel, HttpUrl, ValidationError
class MyModel(BaseModel):
url: HttpUrl
m = MyModel(url='http://www.example.com'... | class HttpUrl(AnyUrl):
'''A type that will accept any http or https URL.
* TLD not required
* Host not required
* Max length 2083
```python
from pydantic import BaseModel, HttpUrl, ValidationError
class MyModel(BaseModel):
url: HttpUrl
m = MyModel(url='http://www.example.com') #... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 29.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 79 | 18 | 2 | 2 | 1 | 59 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,072 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.KafkaDsn | class KafkaDsn(AnyUrl):
"""A type that will accept any Kafka DSN.
* User info required
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['kafka'], default_host='localhost', default_port=9092) | class KafkaDsn(AnyUrl):
'''A type that will accept any Kafka DSN.
* User info required
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 9 | 2 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,073 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.MariaDBDsn | class MariaDBDsn(AnyUrl):
"""A type that will accept any MariaDB DSN.
* User info required
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['mariadb', 'mariadb+mariadbconnector', 'mariadb+pymysql'], default_port=3306) | class MariaDBDsn(AnyUrl):
'''A type that will accept any MariaDB DSN.
* User info required
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 12 | 2 | 5 | 2 | 4 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,074 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.MongoDsn | class MongoDsn(_BaseMultiHostUrl):
"""A type that will accept any MongoDB DSN.
* User info not required
* Database name not required
* Port not required
* User info may be passed without user part (e.g., `mongodb://mongodb0.example.com:27017`).
"""
_constraints = UrlConstraints(allowed_sche... | class MongoDsn(_BaseMultiHostUrl):
'''A type that will accept any MongoDB DSN.
* User info not required
* Database name not required
* Port not required
* User info may be passed without user part (e.g., `mongodb://mongodb0.example.com:27017`).
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 10 | 2 | 2 | 2 | 1 | 6 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
14,075 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.MySQLDsn | class MySQLDsn(AnyUrl):
"""A type that will accept any MySQL DSN.
* User info required
* TLD not required
* Host not required
"""
_constraints = UrlConstraints(allowed_schemes=['mysql', 'mysql+mysqlconnector', 'mysql+aiomysql', 'mysql+asyncmy', 'mysql+mysqldb', 'mysql+pymysql', 'mysql+cymysql',... | class MySQLDsn(AnyUrl):
'''A type that will accept any MySQL DSN.
* User info required
* TLD not required
* Host not required
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 22 | 2 | 15 | 2 | 14 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,076 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.NameEmail | from typing_extensions import Self, TypeAlias
from pydantic_core import MultiHostHost, PydanticCustomError, PydanticSerializationUnexpectedValue, SchemaSerializer, core_schema
from .annotated_handlers import GetCoreSchemaHandler
from ._internal import _repr, _schema_generation_shared
from typing import TYPE_CHECKING, A... |
class NameEmail(_repr.Representation):
'''
Info:
To use this type, you need to install the optional
[`email-validator`](https://github.com/JoshData/python-email-validator) package:
```bash
pip install email-validator
```
Validate a name and email address combination,... | 10 | 1 | 7 | 0 | 7 | 0 | 1 | 0.61 | 1 | 3 | 0 | 0 | 3 | 2 | 6 | 14 | 87 | 16 | 44 | 21 | 28 | 27 | 23 | 12 | 16 | 2 | 1 | 1 | 8 |
14,077 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.NatsDsn | class NatsDsn(_BaseMultiHostUrl):
"""A type that will accept any NATS DSN.
NATS is a connective technology built for the ever increasingly hyper-connected world.
It is a single technology that enables applications to securely communicate across
any combination of cloud vendors, on-premise, edge, web an... | class NatsDsn(_BaseMultiHostUrl):
'''A type that will accept any NATS DSN.
NATS is a connective technology built for the ever increasingly hyper-connected world.
It is a single technology that enables applications to securely communicate across
any combination of cloud vendors, on-premise, edge, web and... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 12 | 2 | 4 | 2 | 3 | 6 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
14,078 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.PostgresDsn | class PostgresDsn(_BaseMultiHostUrl):
"""A type that will accept any Postgres DSN.
* User info required
* TLD not required
* Host required
* Supports multiple hosts
If further validation is required, these properties can be used by validators to enforce specific behaviour:
```python
f... | class PostgresDsn(_BaseMultiHostUrl):
'''A type that will accept any Postgres DSN.
* User info required
* TLD not required
* Host required
* Supports multiple hosts
If further validation is required, these properties can be used by validators to enforce specific behaviour:
```python
from... | 3 | 2 | 3 | 0 | 2 | 2 | 1 | 2.78 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 19 | 79 | 12 | 18 | 4 | 15 | 50 | 4 | 3 | 2 | 1 | 1 | 0 | 1 |
14,079 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.RedisDsn | class RedisDsn(AnyUrl):
"""A type that will accept any Redis DSN.
* User info required
* TLD not required
* Host required (e.g., `rediss://:pass@localhost`)
"""
_constraints = UrlConstraints(allowed_schemes=['redis', 'rediss'], default_host='localhost', default_port=6379, default_path='/0', hos... | class RedisDsn(AnyUrl):
'''A type that will accept any Redis DSN.
* User info required
* TLD not required
* Host required (e.g., `rediss://:pass@localhost`)
'''
@property
def host(self) -> str:
'''The required URL host.'''
pass | 3 | 2 | 3 | 0 | 2 | 2 | 1 | 0.64 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 27 | 20 | 3 | 11 | 4 | 8 | 7 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
14,080 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.SnowflakeDsn | class SnowflakeDsn(AnyUrl):
"""A type that will accept any Snowflake DSN.
* User info required
* TLD not required
* Host required
"""
_constraints = UrlConstraints(allowed_schemes=['snowflake'], host_required=True)
@property
def host(self) -> str:
"""The required URL host."""
... | class SnowflakeDsn(AnyUrl):
'''A type that will accept any Snowflake DSN.
* User info required
* TLD not required
* Host required
'''
@property
def host(self) -> str:
'''The required URL host.'''
pass | 3 | 2 | 3 | 0 | 2 | 2 | 1 | 0.88 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 27 | 17 | 3 | 8 | 4 | 5 | 7 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
14,081 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.UrlConstraints | from pydantic_core import MultiHostHost, PydanticCustomError, PydanticSerializationUnexpectedValue, SchemaSerializer, core_schema
from dataclasses import fields
from pydantic.errors import PydanticUserError
from typing import TYPE_CHECKING, Annotated, Any, ClassVar
import dataclasses as _dataclasses
from .annotated_han... | @_dataclasses.dataclass
class UrlConstraints:
'''Url constraints.
Attributes:
max_length: The maximum length of the url. Defaults to `None`.
allowed_schemes: The allowed schemes. Defaults to `None`.
host_required: Whether the host is required. Defaults to `None`.
default_host: Th... | 6 | 2 | 9 | 0 | 8 | 1 | 2 | 0.42 | 0 | 5 | 0 | 0 | 3 | 0 | 3 | 3 | 50 | 6 | 31 | 15 | 26 | 13 | 19 | 13 | 15 | 4 | 0 | 1 | 7 |
14,082 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks.WebsocketUrl | class WebsocketUrl(AnyUrl):
"""A type that will accept any ws or wss URL.
* TLD not required
* Host not required
* Max length 2083
"""
_constraints = UrlConstraints(max_length=2083, allowed_schemes=['ws', 'wss']) | class WebsocketUrl(AnyUrl):
'''A type that will accept any ws or wss URL.
* TLD not required
* Host not required
* Max length 2083
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 9 | 2 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
14,083 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks._BaseMultiHostUrl | from typing_extensions import Self, TypeAlias
from typing import TYPE_CHECKING, Annotated, Any, ClassVar
from pydantic_core import MultiHostUrl as _CoreMultiHostUrl
from pydantic_core import MultiHostHost, PydanticCustomError, PydanticSerializationUnexpectedValue, SchemaSerializer, core_schema
from .annotated_handlers ... | null | 29 | 10 | 8 | 1 | 5 | 3 | 1 | 0.5 | 0 | 8 | 0 | 3 | 14 | 0 | 18 | 18 | 177 | 30 | 98 | 49 | 54 | 49 | 54 | 25 | 34 | 3 | 0 | 1 | 24 |
14,084 | samuelcolvin/pydantic | pydantic/networks.py | pydantic.networks._BaseUrl | from typing_extensions import Self, TypeAlias
from ._internal import _repr, _schema_generation_shared
from typing import TYPE_CHECKING, Annotated, Any, ClassVar
from .json_schema import JsonSchemaValue
from pydantic_core import Url as _CoreUrl
from .annotated_handlers import GetCoreSchemaHandler
from pydantic_core impo... | null | 41 | 14 | 7 | 1 | 4 | 2 | 1 | 0.46 | 0 | 7 | 0 | 1 | 22 | 0 | 26 | 26 | 211 | 42 | 116 | 60 | 61 | 53 | 70 | 33 | 42 | 3 | 0 | 1 | 32 |
14,085 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.BaseValidateHandlerProtocol | from pydantic_core import CoreConfig, CoreSchema, ValidationError
from typing import Any, Callable, Literal, NamedTuple
from typing_extensions import Protocol, TypeAlias
class BaseValidateHandlerProtocol(Protocol):
"""Base class for plugin callbacks protocols.
You shouldn't implement this protocol directly, i... |
class BaseValidateHandlerProtocol(Protocol):
'''Base class for plugin callbacks protocols.
You shouldn't implement this protocol directly, instead use one of the subclasses with adds the correctly
typed `on_error` method.
'''
def on_success(self, result: Any) -> None:
'''Callback to be not... | 4 | 4 | 7 | 1 | 2 | 4 | 1 | 2.13 | 1 | 2 | 0 | 3 | 3 | 0 | 3 | 25 | 33 | 8 | 8 | 4 | 4 | 17 | 8 | 4 | 4 | 1 | 4 | 0 | 3 |
14,086 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.PydanticPluginProtocol | from typing import Any, Callable, Literal, NamedTuple
from pydantic_core import CoreConfig, CoreSchema, ValidationError
from typing_extensions import Protocol, TypeAlias
class PydanticPluginProtocol(Protocol):
"""Protocol defining the interface for Pydantic plugins."""
def new_schema_validator(self, schema: C... |
class PydanticPluginProtocol(Protocol):
'''Protocol defining the interface for Pydantic plugins.'''
def new_schema_validator(self, schema: CoreSchema, schema_type: Any, schema_type_path: SchemaTypePath, schema_kind: SchemaKind, config: CoreConfig | None, plugin_settings: dict[str, object]) -> tuple[ValidatePy... | 2 | 2 | 30 | 3 | 12 | 15 | 1 | 1.23 | 1 | 11 | 4 | 0 | 1 | 0 | 1 | 23 | 33 | 4 | 13 | 12 | 1 | 16 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
14,087 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.SchemaTypePath | from typing import Any, Callable, Literal, NamedTuple
class SchemaTypePath(NamedTuple):
"""Path defining where `schema_type` was defined, or where `TypeAdapter` was called."""
module: str
name: str |
class SchemaTypePath(NamedTuple):
'''Path defining where `schema_type` was defined, or where `TypeAdapter` was called.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
14,088 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.ValidateJsonHandlerProtocol | from typing_extensions import Protocol, TypeAlias
from typing import Any, Callable, Literal, NamedTuple
class ValidateJsonHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
"""Event handler for `SchemaValidator.validate_json`."""
def on_enter(self, input: str | bytes | bytearray, *, strict: bool | None=N... |
class ValidateJsonHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
'''Event handler for `SchemaValidator.validate_json`.'''
def on_enter(self, input: str | bytes | bytearray, *, strict: bool | None=None, context: dict[str, Any] | None=None, self_instance: Any | None=None, by_alias: bool | None=None, by... | 2 | 2 | 18 | 1 | 9 | 8 | 1 | 0.9 | 2 | 6 | 0 | 0 | 1 | 0 | 1 | 26 | 21 | 2 | 10 | 9 | 1 | 9 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,089 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.ValidatePythonHandlerProtocol | from typing import Any, Callable, Literal, NamedTuple
from typing_extensions import Protocol, TypeAlias
class ValidatePythonHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
"""Event handler for `SchemaValidator.validate_python`."""
def on_enter(self, input: Any, *, strict: bool | None=None, from_attrib... |
class ValidatePythonHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
'''Event handler for `SchemaValidator.validate_python`.'''
def on_enter(self, input: Any, *, strict: bool | None=None, from_attributes: bool | None=None, context: dict[str, Any] | None=None, self_instance: Any | None=None, by_alias: b... | 2 | 2 | 20 | 1 | 10 | 9 | 1 | 0.91 | 2 | 4 | 0 | 0 | 1 | 0 | 1 | 26 | 23 | 2 | 11 | 10 | 1 | 10 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,090 | samuelcolvin/pydantic | pydantic/plugin/__init__.py | pydantic.plugin.ValidateStringsHandlerProtocol | from typing import Any, Callable, Literal, NamedTuple
from typing_extensions import Protocol, TypeAlias
class ValidateStringsHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
"""Event handler for `SchemaValidator.validate_strings`."""
def on_enter(self, input: StringInput, *, strict: bool | None=None, c... |
class ValidateStringsHandlerProtocol(BaseValidateHandlerProtocol, Protocol):
'''Event handler for `SchemaValidator.validate_strings`.'''
def on_enter(self, input: StringInput, *, strict: bool | None=None, context: dict[str, Any] | None=None, by_alias: bool | None=None, by_name: bool | None=None) -> None:
... | 2 | 2 | 11 | 1 | 4 | 6 | 1 | 1.4 | 2 | 4 | 0 | 0 | 1 | 0 | 1 | 26 | 14 | 2 | 5 | 4 | 1 | 7 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
14,091 | samuelcolvin/pydantic | pydantic/root_model.py | pydantic.root_model.RootModel | from .main import BaseModel, _object_setattr
from . import PydanticUserError
from copy import copy, deepcopy
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar
from ._internal import _model_construction, _repr
from pydantic_core import PydanticUndefined
from typing_extensions import Self, dataclass_transf... |
class RootModel(BaseModel, Generic[RootModelRootType], metaclass=_RootModelMetaclass):
'''!!! abstract "Usage Documentation"
[`RootModel` and Custom Root Types](../concepts/models.md#rootmodel-and-custom-root-types)
A Pydantic `BaseModel` for the root object of the model.
Attributes:
root: ... | 12 | 5 | 9 | 1 | 6 | 3 | 1 | 0.52 | 3 | 8 | 1 | 0 | 9 | 1 | 10 | 92 | 123 | 23 | 69 | 36 | 43 | 36 | 46 | 20 | 35 | 3 | 5 | 2 | 14 |
14,092 | samuelcolvin/pydantic | pydantic/type_adapter.py | pydantic.type_adapter.TypeAdapter | from types import FrameType
from .errors import PydanticUndefinedAnnotation
from .json_schema import DEFAULT_REF_TEMPLATE, GenerateJsonSchema, JsonSchemaKeyT, JsonSchemaMode, JsonSchemaValue
from pydantic.errors import PydanticUserError
from collections.abc import Callable, Iterable
from typing import Any, Generic, Lit... | @final
class TypeAdapter(Generic[T]):
'''!!! abstract "Usage Documentation"
[`TypeAdapter`](../concepts/type_adapter.md)
Type adapters provide a flexible way to perform validation and serialization based on a Python type.
A `TypeAdapter` instance exposes some of the functionality from `BaseModel` in... | 24 | 11 | 29 | 3 | 17 | 9 | 2 | 0.8 | 1 | 20 | 7 | 0 | 16 | 4 | 17 | 17 | 617 | 87 | 295 | 151 | 169 | 236 | 117 | 41 | 99 | 7 | 1 | 3 | 39 |
14,093 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.AllowInfNan | import dataclasses as _dataclasses
from ._internal import _fields, _internal_dataclass, _utils, _validators
@_dataclasses.dataclass
class AllowInfNan(_fields.PydanticMetadata):
"""A field metadata class to indicate that a field should allow `-inf`, `inf`, and `nan`.
Use this class as an annotation via [`Annot... | @_dataclasses.dataclass
class AllowInfNan(_fields.PydanticMetadata):
'''A field metadata class to indicate that a field should allow `-inf`, `inf`, and `nan`.
Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.
Attributes:
... | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 2.75 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 9 | 22 | 7 | 4 | 3 | 2 | 11 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
14,094 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.Base64Encoder | from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
import base64
from typing import TYPE_CHECKING, Annotated, Any, Callable, ClassVar, Generic, Literal, TypeVar, Union, cast
class Base64Encoder(EncoderProtocol):
"""Standard (non-URL-safe) Base64 encoder."""
@classmethod
... |
class Base64Encoder(EncoderProtocol):
'''Standard (non-URL-safe) Base64 encoder.'''
@classmethod
def decode(cls, data: bytes) -> bytes:
'''Decode the data from base64 encoded bytes to original bytes data.
Args:
data: The data to decode.
Returns:
The decoded d... | 7 | 4 | 10 | 2 | 3 | 5 | 1 | 1.31 | 1 | 3 | 0 | 0 | 0 | 0 | 3 | 28 | 38 | 8 | 13 | 8 | 6 | 17 | 10 | 4 | 6 | 2 | 5 | 1 | 4 |
14,095 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.Base64UrlEncoder | import base64
from typing import TYPE_CHECKING, Annotated, Any, Callable, ClassVar, Generic, Literal, TypeVar, Union, cast
from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
class Base64UrlEncoder(EncoderProtocol):
"""URL-safe Base64 encoder."""
@classmethod
def decod... |
class Base64UrlEncoder(EncoderProtocol):
'''URL-safe Base64 encoder.'''
@classmethod
def decode(cls, data: bytes) -> bytes:
'''Decode the data from base64 encoded bytes to original bytes data.
Args:
data: The data to decode.
Returns:
The decoded data.
... | 7 | 4 | 10 | 2 | 3 | 5 | 1 | 1.31 | 1 | 3 | 0 | 0 | 0 | 0 | 3 | 28 | 38 | 8 | 13 | 8 | 6 | 17 | 10 | 4 | 6 | 2 | 5 | 1 | 4 |
14,096 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.ByteSize | from typing import TYPE_CHECKING, Annotated, Any, Callable, ClassVar, Generic, Literal, TypeVar, Union, cast
import re
from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
from .annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
class ByteSize(int):
"""Converts... |
class ByteSize(int):
'''Converts a string representing a number of bytes with units (such as `'1KB'` or `'11.5MiB'`) into an integer.
You can use the `ByteSize` data type to (case-insensitively) convert a string representation of a number of bytes into
an integer, and also to print out human-readable strin... | 7 | 3 | 21 | 3 | 14 | 4 | 3 | 0.49 | 1 | 7 | 1 | 0 | 2 | 0 | 4 | 59 | 158 | 25 | 89 | 19 | 82 | 44 | 45 | 17 | 40 | 5 | 2 | 3 | 13 |
14,097 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.Discriminator | from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
from typing import TYPE_CHECKING, Annotated, Any, Callable, ClassVar, Generic, Literal, TypeVar, Union, cast
from typing_extensions import Protocol, TypeAlias, TypeAliasType, deprecated, get_args, get_origin
from typing_inspection.... | @_dataclasses.dataclass(**_internal_dataclass.slots_true, frozen=True)
class Discriminator:
'''!!! abstract "Usage Documentation"
[Discriminated Unions with `Callable` `Discriminator`](../concepts/unions.md#discriminated-unions-with-callable-discriminator)
Provides a way to use a custom callable as the ... | 4 | 1 | 30 | 4 | 24 | 3 | 7 | 1.32 | 0 | 6 | 2 | 0 | 2 | 0 | 2 | 2 | 148 | 25 | 53 | 16 | 49 | 70 | 39 | 16 | 35 | 10 | 0 | 2 | 13 |
14,098 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.EncodedBytes | from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
import dataclasses as _dataclasses
from .json_schema import JsonSchemaValue
from .annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
from ._internal import _fields, _internal_dataclass, _utils, _validators
from ty... | @_dataclasses.dataclass(**_internal_dataclass.slots_true)
class EncodedBytes:
'''A bytes type that is encoded and decoded using the specified encoder.
`EncodedBytes` needs an encoder that implements `EncoderProtocol` to operate.
```python
from typing import Annotated
from pydantic import BaseModel, ... | 7 | 3 | 7 | 1 | 4 | 2 | 1 | 2.36 | 0 | 5 | 2 | 0 | 5 | 0 | 5 | 5 | 96 | 22 | 22 | 10 | 14 | 52 | 16 | 8 | 10 | 1 | 0 | 0 | 5 |
14,099 | samuelcolvin/pydantic | pydantic/types.py | pydantic.types.EncodedStr | from ._internal import _fields, _internal_dataclass, _utils, _validators
from .annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
import dataclasses as _dataclasses
from pydantic_core import CoreSchema, PydanticCustomError, SchemaSerializer, core_schema
from .json_schema import JsonSchemaValue
from ty... | @_dataclasses.dataclass(**_internal_dataclass.slots_true)
class EncodedStr:
'''A str type that is encoded and decoded using the specified encoder.
`EncodedStr` needs an encoder that implements `EncoderProtocol` to operate.
```python
from typing import Annotated
from pydantic import BaseModel, Encode... | 7 | 3 | 7 | 1 | 4 | 3 | 1 | 2.41 | 0 | 5 | 2 | 0 | 5 | 0 | 5 | 5 | 96 | 22 | 22 | 10 | 14 | 53 | 16 | 8 | 10 | 1 | 0 | 0 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.