fL iUdZddlmZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZddlmZdZdZd ed <Gd d eZed Zd ed<Gdde ZGdde ZGddee ZGddee ZdZd ed<Gddee Zy)z!!! abstract "Usage Documentation" [Build a Plugin](../concepts/plugins.md#build-a-plugin) Plugin interface for Pydantic plugins, and related types. ) annotations)AnyCallableLiteral NamedTuple) CoreConfig CoreSchemaValidationError)Protocol TypeAlias) ExtraValues)PydanticPluginProtocolBaseValidateHandlerProtocolValidatePythonHandlerProtocolValidateJsonHandlerProtocolValidateStringsHandlerProtocolNewSchemaReturnsSchemaTypePath SchemaKindvtuple[ValidatePythonHandlerProtocol | None, ValidateJsonHandlerProtocol | None, ValidateStringsHandlerProtocol | None]r rc&eZdZUdZded<ded<y)rzQPath defining where `schema_type` was defined, or where `TypeAdapter` was called.strmodulenameN)__name__ __module__ __qualname____doc____annotations__^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pydantic/plugin/__init__.pyrrs[ K Ir!r) BaseModel TypeAdapter dataclass create_model validate_callrc4eZdZdZ ddZy)rz5Protocol defining the interface for Pydantic plugins.ctd)aThis method is called for each plugin every time a new [`SchemaValidator`][pydantic_core.SchemaValidator] is created. It should return an event handler for each of the three validation methods, or `None` if the plugin does not implement that method. Args: schema: The schema to validate against. schema_type: The original type which the schema was created from, e.g. the model class. schema_type_path: Path defining where `schema_type` was defined, or where `TypeAdapter` was called. schema_kind: The kind of schema to validate against. config: The config to use for validation. plugin_settings: Any plugin settings. Returns: A tuple of optional event handlers for each of the three validation methods - `validate_python`, `validate_json`, `validate_strings`. z9Pydantic plugins should implement `new_schema_validator`.)NotImplementedError)selfschema schema_typeschema_type_path schema_kindconfigplugin_settingss r"new_schema_validatorz+PydanticPluginProtocol.new_schema_validator+s:""]^^r!N)r,r r-rr.rr/rr0zCoreConfig | Noner1zdict[str, object]returnr)rrrrr2r r!r"rr(sV?___) _  _ " _+_ _r!rc6eZdZUdZded< ddZd dZd dZy) rzBase 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. zCallable[..., None]on_entercy)z{Callback to be notified of successful validation. Args: result: The result of the validation. Nr )r+results r" on_successz&BaseValidateHandlerProtocol.on_successU r!cy)znCallback to be notified of validation errors. Args: error: The validation error. Nr )r+errors r"on_errorz$BaseValidateHandlerProtocol.on_error]r9r!cy)zCallback to be notified of validation exceptions. Args: exception: The exception raised during validation. Nr )r+ exceptions r" on_exceptionz(BaseValidateHandlerProtocol.on_exceptioner9r!N)r7rr3None)r;r r3r@)r> Exceptionr3r@)rrrrrr8r<r?r r!r"rrKs! "!Er!rcLeZdZdZdddddddd ddZy)rz4Event handler for `SchemaValidator.validate_python`.N)strictextrafrom_attributescontext self_instanceby_aliasby_namecy)amCallback to be notified of validation start, and create an instance of the event handler. Args: input: The input to be validated. strict: Whether to validate the object in strict mode. extra: Whether to ignore, allow, or forbid extra data during model validation. from_attributes: Whether to validate objects as inputs by extracting attributes. context: The context to use for validation, this is passed to functional validators. self_instance: An instance of a model to set attributes on from validation, this is used when running validation from the `__init__` method of a model. by_alias: Whether to use the field's alias to match the input data to an attribute. by_name: Whether to use the field's name to match the input data to an attribute. Nr ) r+inputrCrDrErFrGrHrIs r"r5z&ValidatePythonHandlerProtocol.on_enterqr!)rKrrC bool | NonerDExtraValues | NonerErMrF Any | NonerGrOrHrMrIrMr3r@rrrrr5r r!r"rrnsy> #$('+"$( $#    "  %   "     r!rcFeZdZdZddddddd ddZy)rz2Event handler for `SchemaValidator.validate_json`.N)rCrDrFrGrHrIcy)aCallback to be notified of validation start, and create an instance of the event handler. Args: input: The JSON data to be validated. strict: Whether to validate the object in strict mode. extra: Whether to ignore, allow, or forbid extra data during model validation. context: The context to use for validation, this is passed to functional validators. self_instance: An instance of a model to set attributes on from validation, this is used when running validation from the `__init__` method of a model. by_alias: Whether to use the field's alias to match the input data to an attribute. by_name: Whether to use the field's name to match the input data to an attribute. Nr )r+rKrCrDrFrGrHrIs r"r5z$ValidateJsonHandlerProtocol.on_enterrLr!)rKzstr | bytes | bytearrayrCrMrDrNrFrOrGrOrHrMrIrMr3r@rPr r!r"rrsl< #$("$( $# &   "    "     r!rzdict[str, StringInput] StringInputc@eZdZdZdddddd ddZy)rz5Event handler for `SchemaValidator.validate_strings`.N)rCrDrFrHrIcy)abCallback to be notified of validation start, and create an instance of the event handler. Args: input: The string data to be validated. strict: Whether to validate the object in strict mode. extra: Whether to ignore, allow, or forbid extra data during model validation. context: The context to use for validation, this is passed to functional validators. by_alias: Whether to use the field's alias to match the input data to an attribute. by_name: Whether to use the field's name to match the input data to an attribute. Nr )r+rKrCrDrFrHrIs r"r5z'ValidateStringsHandlerProtocol.on_enterrLr!)rKrSrCrMrDrNrFrOrHrMrIrMr3r@rPr r!r"rrs_? #$(" $#    "        r!rN)r __future__rtypingrrrr pydantic_corerr r typing_extensionsr r pydantic.configr __all__rrrrrrrrrSrr r!r"r\s #55AA1' W)WZ hi Ii _X _F ( F $? < "=x 82 Y1 %@( r!