XjVM UdZddlmZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z ddl mZddlmZmZmZmZmZmZmZmZmZmZmZddlZddlZddlmZmZdd lmZm Z m!Z!d d l"m#Z#m$Z$d d l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0d d l1m2Z2d dl3m4Z4m5Z5d dl6m7Z7m8Z8d dl9m:Z:m;Z;d dlZ>d dl?m@Z@mAZAmBZBmCZCmDZDd dlEmFZFer:ddlGmHZHddlImJZJddlmKZKmLZLmMZMd dlNmOZOd dlPmQZQd dlRmSZSmTZTd dlUmVZWd dlXmYZYmZZZm[Z[dZ\e e]e^efddfZ_de`d<eeaebeae^e ebedecffe e^edecfffZdde`d<e,jZfd3d Zgd4d"Zhd4d#Ziehd$eid%d&d'Zjd(e`d)<Gd*d!e,j+Zled,el-Zmedddendddd. d5d/Zoeddendddd0 d6d1Zodddddddd. d7d2Zoe2enZpy)8zLogic for creating models.) annotationsN) GeneratorMapping)copydeepcopy)cached_property) TYPE_CHECKINGAnyCallableClassVarDictGenericLiteralTypeVarUnioncastoverload)PydanticUndefinedValidationError)Self TypeAliasUnpack)PydanticDeprecatedSince20PydanticDeprecatedSince211) _config _decorators_fields _forward_ref _generics _mock_val_ser_model_construction_namespace_utils_repr _typing_extra_utils)getattr_migration) AliasChoices AliasPath)GetCoreSchemaHandlerGetJsonSchemaHandler) ConfigDict ExtraValues)PydanticUndefinedAnnotationPydanticUserError)DEFAULT_REF_TEMPLATEGenerateJsonSchemaJsonSchemaModeJsonSchemaValuemodel_json_schema)PluggableSchemaValidator) Signature)Path) CoreSchemaSchemaSerializerSchemaValidator)PydanticExtraInfo)MappingNamespace)AbstractSetIntStrMappingIntStrAny)Protocol)ComputedFieldInfo FieldInfoModelPrivateAttr) BaseModel create_modelrTupleGeneratorIncExc|jjdrd}n*t|jj|ddrd}nyt j |j ||f|dg)Nfrozenfrozen_instanceF frozen_fieldtypelocinput) model_configgetgetattr__pydantic_fields__rfrom_exception_data__name__) model_clsnamevalue error_types a/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/pydantic/main.py _check_frozenrZRsj!!(+& ..2248(E J#   - -j$5QR rCcX||j|<|jj|yN)__dict____pydantic_fields_set__addmodelrVvals rY_model_field_setattr_handlerrd_s$ENN4 !!%%d+r[cjt|ddtj|di||j|<y)N__pydantic_private__)rQobject __setattr__rfras rY_private_setattr_handlerrids7u,d3; 5"8"='*Et$r[c<|jj|||Sr])__pydantic_validator__validate_assignmentras rYrmpsE4P4P4d4dejlpru4vr[c:|jj||Sr])r^ __setitem__ras rYrmrmrs0J0J4QT0Ur[ct|||Sr])_object_setattrras rYrmrmssOE4,Mr[) model_fieldrlprivater extra_knownz3Mapping[str, Callable[[BaseModel, str, Any], None]]_SIMPLE_SETATTR_HANDLERSc eZdZUdZeZded< ded< ded< ded < d Zd ed < d ed< d ed< ejZ ded< ded< dZ ded< ded< d Z d ed< ded< ded< ded< d ed!< d"ed#< d$ed%< e jd &Zd'ed(< e jd &Zd)ed*< e jd &Zd'ed+< es>ej(d,d-.Zej,d,d/d-0Zej,d,d1d-0Zd2Zdd3Zd4e_ej:edd5Zej:edd6Z e!dd7Z"e!dd8Z#eddd9Z$dd d:dd;Z%dZ&dd ddddd d d d d d4dd dd? dd@Z'ed4e(e)dAfdBdC ddDZ*eddEZ+ddFZ,ed d4dGddH ddIZ-edddddddJ ddKZ.eddddddL ddMZ/eddddddL ddNZ0eddOZ1e ddPZ2eddQZ3eddRZ4 ddSZ5ddTZ6dddUZ7esdfdV Z8ddWZ9ddXZ:ddYZ;ddZZesdd]Z?erdd^Z@dd_ZAdd`ZBddaZCeDjjZFeDjjZGeDjjZHeDjjZIeDjjZJddbZKe!eLjdcddddeZNe!eLjdfddddgZOeLjdhddddd d d d di ddjZPeLjdkddddd d d d eQeQdl ddmZReeLjdnddddoZSeeLjdpddddqdd dr ddsZTeeLjdtddddqdd dr dduZUeeLjdvddddwZVeeLjdxdddddyZWeLjdzdddddd d{ dd|ZXeeLjd}ddd4e(f dd~ZYeeLjdddd4e(d ddZZeeLjdddddZ[eeLjdddddZ\eLjdddddZ]eLjdddddZ^eeLjdddddZ_eLjdddddZ`xZaS)rCaY !!! abstract "Usage Documentation" [Models](../concepts/models.md) A base class for creating Pydantic models. Attributes: __class_vars__: The names of the class variables defined on the model. __private_attributes__: Metadata about the private attributes of the model. __signature__: The synthesized `__init__` [`Signature`][inspect.Signature] of the model. __pydantic_complete__: Whether model building is completed, or if there are still undefined fields. __pydantic_core_schema__: The core schema of the model. __pydantic_custom_init__: Whether the model has a custom `__init__` function. __pydantic_decorators__: Metadata containing the decorators defined on the model. This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models. The `origin` and `args` items map to the [`__origin__`][genericalias.__origin__] and [`__args__`][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the `parameter` item maps to the `__parameter__` attribute of generic classes. __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models. __pydantic_post_init__: The name of the post-init method for the model, if defined. __pydantic_root_model__: Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. __pydantic_serializer__: The `pydantic-core` `SchemaSerializer` used to dump instances of the model. __pydantic_validator__: The `pydantic-core` `SchemaValidator` used to validate instances of the model. __pydantic_fields__: A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. __pydantic_extra__: A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] is set to `'allow'`. __pydantic_fields_set__: The names of fields explicitly set during instantiation. __pydantic_private__: Values of private attributes set on the model instance. zClassVar[ConfigDict]rOzClassVar[set[str]]__class_vars__z%ClassVar[Dict[str, ModelPrivateAttr]]__private_attributes__zClassVar[Signature] __signature__FzClassVar[bool]__pydantic_complete__zClassVar[CoreSchema]__pydantic_core_schema____pydantic_custom_init__z$ClassVar[_decorators.DecoratorInfos]__pydantic_decorators__z+ClassVar[_generics.PydanticGenericMetadata]__pydantic_generic_metadata__NzClassVar[Dict[str, Any] | None]__pydantic_parent_namespace__z+ClassVar[None | Literal['model_post_init']]__pydantic_post_init____pydantic_root_model__zClassVar[SchemaSerializer]__pydantic_serializer__z4ClassVar[SchemaValidator | PluggableSchemaValidator]rkzClassVar[Dict[str, FieldInfo]]rRz:ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]__pydantic_setattr_handlers__z&ClassVar[Dict[str, ComputedFieldInfo]]__pydantic_computed_fields__z"ClassVar[PydanticExtraInfo | None]__pydantic_extra_info__)initDict[str, Any] | None__pydantic_extra__set[str]r_rfzXPydantic models should inherit from BaseModel, BaseModel cannot be instantiated directlyzbase-model-instantiatedcode validator) val_or_serr serializer)r^r_rrfc zd}|jj||}||urtjddyy)a/Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. T) self_instancea*A custom validator is returning a value other than `self`. Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`. See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details. stacklevelN)rkvalidate_pythonwarningswarn)selfdata__tracebackhide__validated_selfs rY__init__zBaseModel.__init__sJ!44DDTY]D^ ~ % MML   &r[Tct|diS)a6A mapping of field names to their respective [`FieldInfo`][pydantic.fields.FieldInfo] instances. !!! warning Accessing this attribute from a model instance is deprecated, and will not work in Pydantic V3. Instead, you should access this attribute from the model class. rRrQclss rY model_fieldszBaseModel.model_fieldsss1266r[ct|diS)aOA mapping of computed field names to their respective [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] instances. !!! warning Accessing this attribute from a model instance is deprecated, and will not work in Pydantic V3. Instead, you should access this attribute from the model class. rrrs rYmodel_computed_fieldszBaseModel.model_computed_fieldsss:B??r[c|jS)zGet extra fields set during validation. Returns: A dictionary of extra fields, or `None` if `config.extra` is not set to `"allow"`. )rrs rY model_extrazBaseModel.model_extra)s&&&r[c|jS)zReturns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. )r_rs rYmodel_fields_setzBaseModel.model_fields_set2s+++r[c |j|}i}t}|jjD]y\}}|j=|j|vr/|j |j||<|j |||vr|jt|jtr|jjn |jg}|D]} t| tr+| |vr'|j | ||<|j |nDt| tsO| j|} | tusi| ||<|j |n||vs'||vr'|j |||<|j |R|jrd|j!d|||<|||}|j"j%ddk(r|nd} t'|d|t'|d||j(st'|d| t'|d d|j*r_|j-dt/|d rB|j06|jD]#\} } | |j2vs| |j0| <%|S) aJCreates a new instance of the `Model` class with validated data. Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. Default values are respected, but no other validation is performed. !!! note `model_construct()` generally respects the `model_config.extra` setting on the provided model. That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__` and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored. Because no validation is performed with a call to `model_construct()`, having `model_config.extra == 'forbid'` does not result in an error if extra values are passed, but they will be ignored. Args: _fields_set: A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [`model_fields_set`][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the `values` argument will be used. values: Trusted or pre-validated data dictionary. Returns: A new instance of the `Model` class with validated data. NT)call_default_factoryvalidated_dataextraallowr^r_rrf)__new__setrRitemsaliaspopr`validation_alias isinstancer(choicesstrr)search_dict_for_pathr is_required get_defaultrOrPrqrrmodel_post_inithasattrrfrx)r _fields_setvaluesm fields_values fields_setrVfieldvalidation_aliasesrrW_extrakvs rYmodel_constructzBaseModel.model_construct<sm. KK (* U 2288: uKD%{{&5;;&+@&,jj&= d#t$J&U-C-C-O"%"8"8,G**22001# 0 "E!%-%6/.4jj.? d+"t,#E95 % : :6 B (9927M$/&NN40! ":%6>*0**T*:M$'NN4(**,*/*;*;QUfs*;*tM$'; u<  $K252B2B2F2Fw2OSZ2Z`d:}54kB** A3V < A5t <  % %  d #q01a6L6L6X"LLN6DAqA44445..q16r[)updatedeepc|r|jn|j}|r|jjddk(rY|j D]E\}}||j vr||j |<$|ji|_||j|<Gn|j j||jj|j|S)a!!! abstract "Usage Documentation" [`model_copy`](../concepts/models.md#model-copy) Returns a copy of the model. !!! note The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]). Args: update: Values to change/add in the new model. Note: the data is not validated before creating the new model. You should trust this data. deep: Set to `True` to make a deep copy of the model. Returns: New model instance. rr) __deepcopy____copy__rOrPrrRr^rrr_keys)rrrcopiedrrs rY model_copyzBaseModel.model_copys&)-""$$--/   $$W-8"LLN9DAqD444-.*!44<8:F57811!4 9&&v.  * * 1 1&++- @ r[python)modeincludeexcludecontextby_alias exclude_unsetexclude_defaults exclude_noneexclude_computed_fields round_triprfallbackserialize_as_anypolymorphic_serializationcV|jj|||||||||| | | | | |S)a(!!! abstract "Usage Documentation" [`model_dump`](../concepts/serialization.md#python-mode) Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. Args: mode: The mode in which `to_python` should run. If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects. include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of `None`. exclude_computed_fields: Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicated `round_trip` parameter instead. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. fallback: A function to call when an unknown value is encountered. If not provided, a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. polymorphic_serialization: Whether to use model and dataclass polymorphic serialization for this call. Returns: A dictionary representation of the model. )rrrrrrrrrrrrrr)r to_python)rrrrrrrrrrrrrrrs rY model_dumpzBaseModel.model_dumpsP`++55 '-%$;!-&?6  r[indent ensure_asciirrrrrrrrrrrrrct|jj|||||||||| | | | | ||jS)a'!!! abstract "Usage Documentation" [`model_dump_json`](../concepts/serialization.md#json-mode) Generates a JSON representation of the model using Pydantic's `to_json` method. Args: indent: Indentation to use in the JSON output. If None is passed, the output will be compact. ensure_ascii: If `True`, the output is guaranteed to have all incoming non-ASCII characters escaped. If `False` (the default), these characters will be output as-is. include: Field(s) to include in the JSON output. exclude: Field(s) to exclude from the JSON output. context: Additional context to pass to the serializer. by_alias: Whether to serialize using field aliases. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of `None`. exclude_computed_fields: Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicated `round_trip` parameter instead. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. fallback: A function to call when an unknown value is encountered. If not provided, a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. polymorphic_serialization: Whether to use model and dataclass polymorphic serialization for this call. Returns: A JSON string representation of the model. r)rto_jsondecode)rrrrrrrrrrrrrrrrs rYmodel_dump_jsonzBaseModel.model_dump_jsons\b++33 %'-%$;!-&?!4 " &(# r[ validationany_of) union_formatc$t||||||S)aGenerates a JSON schema for a model class. Args: by_alias: Whether to use attribute aliases or not. ref_template: The reference template. union_format: The format to use when combining schemas from unions together. Can be one of: - `'any_of'`: Use the [`anyOf`](https://json-schema.org/understanding-json-schema/reference/combining#anyOf) keyword to combine schemas (the default). - `'primitive_type_array'`: Use the [`type`](https://json-schema.org/understanding-json-schema/reference/type) keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive type (`string`, `boolean`, `null`, `integer` or `number`) or contains constraints/metadata, falls back to `any_of`. schema_generator: To override the logic used to generate the JSON schema, as a subclass of `GenerateJsonSchema` with your desired modifications mode: The mode in which to generate the schema. Returns: The JSON schema for the given model class. )r ref_templaterschema_generatorr)r4)rrrrrrs rYr4zBaseModel.model_json_schema1s#<! %%-   r[ct|ts td|Dcgc])}t|tr|nt j |+}}dj|}|jd|dScc}w)a}Compute the class name for parametrizations of generic classes. This method can be overridden to achieve a custom naming scheme for generic BaseModels. Args: params: Tuple of types of the class. Given a generic class `Model` with 2 type variables and a concrete model `Model[str, int]`, the value `(str, int)` would be passed to `params`. Returns: String representing the new class where `params` are passed to `cls` as type variables. Raises: TypeError: Raised when trying to generate concrete names for non-generic models. z;Concrete names should only be generated for generic models., []) issubclassr TypeErrorrrr$display_as_typejoinrT)rparamsparam param_namesparams_components rYmodel_parametrized_namez!BaseModel.model_parametrized_nameXsz"#w'YZ Z gmm]b 5# 6uE! u !4#N7  ))99 +:  r[rrrrrcrd}|dur|dur tdd|jj||||||S)a!!! abstract "Usage Documentation" [JSON Parsing](../concepts/json.md#json-parsing) Validate the given JSON data against the Pydantic model. Args: json_data: The JSON data to validate. strict: Whether to enforce types strictly. extra: Whether to ignore, allow, or forbid extra data during model validation. See the [`extra` configuration value][pydantic.ConfigDict.extra] for details. context: Extra variables to pass to the validator. by_alias: Whether to use the field's alias when validating against the provided input data. by_name: Whether to use the field's name when validating against the provided input data. Returns: The validated Pydantic model. Raises: ValidationError: If `json_data` is not a JSON string or the object could not be validated. TFrrrr)r/rk validate_json)r json_datarrrrrrs rYmodel_validate_jsonzBaseModel.model_validate_jsons[@! u !4#N7  ))77 fE7X_f8  r[crd}|dur|dur tdd|jj||||||S)aValidate the given object with string data against the Pydantic model. Args: obj: The object containing string data to validate. strict: Whether to enforce types strictly. extra: Whether to ignore, allow, or forbid extra data during model validation. See the [`extra` configuration value][pydantic.ConfigDict.extra] for details. context: Extra variables to pass to the validator. by_alias: Whether to use the field's alias when validating against the provided input data. by_name: Whether to use the field's name when validating against the provided input data. Returns: The validated Pydantic model. TFrrrr)r/rkvalidate_strings)rrrrrrrrs rYmodel_validate_stringsz BaseModel.model_validate_stringssZ4! u !4#N7  )):: eWxY`;  r[ctjdtd|jj d}|&t |t js |jS||S)Na>The `__get_pydantic_core_schema__` method of the `BaseModel` class is deprecated. If you are calling `super().__get_pydantic_core_schema__` when overriding the method on a Pydantic model, consider using `handler(source)` instead. However, note that overriding this method on models can lead to unexpected side effects.rrr{) rrrr^rPrr!MockCoreSchemar{)rsourcehandlerschemas rY__get_pydantic_core_schema__z&BaseModel.__get_pydantic_core_schema__8s_    '  !!"<=  j9U9U&V// /vr[c||S)a_Hook into generating the model's JSON schema. Args: core_schema: A `pydantic-core` CoreSchema. You can ignore this argument and call the handler with a new CoreSchema, wrap this CoreSchema (`{'type': 'nullable', 'schema': current_schema}`), or just call the handler with the original schema. handler: Call into Pydantic's internal JSON schema generation. This will raise a `pydantic.errors.PydanticInvalidForJsonSchema` if JSON schema generation fails. Since this gets called by `BaseModel.model_json_schema` you can override the `schema_generator` argument to that function to change JSON schema generation globally for a type. Returns: A JSON schema, as a Python object. r)r core_schemar's rY__get_pydantic_json_schema__z&BaseModel.__get_pydantic_json_schema__Ls0{##r[c y)aThis is intended to behave just like `__init_subclass__`, but is called by `ModelMetaclass` only after basic class initialization is complete. In particular, attributes like `model_fields` will be present when this is called, but forward annotations are not guaranteed to be resolved yet, meaning that creating an instance of the class may fail. This is necessary because `__init_subclass__` will always be called by `type.__new__`, and it would require a prohibitively large refactor to the `ModelMetaclass` to ensure that `type.__new__` was called in such a manner that the class would already be sufficiently initialized. This will receive the same `kwargs` that would be passed to the standard `__init_subclass__`, namely, any kwargs passed to the class definition that aren't used internally by Pydantic. Args: **kwargs: Any keyword arguments passed to the class definition that aren't used internally by Pydantic. Note: You may want to override [`__pydantic_on_complete__()`][pydantic.main.BaseModel.__pydantic_on_complete__] instead, which is called once the class and its fields are fully initialized and ready for validation. Nrrkwargss rY__pydantic_init_subclass__z$BaseModel.__pydantic_init_subclass__frr[cy)a+This is called once the class and its fields are fully initialized and ready to be used. This typically happens when the class is created (just before [`__pydantic_init_subclass__()`][pydantic.main.BaseModel.__pydantic_init_subclass__] is called on the superclass), except when forward annotations are used that could not immediately be resolved. In that case, it will be called later, when the model is rebuilt automatically or explicitly using [`model_rebuild()`][pydantic.main.BaseModel.model_rebuild]. Nrrs rY__pydantic_on_complete__z"BaseModel.__pydantic_on_complete__}rr[c tj||}||S|tur tdt |dst|d|j ds t |jvrt|dt|ts|f}tj|| td jD}tj j jr r|}tj||||S|j d}|s|}nt fd|D}|j d xs|}|j!|}tt"j%tj& j}tj(||5} tj*||||}| |cdddS| | cdddS t-j.d xsi} |j1| tj4||||}tj|||||ddd|S#t2$rYFwxYw#1swYSxYw) NzAType parameters should be placed on typing.Generic, not BaseModel__parameters__zG cannot be parametrized because it does not inherit from typing.Generic parametersz is not a generic classc3 K|]}|ywr]r).0rs rY z.BaseModel.__class_getitem__..s@Qq@s argsc3JK|]}tj|ywr])r replace_types)r7arg typevars_maps rYr8z.BaseModel.__class_getitem__..s_CY44S,G_s #originr)r)r)r get_cached_generic_type_earlyrCrrr~r __bases__rtuplemap_generic_model_argumentsrr& all_identicalrset_cached_generic_typerdictfromkeysiter_contained_typevarsgeneric_recursion_self_typeget_cached_generic_type_later%rrr.create_generic_submodel) rtypevar_valuescachedsubmodel parent_argsr9r> model_namermaybe_self_typerr=s @rY__class_getitem__zBaseModel.__class_getitem__sq88nM  M ) _` `s,-se#jkl l00>7RUR_R_C_se#:;< <.%0,.N!<8 LPM;;FCK%_S^__66x@GCF77=J i?? @S@S@UVWF66vtD _"??^U[]ab%! _ _ #.*  _ _  !. D DRS T ZXZI(()(D %<>o44T:: *%+%<%.-s9J9J5RU9Vr[rsrc(j||Sr]rj)rbrkrcrs rYrmz,BaseModel._setattr_handler..AseS1Ir[rlrr"z" object has no field "rtrr)r[rwrZrTris_valid_field_namerxrPrrurqrQrrrZpropertyrOrR ValueErrorrr_r`)rrVrWrrr_s @@rYrdzBaseModel._setattr_handlers..Cs)))$h1#,,@EEH\\NRSTXSYYce006!$!;!;!?!?!EEIRy)4VV7 BB#D$63d+D $0/0ABB #tU +$)II!!%%&;</0EFFS444##''0G;$q6MdVST%UVV\49D++D10044T:4MBB/ >>r[c|j}||jvr<|j|}t|dr|j|y |j|=yt||d}t|trtj||St||d||jvrtj||y|j||jvr|j|=y tj||y#t $r }t |jd||d}~wwxYw#t $r$t t!|jd|wxYw)N __delete__rW)rVrW)r[rxrrrrfrYrZrTrQrrrg __delattr__rZrRrrL)rr]rr_r`rs rYrszBaseModel.__delattr__SsZ..Ct222 77= 9l3((.h11$7 3d+D$0))$55 #D 5t///""4.((4AXAX9X++D1f&&tT2! h(CLL+;;TUYT\)]^dggh"&f(DJ,?,?+BB[\`[c)deefs$ C=&D)= D&D!!D&)-Ec &|j|S)N)r)r)rchangess rY __replace__zBaseModel.__replace__vs??'?2 2r[c|j}|r,|jDcic]\}}|tus||}}}|j|j|j |dScc}}w)N)r^rr_rf)rfrrr^rr_)rrsrrs rY __getstate__zBaseModel.__getstate__yse++ (/ V11DU;Uq!tVGV "&"9"9'+'C'C$+   Ws A A ct|d|jdit|d|jdit|d|jdit|d|jdiy)Nr_rrfr^)rqrP)rstates rY __setstate__zBaseModel.__setstate__sg7C\^`9ab2EII>RTV4WX4eii@VXZ6[\j%))J*CDr[cLt|tr0|jdxs |j}|jdxs |j}||urrfFTc"tjSr])r& _SENTINEL)_s rYrmz"BaseModel.__eq__..s [a[k[kr[)rrCr~r[rQrr^rLrRroperator itemgetterrYr&SafeGetItemProxyNotImplemented)rother self_type other_typergetterself_fields_proxyother_fields_proxys rY__eq__zBaseModel.__eq__s%+!>>xHZDNN "@@J]eoo +&>4JJJ&% S )/(?(? (N%)/)@)@)P&!"34?Q8RRRSs$EAF#"F#c y)aThis signature is included purely to help type-checkers check arguments to class declaration, which provides a way to conveniently set model_config key/value pairs. ```python from pydantic import BaseModel class MyModel(BaseModel, extra='allow'): ... ``` However, this may be deceiving, since the _actual_ calls to `__init_subclass__` will not receive any of the config arguments, and will only receive any keyword arguments passed during class initialization that are _not_ expected keys in ConfigDict. (This is due to the way `ModelMetaclass.__new__` works.) Args: **kwargs: Keyword arguments passed to the class definition, which set model_config Note: You may want to override `__pydantic_init_subclass__` instead, which behaves similarly but is called *after* the class is fully initialized. Nrr.s rY__init_subclass__zBaseModel.__init_subclass__rr[c#K|jjDcgc]\}}|jdr||fc}}Ed{|j}|r|jEd{yycc}}w727w)zSo `dict(model)` works.rN)r^r startswithr)rrrrs rY__iter__zBaseModel.__iter__sl)-)<)<)>Xv1allSVFWQFXXX'' {{} $ $ YX %s3A>A4A4A>A:%A>-A<. A><A>cL|jd|jddS)N(r)) __repr_name__ __repr_str__rs rY__repr__zBaseModel.__repr__s+$$&'q):):4)@(ACCr[c #*K|jjDcgc] \}}|js|t||f"}}}|jjD]P\}}|j j |}|s$|js1||ur||f<||j|fR tj|d}|d|jDEd{|Ed{ycc}}w#t$rd}Y?wxYw7&7w)Nrc3*K|] \}}||f ywr]r)r7rrs rYr8z*BaseModel.__repr_args__..sB41aABs) rrreprrQr^rRrP__repr_recursion__rgrXrZ)rrrcomputed_fields_repr_argsrras rY __repr_args__zBaseModel.__repr_args__s /3.O.O.U.U.W% &*a[\[a[aQa !% !% MM'') 8DAq,,003ED=Q$JT44Q777  8 "#44T;OPN  %B>+?+?+AB B B,,,-% " "!N " C,sdDC8C8AD D"D6C> D(D) D2D3 D> D  D D  DDc$|jdS)N )rrs rY__str__zBaseModel.__str__ s  %%r[XThe `__fields__` attribute is deprecated, use the `model_fields` class property instead.)categorycftjdtdtt |diS)NrrrrrR)rrrrQrLrs rY __fields__zBaseModel.__fields__s/  f. tDz#8"==r[MThe `__fields_set__` attribute is deprecated, use `model_fields_set` instead.cRtjdtd|jS)Nrrr)rrrr_rs rY__fields_set__zBaseModel.__fields_set__s'  [. +++r[:The `dict` method is deprecated; use `model_dump` instead.rrrrrrchtjdtd|j||||||S)Nrrrr)rrrr)rrrrrrrs rYrEzBaseModel.dict*sC  H. '-%   r[?The `json` method is deprecated; use `model_dump_json` instead.)rrrrrrencodermodels_as_dictc tjdtd|tur t d|tur t d| r t d|j ||||||S)NrrrzMThe `encoder` argument is no longer supported; use field serializers instead.zUThe `models_as_dict` argument is no longer supported; use a model serializer instead.z9`dumps_kwargs` keyword arguments are no longer supported.r)rrrrrr) rrrrrrrrr dumps_kwargss rYjsonzBaseModel.jsonCs~  M. + +kl l !2 2st t WX X##'-% $  r[CThe `parse_obj` method is deprecated; use `model_validate` instead.c\tjdtd|j|S)Nrrrrrrrrrs rY parse_objzBaseModel.parse_objes,  Q. !!#&&r[The `parse_raw` method is deprecated; if your data is JSON use `model_validate_json`, otherwise load the data then use `model_validate` instead.utf8) content_typeencodingproto allow_picklectjdtdddlm} |j |||||}|j%|S#t tf$r}ddl} t|trd} n.t|| jrd } nt|t rd } nd } tj| t|d |d } tjj!|j"| gd}~wwxYw)Nrrrrparserrrrrzvalue_error.unicodedecodezvalue_error.jsondecode value_error type_error)__root__rK)rrr deprecatedrload_str_bytesrprrrUnicodeDecodeErrorJSONDecodeError pydantic_corePydanticCustomErrorrrrSrTr) rbrrrrrrr`rtype_strerrors rY parse_rawzBaseModel.parse_rawos   I.  & [&&)!) 'C8!!#&&+I& [ #126C!5!563C,(' &99(CHM$ 5E  //CCCLLSXRYZ Z) [sA C2BC--C2The `parse_file` method is deprecated; load the data from file, then if your data is JSON use `model_validate_json`, otherwise `model_validate` instead.ctjdtdddlm}|j |||||}|j |S)Nrrrrrr)rrrrr load_filer)rpathrrrrrrs rY parse_filezBaseModel.parse_filesT   M.  &oo %%  }}S!!r[qThe `from_orm` method is deprecated; set `model_config['from_attributes']=True` and use `model_validate` instead.ctjdtd|jj dds t dd|j |S)NrrrrzHYou must set the config attribute `from_attributes=True` to use from_ormr)rrrrOrPr/rrs rYfrom_ormzBaseModel.from_orms[   W.  ##$5t<#Zae !!#&&r[DThe `construct` method is deprecated; use `model_construct` instead.c btjdtd|jdd|i|S)Nrrrrr)rrrr)rrrs rY constructzBaseModel.constructs6  R. #s""E{EfEEr[The `copy` method is deprecated; use `model_copy` instead. See the docstring of `BaseModel.copy` for details about how to handle `include` and `exclude`.)rrrrc tjdtdddlm}t |j |dd||dfi|xsi}|jd}n6|jjD cic]\}} | tus|| }}} |jd} n}|jj} t|jD]}||vs| j|t|D]%}||jvs|j|| |<'|r|j|jz} nt!|j} |r| t!|z} |j#||| | || Scc} }w) aReturns a copy of the model. !!! warning "Deprecated" This method is now deprecated; use `model_copy` instead. If you need `include` or `exclude`, use: ```python {test="skip" lint="skip"} data = self.model_dump(include=include, exclude=exclude, round_trip=True) data = {**data, **(update or {})} copied = self.model_validate(data) ``` Args: include: Optional set or mapping specifying which fields to include in the copied model. exclude: Optional set or mapping specifying which fields to exclude in the copied model. update: Optional dictionary of field-value pairs to override field values in the copied model. deep: If True, the values of fields that are Pydantic models will be deep-copied. Returns: A copy of the model with included, excluded and updated fields as specified. rrrrcopy_internalsF)to_dictrrrrN)r)rrrrrrE_iterrfrrrrlistrr_rr_copy_and_set_values) rrrrrrrrsrrrrs rYrzBaseModel.copysF   m.  /  eeWgej !  |    $ $ ,G(,(A(A(G(G(Ih1QVgMgq!thGh  " " *+/E++002E$112 !F?IIaL !&\ -///%zz!}E!H - 55 EJT99:J  #g, &J224UT[bf2gg/is 4E5E5CThe `schema` method is deprecated; use `model_json_schema` instead.c`tjdtd|j||S)Nrrrrr)rrrr4)rrrs rYr(zBaseModel.schema/s1  Q. $$h\$RRr[WThe `schema_json` method is deprecated; use `model_json_schema` and json.dumps instead.rc tjdtdddl}ddlm}|j |j||fd|i|S) Nrrrrr)pydantic_encoderrdefault)rrrrdeprecated.jsonrdumpsr4)rrrrrrs rY schema_jsonzBaseModel.schema_json;sY  e. 5tzz  ! !8, ! O $   r[BThe `validate` method is deprecated; use `model_validate` instead.c\tjdtd|j|S)Nrrrr)rrWs rYvalidatezBaseModel.validateRs,  P. !!%((r[LThe `update_forward_refs` method is deprecated; use `model_rebuild` instead.c ztjdtd|r td|j dy)Nrrrz,`localns` arguments are not longer accepted.T)r)rrrrr)rlocalnss rYupdate_forward_refszBaseModel.update_forward_refs\s;  Z. JK K %r[HThe private method `_iter` will be removed and should no longer be used.crtjdtdddlm}|j |g|i|S)Nrrrrr)rrrrrrrr9r/rs rYrzBaseModel._iterks;  V. /#~##D:4:6::r[WThe private method `_copy_and_set_values` will be removed and should no longer be used.crtjdtdddlm}|j |g|i|S)Nrrrrr)rrrrrrrs rYrzBaseModel._copy_and_set_valuesxs;  e. /2~224I$I&IIr[MThe private method `_get_value` will be removed and should no longer be used.crtjdtdddlm}|j |g|i|S)Nrrrrr)rrrrr _get_value)rr9r/rs rYrzBaseModel._get_values;  [. /(~((>t>v>>r[RThe private method `_calculate_keys` will be removed and should no longer be used.crtjdtdddlm}|j |g|i|S)Nrrrrr)rrrrr_calculate_keysrs rYrzBaseModel._calculate_keyss;  `. /-~--dDTDVDDr[)rr returnNone)rzdict[str, FieldInfo])rzdict[str, ComputedFieldInfo])rdict[str, Any] | None)rrr])rzset[str] | Nonerr rr)rzMapping[str, Any] | Nonerboolrr)rzLiteral['json', 'python'] | strr IncEx | Nonerrr Any | Noner bool | Nonerrrrrrrrrrr'bool | Literal['none', 'warn', 'error']rCallable[[Any], Any] | Nonerrrrrdict[str, Any]) rz int | Nonerrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrztype[GenerateJsonSchema]rr2rz)Literal['any_of', 'primitive_type_array']rr)rztuple[type[Any], ...]rr)rr rr) rrrrrintrzMappingNamespace | Nonerr)rr rrrExtraValues | Nonerrrrrrrrrr)rzstr | bytes | bytearrayrrrrrrrrrrrr)rr rrrrrrrrrrrr)r&type[BaseModel]r'r*rr8)r+r8r'r+rr3)r/r rr)rr)rKz!type[Any] | tuple[type[Any], ...]rz3type[BaseModel] | _forward_ref.PydanticRecursiveRef)rr)rTzdict[int, Any] | Nonerr)r]rrr )rVrrWr rr)rVrrWr rz,Callable[[BaseModel, str, Any], None] | None)rur rr)rdict[Any, Any])rzrrr)rr rr)r/zUnpack[ConfigDict])rrE)rr)rz_repr.ReprArgs)rrrrrrrrrrrrrDict[str, Any])rrrrrrrrrrrrrrrrrr rr)rr rr) rz str | bytesr str | NonerrrDeprecatedParseProtocol | Nonerrrr) rz str | Pathrr rrrr rrrr) r+AbstractSetIntStr | MappingIntStrAny | Nonerr rrrrrr)rrrrrr )rrrrrr rr)rWr rr)rr rr)r9r r/r rr )brT __module__ __qualname____doc__r,rO__annotations__rzrDecoratorInfosr}rrr" NoInitFieldrr_rfr r!r%r{rrkr __slots__r__pydantic_base_init__r&deprecated_instance_property classmethodrrrorrrrrrr0r1r4rrrrr r#r)r,r0r2rQrrrbrhrdrsrvrxr{rrrrrr$Representationrrr __pretty__ __rich_repr__rtyping_extensionsrrrrErrrrrrrrr(rrrrrrr __classcell__)r[s@rYrCrCws  H*4L&5'&@AA=&&S,1>1V22',,;E_KD^D^D`A`^$ONFJ!#BIQGGE.3^3N77UPPX77$^]u"HHI?? 1P0C0O0OUZ0[-[s(G(;(G(GU(SXSB2Q2E2Q2QW\2]/]A $@=#?#? f*$  ":!9!9 f"*"  #;-":": f#*#  dI('+H# ((7)7 ((@)@'',,JJX@DRW J19 $ $" $#!&"(- <@04!&15!@ .@  @  @  @ @ @ @ @ "&@ @ :@ .@ @ $/!@ " #@ J"" $ $" $#!&"(- <@04!&15#BB B  B  BBBBBB"&BB:B.B !B"$/#B$ %BH05G+ $ CK$ $ $ 3 $  $ @$  $ $ L554 !'(48 : :  : "% : 2 :  : : x #$('+" $#. .  . " . % . . . .  . . ` #$(" $#) *)  ) " )  ) ) )  ) ) V #$(" $## #  # " #  # # #  # # J&$$&$  $$2  ,  A>A <AF&*  j: K5 ?n fF 3  E 7 &r  ,%D-:((66M--@@''44L%%00J((66M&!!!bmq>>!!!W,  ,"!!"^imn!% $#!&"            o 0"!!"cnrs!% $#!&"/@0          -     t B!!!"grvw'x'!!! E$(04".' .'! .'  .' . .'.' .'  .'`!!! I$(04"""! "  " . "" "  "4!!! S '  '!!!"hswxFyF"!! i@D?C(, Fh=Fh= Fh & Fh  Fh Fh  FhP!!!"grvw"8LSS25S SxS!!!a "&;O  58 ad    $!!!"fquv)w)!!!V&  &"!!R]a;;"!!aJ J!!!W?  ?"!!\E Er[) metaclassModelT)bound) __config__r__base__r __validators____cls_kwargs__rc yr]r rOrrr r r!r"rfield_definitionss rYrDrDsr[)rrr r!r"rc yr]rr$s rYrDrDsr[c |tdtf}nt|ts|f}|xsi}i} i} |j D]J\} } t| tr0t | dk7rt d| dd| d| | <| d| | <F| | | <L|$tjd} | jd }| |d }|r||d <|||d <|r|j||j| |r||d <tj|}tj|||\}}}||ur||d<|j|||||fd|d|S)a!!! abstract "Usage Documentation" [Dynamic Model Creation](../concepts/models.md#dynamic-model-creation) Dynamically creates and returns a new Pydantic model, in other words, `create_model` dynamically creates a subclass of [`BaseModel`][pydantic.BaseModel]. !!! warning This function may execute arbitrary code contained in field annotations, if string references need to be evaluated. See [Security implications of introspecting annotations](https://docs.python.org/3/library/annotationlib.html#annotationlib-security) for more information. Args: model_name: The name of the newly created model. __config__: The configuration of the new model. __doc__: The docstring of the new model. __base__: The base class or classes for the new model. __module__: The name of the module that the model belongs to; if `None`, the value is taken from `sys._getframe(1)` __validators__: A dictionary of methods that validate fields. The keys are the names of the validation methods to be added to the model, and the values are the validation methods themselves. You can read more about functional validators [here](https://docs.pydantic.dev/2.9/concepts/validators/#field-validators). __cls_kwargs__: A dictionary of keyword arguments for class creation, such as `metaclass`. __qualname__: The qualified name of the newly created model. **field_definitions: Field definitions of the new model. Either: - a single element, representing the type annotation of the field. - a two-tuple, the first element being the type and the second element the assigned value (either a default or the [`Field()`][pydantic.Field] function). Returns: The new [model][pydantic.BaseModel]. Raises: PydanticUserError: If `__base__` and `__config__` are both passed. type[ModelT]rzField definition for z should a single element representing the type or a two-tuple, the first element being the type and the second element the assigned value (either a default or the `Field()` function).zcreate-model-field-definitionsrrrrT)rr rrrO)kwds__orig_bases__F)#__pydantic_reset_parent_namespace___create_model_module)rrCrrArlenr/sys _getframe f_globalsrtypes resolve_bases prepare_class)rOrrr r r!r"rr%fieldsrf_namef_deff namespaceresolved_basesmetansr)s rYrDrDsb35 % (;#)rNF"$K*002 (  eU #5zQ'+F:6}}9 #((K "1XF6N"'K  ( MM! [[, 4?z ZI& )$0 .!( V$. .!((2N((^.YND"dX%'  R  -2'     r[)rUrrVrrWr rr)rbrCrVrrcr rr)rOrrConfigDict | Nonerr r rr rr!$dict[str, Callable[..., Any]] | Noner"rrr r%Any | tuple[Any, Any]rr)rOrrr<rr r z'type[ModelT] | tuple[type[ModelT], ...]r rr!r=r"rrr r%r>rr()rOrrr<rr r z.type[ModelT] | tuple[type[ModelT], ...] | Noner r r!r=r"rrr r%r>rr()qr __future__r _annotationsrr.r1rcollections.abcrrrr functoolsrtypingr r r r r rrrrrrrrrrrrrrr _internalrrrrr r!r"r#r$r%r& _migrationr'aliasesr(r)annotated_handlersr*r+configr,r-errorsr.r/ json_schemar0r1r2r3r4plugin._schema_validatorr5inspectr6pathlibr7r8r9r:_internal._fieldsr;_internal._namespace_utilsr<_internal._utilsr=r>deprecated.parser?DeprecatedParseProtocolr4r@rArB__all__rArrErrrrrFobject_setattrrqrZrdriruModelMetaclassrCrrTrDrbrr[rYrWs 3 .%    <55C    *,J+Buu>!KK4<EEFF &&eCHotT&AB BS3s8WS% :N5N-OQXY\^cdkmqdq^rYrQsstyt%44 , +0v'UM QMjE-<<jEZ1  + %);?,0#  "      9 *  /     %);?,0#  "    6  9 *  /    &%)?C!;?,0#dd" d  d = dd9d*dd/ddN ) r[