brk-code

pydantic の API リファレンス

pydantic (pydantic/pydantic) の公開 API 300 件 —— クラス 120、関数 97、メソッド 83。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: pydantic/pydantic

種別件数
クラス120
関数97
メソッド83

API 一覧

class.github.actions.people.people.Author
Represents a GitHub user with their basic information.
class.github.actions.people.people.Comments
Container for comment nodes.
class.github.actions.people.people.Discussions
Container for discussion edges.
class.github.actions.people.people.DiscussionsComments
Container for discussion comment nodes.
class.github.actions.people.people.DiscussionsResponse
Complete response structure for discussions query.
class.github.actions.people.people.DiscussionsResponseData
Top-level container for discussions response data.
class.github.actions.people.people.Issues
Container for issue edges.
class.github.actions.people.people.IssuesEdge
Represents an edge in the GitHub GraphQL issues query.
class.github.actions.people.people.IssuesNode
Represents a GitHub issue with its metadata and comments.
class.github.actions.people.people.IssuesResponse
Complete response structure for issues query.
class.github.actions.people.people.IssuesResponseData
Top-level container for issues response data.
class.github.actions.people.people.LabelNode
Represents a GitHub label.
class.github.actions.people.people.Labels
Container for label nodes.
class.github.actions.people.people.PRsResponse
Complete response structure for pull requests query.
class.github.actions.people.people.PRsResponseData
Top-level container for pull requests response data.
class.github.actions.people.people.PullRequests
Container for pull request edges.
class.github.actions.people.people.Replies
Container for reply nodes in a discussion.
class.github.actions.people.people.ReviewNode
Represents a pull request review with author and state.
class.github.actions.people.people.Reviews
Container for review nodes.
class.github.actions.people.people.Settings
Configuration settings for the GitHub API interaction.
func.github.actions.people.people.get_discussions_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]
Analyze discussions to identify expert contributors.
func.github.actions.people.people.get_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]
Get combined expert contributors from discussions.
func.github.actions.people.people.get_graphql_issue_edges(*settings:Settings, *after:str | None=None) -> list[IssuesEdge]
Fetch issue edges from GitHub GraphQL API.
func.github.actions.people.people.get_graphql_pr_edges(*settings:Settings, *after:str | None=None) -> list[PullRequestEdge]
Fetch pull request edges from GitHub GraphQL API.
func.github.actions.people.people.get_graphql_question_discussion_edges(*settings:Settings, *after:str | None=None) -> list[DiscussionsEdge]
Fetch discussion edges from GitHub GraphQL API.
func.github.actions.people.people.get_graphql_response(*settings:Settings, *query:str, *after:str | None=None) -> dict[str, Any]
Make a GraphQL request to GitHub API.
func.github.actions.people.people.get_issues_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]
Analyze issues to identify expert contributors.
classpydantic-core.python.pydantic_core.ErrorTypeInfo
Gives information about errors.
classpydantic-core.python.pydantic_core.MultiHostHost
A host part of a multi-host URL.
classpydantic-core.python.pydantic_core.core_schema.CoreConfig
Base class for schema configuration options.
classpydantic-core.python.pydantic_core.core_schema.FieldSerializationInfo
Extra data used during field serialization.
classpydantic-core.python.pydantic_core.core_schema.SerializationInfo
Extra data used during serialization.
methodpydantic-core.python.pydantic_core.core_schema.SerializationInfo.context() -> ContextT
The current serialization context.
classpydantic-core.python.pydantic_core.core_schema.ValidationInfo
Extra data used during validation.
methodpydantic-core.python.pydantic_core.core_schema.ValidationInfo.context() -> ContextT
The current validation context.
methodpydantic-core.python.pydantic_core.core_schema.ValidationInfo.data() -> dict[str, Any]
The data being validated for this model.
funcpydantic-core.python.pydantic_core.core_schema.iter_union_choices(union_schema:UnionSchema) -> Generator[CoreSchema]
Iterate over the choices of a `'union'` schema.
funcpydantic-core.python.pydantic_core.core_schema.model_ser_schema(cls:type[Any], schema:CoreSchema) -> ModelSerSchema
Returns a schema for serialization using a model.
classpydantic._internal._config.ConfigWrapperStack
A stack of `ConfigWrapper` instances.
funcpydantic._internal._config.check_deprecated(config_dict:ConfigDict) -> None
Check for deprecated config keys and warn the user.
funcpydantic._internal._core_utils.get_ref(s:core_schema.CoreSchema) -> None | str
Get the ref from the schema if it has one.
funcpydantic._internal._dataclasses.set_dataclass_fields(cls:type[StandardDataclass], config_wrapper:_config.ConfigWrapper, ns_resolver:NsResolver | None=None) -> None
Collect and set `cls.__pydantic_fields__`.
methodpydantic._internal._decorators.Decorator.bind_to_cls(cls:Any) -> Decorator[DecoratorInfoType]
Bind the decorator to a class.
methodpydantic._internal._decorators.Decorator.build(cls_:Any, *cls_var_name:str, *shim:Callable[[Any], Any] | None, *info:DecoratorInfoType) -> Decorator[DecoratorInfoType]
Build a new decorator.
funcpydantic._internal._decorators.ensure_classmethod_based_on_signature(function:AnyDecoratorCallable) -> Any
Apply the `@classmethod` decorator on the function.
funcpydantic._internal._decorators.get_attribute_from_base_dicts(tp:type[Any], name:str) -> Any
Get an attribute out of the `__dict__` following the MRO.
funcpydantic._internal._decorators.get_bases(tp:type[Any]) -> tuple[type[Any], ...]
Get the base classes of a class or typeddict.
funcpydantic._internal._decorators.get_callable_return_type(callable_obj:Any, globalns:GlobalsNamespace | None=None, localns:MappingNamespace | None=None) -> Any | PydanticUndefinedType
Get the callable return type.
funcpydantic._internal._decorators.is_instance_method_from_sig(function:AnyDecoratorCallable) -> bool
Whether the function is an instance method.
funcpydantic._internal._decorators.mro(tp:type[Any]) -> tuple[type[Any], ...]
Calculate the Method Resolution Order of bases using the C3 algorithm.
classpydantic._internal._decorators_v1.V2CoreAfterRootValidator
V2 validator with mode='after'.
classpydantic._internal._decorators_v1.V2CoreBeforeRootValidator
V2 validator with mode='before'.
classpydantic._internal._fields.PydanticMetadata
Base class for annotation markers like `Strict`.
funcpydantic._internal._fields.collect_dataclass_fields(cls:type[StandardDataclass], *config_wrapper:ConfigWrapper, *ns_resolver:NsResolver | None=None, *typevars_map:dict[Any, Any] | None=None) -> dict[str, FieldInfo]
Collect the fields of a dataclass.
classpydantic._internal._generate_schema.InvalidSchemaError
The core schema is invalid.
funcpydantic._internal._generate_schema.check_validator_fields_against_field_name(info:FieldDecoratorInfo, field:str) -> bool
Check if field name is in validator fields.
funcpydantic._internal._git.git_revision(dir:Path) -> str
Get the SHA-1 of the HEAD of a git repository.
funcpydantic._internal._git.have_git() -> bool
Can we run the git executable?
funcpydantic._internal._git.is_git_repo(dir:Path) -> bool
Is the given directory version-controlled with git?
funcpydantic._internal._known_annotated_metadata.expand_grouped_metadata(annotations:Iterable[Any]) -> Iterable[Any]
Expand the annotations.
funcpydantic._internal._model_construction.NoInitField(*init:Literal[False]=False) -> Any
Only for typing purposes.
funcpydantic._internal._model_construction.set_deprecated_descriptors(cls:type[BaseModel]) -> None
Set data descriptors on the class for deprecated fields.
funcpydantic._internal._namespace_utils.get_module_ns_of(obj:Any) -> dict[str, Any]
Get the namespace of the module where the object is defined.
classpydantic._internal._repr.PlainRepr
String class where repr doesn't include quotes.
classpydantic._internal._schema_gather.GatherContext
The current context used during core schema traversing.
classpydantic._internal._schema_gather.GatherResult
Schema traversing result.
funcpydantic._internal._typing_extra.annotated_type(tp:Any) -> Any | None
Return the type of the `Annotated` special form, or `None`.
funcpydantic._internal._typing_extra.is_annotated(tp:Any) -> bool
Return whether the provided argument is a `Annotated` special form.
funcpydantic._internal._typing_extra.is_namedtuple(tp:Any) -> bool
Return whether the provided argument is a named tuple class.
funcpydantic._internal._typing_extra.unpack_type(tp:Any) -> Any | None
Return the type wrapped by the `Unpack` special form, or `None`.
funcpydantic._internal._utils.can_be_positional(param:Parameter) -> bool
Return whether the parameter accepts a positional argument.
funcpydantic._internal._utils.unique_list(input_list:list[T] | tuple[T, ...], *name_factory:Callable[[T], str]=str) -> list[T]
Make a list unique while maintaining order.
funcpydantic._internal._validate_call.extract_function_name(func:ValidateCallSupportedTypes) -> str
Extract the name of a `ValidateCallSupportedTypes` object.
funcpydantic._migration.wrapper(name:str) -> object
Raise an error if the object is not found, or warn if it was moved.
funcpydantic.alias_generators.to_camel(snake:str) -> str
Convert a snake_case string to camelCase.
funcpydantic.alias_generators.to_pascal(snake:str) -> str
Convert a snake_case string to PascalCase.
funcpydantic.alias_generators.to_snake(camel:str) -> str
Convert a PascalCase, camelCase, or kebab-case string to snake_case.
classpydantic.aliases.AliasChoices
!!!
classpydantic.aliases.AliasGenerator
!!!
classpydantic.aliases.AliasPath
!!!
methodpydantic.aliases.AliasPath.search_dict_for_path(d:dict) -> Any
Searches a dictionary for the path specified by the alias.
classpydantic.color.Color
Represents a color.
methodpydantic.color.Color.as_hex() -> str
Returns the hexadecimal representation of the color.
methodpydantic.color.Color.as_hsl_tuple(*alpha:bool | None=None) -> HslColorTuple
Returns the color as an HSL or HSLA tuple.
methodpydantic.color.Color.as_rgb_tuple(*alpha:bool | None=None) -> ColorTuple
Returns the color as an RGB or RGBA tuple.
methodpydantic.color.Color.original() -> ColorType
Original value passed to `Color`.
classpydantic.color.RGBA
Internal use only as a representation of a color.
funcpydantic.color.parse_color_value(value:int | str, max_val:int=255) -> float
Parse the color value provided and return a number between 0 and 1.
funcpydantic.color.parse_str(value:str) -> RGBA
Parse a string representing a color to an RGBA tuple.
funcpydantic.color.parse_tuple(value:tuple[Any, ...]) -> RGBA
Parse a tuple or list to get RGBA values.
classpydantic.config.ConfigDict
A TypedDict for configuring Pydantic behaviour.
funcpydantic.dataclasses.create_dataclass(cls:type[Any]) -> type[PydanticDataclass]
Create a Pydantic dataclass from a regular dataclass.
funcpydantic.dataclasses.is_pydantic_dataclass(class_:type[Any]) -> TypeGuard[type[PydanticDataclass]]
Whether a class is a pydantic dataclass.
classpydantic.deprecated.config.BaseConfig
This class is only retained for backwards compatibility.
funcpydantic.deprecated.json.timedelta_isoformat(td:datetime.timedelta) -> str
ISO 8601 encoding for Python timedelta object.
classpydantic.errors.PydanticErrorMixin
A mixin class for common functionality shared by all Pydantic-specific errors.
classpydantic.errors.PydanticUserError
An error raised due to incorrect use of Pydantic.
classpydantic.fields.FieldInfo
This class holds information about a field.
methodpydantic.fields.FieldInfo.apply_typevars_map(typevars_map:Mapping[TypeVar, Any] | None, globalns:GlobalsNamespace | None=None, localns:MappingNamespace | None=None) -> None
Apply a `typevars_map` to the annotation.
classpydantic.fields.ModelPrivateAttr
A descriptor for private attributes in class models.
classpydantic.functional_validators.AfterValidator
!!!
classpydantic.functional_validators.BeforeValidator
!!!
classpydantic.functional_validators.FreeModelBeforeValidator
A `@model_validator` decorated function signature.
classpydantic.functional_validators.ModelBeforeValidator
A `@model_validator` decorated function signature.
classpydantic.functional_validators.ModelBeforeValidatorWithoutInfo
A `@model_validator` decorated function signature.
classpydantic.functional_validators.ModelWrapValidator
A `@model_validator` decorated function signature.
classpydantic.functional_validators.ModelWrapValidatorWithoutInfo
A `@model_validator` decorated function signature.
classpydantic.functional_validators.PlainValidator
!!!
classpydantic.functional_validators.WrapValidator
!!!
classpydantic.json_schema.Examples
Add examples to a JSON schema.
classpydantic.json_schema.GenerateJsonSchema
!!!
methodpydantic.json_schema.GenerateJsonSchema.any_schema(schema:core_schema.AnySchema) -> JsonSchemaValue
Generates a JSON schema that matches any value.
methodpydantic.json_schema.GenerateJsonSchema.bool_schema(schema:core_schema.BoolSchema) -> JsonSchemaValue
Generates a JSON schema that matches a bool value.
methodpydantic.json_schema.GenerateJsonSchema.bytes_schema(schema:core_schema.BytesSchema) -> JsonSchemaValue
Generates a JSON schema that matches a bytes value.
methodpydantic.json_schema.GenerateJsonSchema.callable_schema(schema:core_schema.CallableSchema) -> JsonSchemaValue
Generates a JSON schema that matches a callable value.
methodpydantic.json_schema.GenerateJsonSchema.complex_schema(schema:core_schema.ComplexSchema) -> JsonSchemaValue
Generates a JSON schema that matches a complex number.
methodpydantic.json_schema.GenerateJsonSchema.date_schema(schema:core_schema.DateSchema) -> JsonSchemaValue
Generates a JSON schema that matches a date value.
methodpydantic.json_schema.GenerateJsonSchema.datetime_schema(schema:core_schema.DatetimeSchema) -> JsonSchemaValue
Generates a JSON schema that matches a datetime value.
methodpydantic.json_schema.GenerateJsonSchema.decimal_schema(schema:core_schema.DecimalSchema) -> JsonSchemaValue
Generates a JSON schema that matches a decimal value.
methodpydantic.json_schema.GenerateJsonSchema.dict_schema(schema:core_schema.DictSchema) -> JsonSchemaValue
Generates a JSON schema that matches a dict schema.
methodpydantic.json_schema.GenerateJsonSchema.encode_default(dft:Any) -> Any
Encode a default value to a JSON-serializable value.
methodpydantic.json_schema.GenerateJsonSchema.enum_schema(schema:core_schema.EnumSchema) -> JsonSchemaValue
Generates a JSON schema that matches an Enum value.
methodpydantic.json_schema.GenerateJsonSchema.float_schema(schema:core_schema.FloatSchema) -> JsonSchemaValue
Generates a JSON schema that matches a float value.
methodpydantic.json_schema.GenerateJsonSchema.fraction_schema(schema:core_schema.FractionSchema) -> JsonSchemaValue
Generates a JSON schema that matches a fraction value.
methodpydantic.json_schema.GenerateJsonSchema.generate_inner(schema:CoreSchemaOrField) -> JsonSchemaValue
Generates a JSON schema for a given core schema.
methodpydantic.json_schema.GenerateJsonSchema.get_argument_name(argument:core_schema.ArgumentsParameter | core_schema.ArgumentsV3Parameter) -> str
Retrieves the name of an argument.
methodpydantic.json_schema.GenerateJsonSchema.get_title_from_name(name:str) -> str
Retrieves a title from a name.
funcpydantic.json_schema.GenerateJsonSchema.handler_func(schema_or_field:CoreSchemaOrField) -> JsonSchemaValue
Generate a JSON schema based on the input schema.
methodpydantic.json_schema.GenerateJsonSchema.int_schema(schema:core_schema.IntSchema) -> JsonSchemaValue
Generates a JSON schema that matches an int value.
methodpydantic.json_schema.GenerateJsonSchema.invalid_schema(schema:core_schema.InvalidSchema) -> JsonSchemaValue
Placeholder - should never be called.
methodpydantic.json_schema.GenerateJsonSchema.list_schema(schema:core_schema.ListSchema) -> JsonSchemaValue
Returns a schema that matches a list schema.
methodpydantic.json_schema.GenerateJsonSchema.literal_schema(schema:core_schema.LiteralSchema) -> JsonSchemaValue
Generates a JSON schema that matches a literal value.
methodpydantic.json_schema.GenerateJsonSchema.none_schema(schema:core_schema.NoneSchema) -> JsonSchemaValue
Generates a JSON schema that matches `None`.
methodpydantic.json_schema.GenerateJsonSchema.normalize_name(name:str) -> str
Normalizes a name to be used as a key in a dictionary.
methodpydantic.json_schema.GenerateJsonSchema.set_schema(schema:core_schema.SetSchema) -> JsonSchemaValue
Generates a JSON schema that matches a set schema.
methodpydantic.json_schema.GenerateJsonSchema.str_schema(schema:core_schema.StringSchema) -> JsonSchemaValue
Generates a JSON schema that matches a string value.
methodpydantic.json_schema.GenerateJsonSchema.time_schema(schema:core_schema.TimeSchema) -> JsonSchemaValue
Generates a JSON schema that matches a time value.
methodpydantic.json_schema.GenerateJsonSchema.tuple_positional_schema(schema:core_schema.TupleSchema) -> JsonSchemaValue
Replaced by `tuple_schema`.
methodpydantic.json_schema.GenerateJsonSchema.tuple_schema(schema:core_schema.TupleSchema) -> JsonSchemaValue
Generates a JSON schema that matches a tuple schema e.g.
methodpydantic.json_schema.GenerateJsonSchema.tuple_variable_schema(schema:core_schema.TupleSchema) -> JsonSchemaValue
Replaced by `tuple_schema`.
methodpydantic.json_schema.GenerateJsonSchema.uuid_schema(schema:core_schema.UuidSchema) -> JsonSchemaValue
Generates a JSON schema that matches a UUID.
classpydantic.json_schema.SkipJsonSchema
!!!
classpydantic.json_schema.WithJsonSchema
!!!
classpydantic.main.BaseModel
!!!
methodpydantic.main.BaseModel.copy(*include:AbstractSetIntStr | MappingIntStrAny | None=None, *exclude:AbstractSetIntStr | MappingIntStrAny | None=None, *update:Dict[str, Any] | None=None, *deep:bool=False) -> Self
Returns a copy of the model.
methodpydantic.main.BaseModel.model_construct(_fields_set:set[str] | None=None, **values:Any) -> Self
Creates a new instance of the `Model` class with validated data.
methodpydantic.main.BaseModel.model_copy(*update:Mapping[str, Any] | None=None, *deep:bool=False) -> Self
!!!
methodpydantic.main.BaseModel.model_extra() -> dict[str, Any] | None
Get extra fields set during validation.
methodpydantic.main.BaseModel.model_parametrized_name(params:tuple[type[Any], ...]) -> str
Compute the class name for parametrizations of generic classes.
methodpydantic.main.BaseModel.model_validate(obj:Any, *strict:bool | None=None, *extra:ExtraValues | None=None, *from_attributes:bool | None=None, *context:Any | None=None, *by_alias:bool | None=None, *by_name:bool | None=None) -> Self
Validate a pydantic model instance.
methodpydantic.main.BaseModel.model_validate_json(json_data:str | bytes | bytearray, *strict:bool | None=None, *extra:ExtraValues | None=None, *context:Any | None=None, *by_alias:bool | None=None, *by_name:bool | None=None) -> Self
!!!
classpydantic.mypy.ModelConfigData
Pydantic mypy plugin model config class.
methodpydantic.mypy.ModelConfigData.get_values_dict() -> dict[str, Any]
Returns a dict of Pydantic model config names to their values.
methodpydantic.mypy.ModelConfigData.update(config:ModelConfigData | None) -> None
Update Pydantic model config values.
classpydantic.mypy.PydanticModelClassVar
Based on mypy.plugins.dataclasses.DataclassAttribute.
classpydantic.mypy.PydanticModelField
Based on mypy.plugins.dataclasses.DataclassAttribute.
classpydantic.mypy.PydanticPlugin
The Pydantic mypy plugin.
methodpydantic.mypy.PydanticPlugin.get_base_class_hook(fullname:str) -> Callable[[ClassDefContext], None] | None
Update Pydantic model class.
methodpydantic.mypy.PydanticPlugin.get_metaclass_hook(fullname:str) -> Callable[[ClassDefContext], None] | None
Update Pydantic `ModelMetaclass` definition.
methodpydantic.mypy.PydanticPlugin.get_method_hook(fullname:str) -> Callable[[MethodContext], Type] | None
Adjust return type of `from_orm` method call.
methodpydantic.mypy.PydanticPlugin.report_config_data(ctx:ReportConfigContext) -> dict[str, Any]
Return all plugin config data.
classpydantic.mypy.PydanticPluginConfig
A Pydantic mypy plugin config holder.
methodpydantic.mypy.PydanticPluginConfig.to_data() -> dict[str, Any]
Returns a dict of config names to their values.
funcpydantic.mypy.error_invalid_config_value(name:str, api:SemanticAnalyzerPluginInterface, context:Context) -> None
Emits an error when the config value is invalid.
funcpydantic.mypy.error_required_dynamic_aliases(api:SemanticAnalyzerPluginInterface, context:Context) -> None
Emits required dynamic aliases error.
funcpydantic.mypy.error_unexpected_behavior(detail:str, api:CheckerPluginInterface | SemanticAnalyzerPluginInterface, context:Context) -> None
Emits unexpected behavior error.
funcpydantic.mypy.error_untyped_fields(api:SemanticAnalyzerPluginInterface, context:Context) -> None
Emits an error when there is an untyped field in the model.
funcpydantic.mypy.from_attributes_callback(ctx:MethodContext) -> Type
Raise an error if from_attributes is not enabled.
funcpydantic.mypy.parse_toml(config_file:str) -> dict[str, Any] | None
Returns a dict of config keys to values.
funcpydantic.mypy.plugin(version:str) -> type[Plugin]
`version` is the mypy version string.
classpydantic.networks.AmqpDsn
A type that will accept any AMQP DSN.
classpydantic.networks.AnyHttpUrl
A type that will accept any http or https URL.
classpydantic.networks.AnyUrl
Base type for all URLs.
classpydantic.networks.AnyWebsocketUrl
A type that will accept any ws or wss URL.
classpydantic.networks.ClickHouseDsn
A type that will accept any ClickHouse DSN.
classpydantic.networks.CockroachDsn
A type that will accept any Cockroach DSN.
methodpydantic.networks.CockroachDsn.host() -> str
The required URL host.
classpydantic.networks.FileUrl
A type that will accept any file URL.
classpydantic.networks.FtpUrl
A type that will accept ftp URL.
classpydantic.networks.HttpUrl
A type that will accept any http or https URL.
classpydantic.networks.IPvAnyAddress
Validate an IPv4 or IPv6 address.
classpydantic.networks.IPvAnyInterface
Validate an IPv4 or IPv6 interface.
classpydantic.networks.IPvAnyNetwork
Validate an IPv4 or IPv6 network.
classpydantic.networks.KafkaDsn
A type that will accept any Kafka DSN.
classpydantic.networks.MariaDBDsn
A type that will accept any MariaDB DSN.
classpydantic.networks.MongoDsn
A type that will accept any MongoDB DSN.
classpydantic.networks.MySQLDsn
A type that will accept any MySQL DSN.
classpydantic.networks.NatsDsn
A type that will accept any NATS DSN.
classpydantic.networks.PostgresDsn
A type that will accept any Postgres DSN.
methodpydantic.networks.PostgresDsn.host() -> str
The required URL host.
classpydantic.networks.RedisDsn
A type that will accept any Redis DSN.
methodpydantic.networks.RedisDsn.host() -> str
The required URL host.
classpydantic.networks.SnowflakeDsn
A type that will accept any Snowflake DSN.
methodpydantic.networks.SnowflakeDsn.host() -> str
The required URL host.
classpydantic.networks.UrlConstraints
Url constraints.
classpydantic.networks.WebsocketUrl
A type that will accept any ws or wss URL.
classpydantic.plugin.BaseValidateHandlerProtocol
Base class for plugin callbacks protocols.
methodpydantic.plugin.BaseValidateHandlerProtocol.on_error(error:ValidationError) -> None
Callback to be notified of validation errors.
methodpydantic.plugin.BaseValidateHandlerProtocol.on_exception(exception:Exception) -> None
Callback to be notified of validation exceptions.
methodpydantic.plugin.BaseValidateHandlerProtocol.on_success(result:Any) -> None
Callback to be notified of successful validation.
classpydantic.plugin.PydanticPluginProtocol
Protocol defining the interface for Pydantic plugins.
classpydantic.plugin.ValidateJsonHandlerProtocol
Event handler for `SchemaValidator.validate_json`.
classpydantic.plugin.ValidatePythonHandlerProtocol
Event handler for `SchemaValidator.validate_python`.
classpydantic.plugin.ValidateStringsHandlerProtocol
Event handler for `SchemaValidator.validate_strings`.
funcpydantic.plugin._loader.get_plugins() -> Iterable[PydanticPluginProtocol]
Load plugins for Pydantic.
classpydantic.plugin._schema_validator.PluggableSchemaValidator
Pluggable schema validator.
classpydantic.root_model.RootModel
!!!
classpydantic.type_adapter.TypeAdapter
!!!
methodpydantic.type_adapter.TypeAdapter.get_default_value(*strict:bool | None=None, *context:Any | None=None) -> Some[T] | None
Get the default value for the wrapped type.
methodpydantic.type_adapter.TypeAdapter.validate_json(data:str | bytes | bytearray, *strict:bool | None=None, *extra:ExtraValues | None=None, *context:Any | None=None, *experimental_allow_partial:bool | Literal['off', 'on', 'trailing-strings']=False, *by_alias:bool | None=None, *by_name:bool | None=None) -> T
!!!
classpydantic.types.AwareDatetime
A datetime that requires timezone info.
classpydantic.types.Base64Encoder
Standard (non-URL-safe) Base64 encoder.
methodpydantic.types.Base64Encoder.decode(data:bytes) -> bytes
Decode the data from base64 encoded bytes to original bytes data.
methodpydantic.types.Base64Encoder.encode(value:bytes) -> bytes
Encode the data from bytes to a base64 encoded bytes.
methodpydantic.types.Base64Encoder.get_json_format() -> Literal['base64']
Get the JSON format for the encoded data.
classpydantic.types.Base64UrlEncoder
URL-safe Base64 encoder.
methodpydantic.types.Base64UrlEncoder.decode(data:bytes) -> bytes
Decode the data from base64 encoded bytes to original bytes data.
methodpydantic.types.Base64UrlEncoder.encode(value:bytes) -> bytes
Encode the data from bytes to a base64 encoded bytes.
methodpydantic.types.Base64UrlEncoder.get_json_format() -> Literal['base64url']
Get the JSON format for the encoded data.
classpydantic.types.Discriminator
!!!
classpydantic.types.EncoderProtocol
Protocol for encoding and decoding data to and from bytes.
methodpydantic.types.EncoderProtocol.decode(data:bytes) -> bytes
Decode the data using the encoder.
methodpydantic.types.EncoderProtocol.encode(value:bytes) -> bytes
Encode the data using the encoder.
methodpydantic.types.EncoderProtocol.get_json_format() -> str
Get the JSON format for the encoded data.
classpydantic.types.FutureDate
A date in the future.
classpydantic.types.FutureDatetime
A datetime that must be in the future.
classpydantic.types.GetPydanticSchema
!!!
classpydantic.types.Json
A special type wrapper which loads JSON before parsing.
classpydantic.types.NaiveDatetime
A datetime that doesn't require timezone info.
classpydantic.types.PastDate
A date in the past.
classpydantic.types.PastDatetime
A datetime that must be in the past.
classpydantic.types.PaymentCardNumber
Based on: https://en.wikipedia.org/wiki/Payment_card_number.
methodpydantic.types.PaymentCardNumber.masked() -> str
Mask all but the last 4 digits of the card number.
methodpydantic.types.PaymentCardNumber.validate_digits(card_number:str) -> None
Validate that the card number is all digits.
methodpydantic.types.PaymentCardNumber.validate_luhn_check_digit(card_number:str) -> str
Based on: https://en.wikipedia.org/wiki/Luhn_algorithm.
classpydantic.types.Strict
!!!
classpydantic.types.StringConstraints
!!!
funcpydantic.types.condate(*strict:bool | None=None, *gt:date | None=None, *ge:date | None=None, *lt:date | None=None, *le:date | None=None) -> type[date]
A wrapper for date that adds constraints.
funcpydantic.types.condecimal(*strict:bool | None=None, *gt:int | Decimal | None=None, *ge:int | Decimal | None=None, *lt:int | Decimal | None=None, *le:int | Decimal | None=None, *multiple_of:int | Decimal | None=None, *max_digits:int | None=None, *decimal_places:int | None=None, *allow_inf_nan:bool | None=None) -> type[Decimal]
!!!
funcpydantic.types.confloat(*strict:bool | None=None, *gt:float | None=None, *ge:float | None=None, *lt:float | None=None, *le:float | None=None, *multiple_of:float | None=None, *allow_inf_nan:bool | None=None) -> type[float]
!!!
funcpydantic.types.conint(*strict:bool | None=None, *gt:int | None=None, *ge:int | None=None, *lt:int | None=None, *le:int | None=None, *multiple_of:int | None=None) -> type[int]
!!!
funcpydantic.types.constr(*strip_whitespace:bool | None=None, *to_upper:bool | None=None, *to_lower:bool | None=None, *strict:bool | None=None, *min_length:int | None=None, *max_length:int | None=None, *pattern:str | Pattern[str] | None=None, *ascii_only:bool | None=None) -> type[str]
!!!
methodpydantic.v1.color.Color.as_hsl_tuple(*alpha:Optional[bool]=None) -> HslColorTuple
Color as an HSL or HSLA tuple, e.g.
methodpydantic.v1.color.Color.original() -> ColorType
Original value passed to Color
classpydantic.v1.color.RGBA
Internal use only as a representation of a color.
funcpydantic.v1.color.parse_float_alpha(value:Union[None, str, float, int]) -> Optional[float]
Parse a value checking it's a valid float in the range 0 to 1
funcpydantic.v1.color.parse_tuple(value:Tuple[Any, ...]) -> RGBA
Parse a tuple or list as a color.
methodpydantic.v1.config.BaseConfig.prepare_field(field:'ModelField') -> None
Optional hook to check or modify fields during model creation.
funcpydantic.v1.datetime_parse.parse_date(value:Union[date, StrBytesIntFloat]) -> date
Parse a date/int/float/string and return a datetime.date.
funcpydantic.v1.datetime_parse.parse_time(value:Union[time, StrBytesIntFloat]) -> time
Parse a time/string and return a datetime.time.
classpydantic.v1.fields.FieldInfo
Captures extra information about a field.
funcpydantic.v1.json.timedelta_isoformat(td:datetime.timedelta) -> str
ISO 8601 encoding for Python timedelta object.
funcpydantic.v1.main.validate_model(model:Type[BaseModel], input_data:'DictStrAny', cls:'ModelOrDc'=None) -> Tuple['DictStrAny', 'SetStr', Optional[ValidationError]]
validate data against a model.
methodpydantic.v1.mypy.PydanticPlugin.get_class_decorator_hook(fullname:str) -> Optional[Callable[[ClassDefContext], None]]
Mark pydantic.dataclasses as dataclass.
methodpydantic.v1.mypy.PydanticPlugin.report_config_data(ctx:ReportConfigContext) -> Dict[str, Any]
Return all plugin config data.
funcpydantic.v1.mypy.add_method(ctx:ClassDefContext, name:str, args:List[Argument], return_type:Type, self_type:Optional[Type]=None, tvar_def:Optional[TypeVarDef]=None, is_classmethod:bool=False, is_new:bool=False) -> None
Adds a new method to a class.
funcpydantic.v1.mypy.from_orm_callback(ctx:MethodContext) -> Type
Raise an error if orm_mode is not enabled
methodpydantic.v1.networks.AnyUrl.validate_parts(parts:'Parts', validate_port:bool=True) -> 'Parts'
A method used to validate parts of a URL.
funcpydantic.v1.networks.multi_host_url_regex() -> Pattern[str]
Compiled multi host url regex.
classpydantic.v1.schema.SkipField
Utility exception used to exclude fields from schema.
funcpydantic.v1.schema.enum_process_schema(enum:Type[Enum], *field:Optional[ModelField]=None) -> Dict[str, Any]
Take a single `enum` and generate its schema.
funcpydantic.v1.schema.model_schema(model:Union[Type['BaseModel'], Type['Dataclass']], by_alias:bool=True, ref_prefix:Optional[str]=None, ref_template:str=default_ref_template) -> Dict[str, Any]
Generate a JSON Schema for one model.
funcpydantic.v1.schema.normalize_name(name:str) -> str
Normalizes the given name.
classpydantic.v1.types.PaymentCardNumber
Based on: https://en.wikipedia.org/wiki/Payment_card_number
methodpydantic.v1.types.PaymentCardNumber.validate_luhn_check_digit(card_number:str) -> str
Based on: https://en.wikipedia.org/wiki/Luhn_algorithm
classpydantic.v1.types.StrictBool
StrictBool to allow for bools which are not type-coerced.
methodpydantic.v1.types.StrictBool.validate(value:Any) -> bool
Ensure that we only allow bools.
funcpydantic.v1.typing.convert_generics(tp:Type[Any]) -> Type[Any]
Python 3.9 and older only supports generics from `typing` module.
funcpydantic.v1.typing.get_args(t:Type[Any]) -> Tuple[Any, ...]
Compatibility version of get_args for python 3.7.
funcpydantic.v1.typing.get_class(type_:Type[Any]) -> Union[None, bool, Type[Any]]
Tries to get the class of a Type[T] annotation.
funcpydantic.v1.typing.is_namedtuple(type_:Type[Any]) -> bool
Check if a given class is a named tuple.
funcpydantic.v1.typing.is_new_type(type_:Type[Any]) -> bool
Check whether type_ was created using typing.NewType
funcpydantic.v1.typing.is_typeddict_special(type_:Any) -> bool
Check if type is a TypedDict special form (Required or NotRequired).
funcpydantic.v1.typing.resolve_annotations(raw_annotations:Dict[str, Type[Any]], module_name:Optional[str]) -> Dict[str, Type[Any]]
Partially taken from typing.get_type_hints.
classpydantic.v1.utils.ClassAttribute
Hide class attribute from its instances
classpydantic.v1.utils.PyObjectStr
String class where repr doesn't include quotes.
classpydantic.v1.utils.Representation
Mixin to provide __str__, __repr__, and __pretty__ methods.
funcpydantic.v1.utils.almost_equal_floats(value_1:float, value_2:float, *delta:float=1e-08) -> bool
Return True if two floats are almost equal
funcpydantic.v1.utils.assert_never(obj:NoReturn, msg:str) -> NoReturn
Helper to make sure that we have covered all possible types.
funcpydantic.v1.utils.generate_model_signature(init:Callable[..., None], fields:Dict[str, 'ModelField'], config:Type['BaseConfig']) -> 'Signature'
Generate signature for model based on its fields
funcpydantic.v1.utils.import_string(dotted_path:str) -> Any
Stolen approximately from django.
funcpydantic.v1.utils.is_valid_identifier(identifier:str) -> bool
Checks that a string is a valid identifier and not a Python keyword.
funcpydantic.v1.utils.path_type(p:'Path') -> str
Find out what sort of thing a path is.
funcpydantic.v1.utils.unique_list(input_list:Union[List[T], Tuple[T, ...]], *name_factory:Callable[[T], str]=str) -> List[T]
Make a list unique while maintaining order.
funcpydantic.v1.validators.callable_validator(v:Any) -> AnyCallable
Perform a simple check if the value is callable.
funcpydantic.v1.validators.constant_validator(v:'Any', field:'ModelField') -> 'Any'
Validate ``const`` fields.
funcpydantic.version.parse_mypy_version(version:str) -> tuple[int, int, int]
Parse `mypy` string version to a 3-tuple of ints.
funcpydantic.version.version_short() -> str
Return the `major.minor` part of Pydantic version.
classpydantic.warnings.CoreSchemaGenerationWarning
A warning raised during core schema generation.
classpydantic.warnings.PydanticDeprecationWarning
A Pydantic specific deprecation warning.
classpydantic.warnings.PydanticExperimentalWarning
A Pydantic specific experimental functionality warning.
funcrelease.prepare.get_notes(new_version:str) -> str
Fetch auto-generated release notes from github.
funcrelease.prepare.update_history(new_version:str, dry_run:bool, force_update:bool) -> None
Generate release notes and prepend them to HISTORY.md.
funcrelease.prepare.update_version(new_version:str, dry_run:bool) -> None
Update the version in the giving py version file.
funcrelease.push.commit_and_push_changes(rl_version:str) -> None
Commit and push changes to a new branch.
funcrelease.push.create_github_release(new_version:str, notes:str)
Create a new release on GitHub.
funcrelease.push.create_github_release_draft(rl_version:str, rl_release_notes:str)
Create a GitHub release draft.
funcrelease.push.create_version_tag(rl_version:str)
Create a version tag.
funcrelease.push.open_pull_request(rl_version:str)
Open a pull request on GitHub.
funcrelease.shared.run_command(*args:str) -> str
Run a shell command and return the output.

この情報について

掲載しているシグネチャは pydantic/pydantic の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る