;iH 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 dlEmFZFer4ddlGmHZHddlImJZJddlmKZKmLZLmMZMd dlNmOZOd dlPmQZQmRZRd dlSmTZUd dlVmWZWmXZXmYZYdZZe e[e\efddfZ]de^d<ee_e`e_e\e e`edeaffe e\edeafffZbde^d<e,jcZddMd'ZedNd+ZfdNd,Zgefd-egd.d/d0Zhd1e^d2<Gd3d)e,ji4Zjed5ej6Zkedddeldddd7dOdFZmeddelddddGdPdJZmdddddddd7dQdLZme2elZndS)RzLogic 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)MappingNamespace)AbstractSetIntStrMappingIntStrAny)Protocol)ComputedFieldInfo FieldInfoModelPrivateAttr) BaseModel create_modelrTupleGeneratorIncEx model_clstype[BaseModel]namestrvaluer returnNonec|jdrd}n.t|j|ddrd}ndSt j|j||f|dg)Nfrozenfrozen_instanceF frozen_fieldtypelocinput) model_configgetgetattr__pydantic_fields__rfrom_exception_data__name__)rFrHrJ error_types AC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\pydantic/main.py _check_frozenr]Qs!!(++& .22488(E J J#   -j$5QQR  modelrBvalcN||j|<|j|dSN)__dict____pydantic_fields_set__addr_rHr`s r\_model_field_setattr_handlerrg^s+EN4 !%%d+++++r^ctt|ddt|di||j|<dS)N__pydantic_private__)rWobject __setattr__rirfs r\_private_setattr_handlerrlcsCu,d33; 5"8"==='*Et$$$r^c:|j|||Srb)__pydantic_validator__validate_assignmentrfs r\rposE4P4d4dejlpru4v4vr^c8|j||Srb)rc __setitem__rfs r\rprpqs0J0J4QT0U0Ur^c$t|||Srb)_object_setattrrfs r\rprprsOE4,M,Mr^) model_fieldroprivater extra_knownz3Mapping[str, Callable[[BaseModel, str, Any], None]]_SIMPLE_SETATTR_HANDLERSc eZdZUdZeZded< ded< ded< ded < d Zd ed < d ed< d ed< ej Z ded< ded< dZ ded< ded< d Z d ed< ded< ded< ded< d ed!< d"ed#< e jd $Zd%ed&< e jd $Zd'ed(< e jd $Zd%ed)< es8ejd*d+,Zejd*d-d+.Zejd*d/d+.Zd0Zdd5Zd6e_ejedd8Zejedd:Z e!dd<Z"e!dd=Z#edddBZ$dd dCddHZ%dIddddd d d d d d6dd dJ dd_Z&dd ddddd d d d d d6dd d`ddeZ'ed6e(e)dffdgdhddoZ*eddrZ+ddsZ,ed d6dtddudd|Z-eddddddd}ddZ.eddddddddZ/eddddddddZ0eddZ1eddZ2eddZ3eddZ4ddZ5d dZ6dd dZ7esd fd Z8d dZ9d dZ:d dZ;ddZ<ddZ=ddZ>esddZ?erddZ@ddZAddZBddZCeDjEjFZFeDjEjGZGeDjEjHZHeDjEjIZIeDjEjJZJddZKe!eLjMddddZNe!eLjMddddZOeLjMddddd d d d dddZPeLjMddddd d d d eQeQdddńZReeLjMddddDŽZSeeLjMdddddd dʜddӄZTeeLjMdddddd dʜddׄZUeeLjMddddلZVeeLjMdddddۄZWeLjMdddddd dݜdd߄ZXeeLjMddd6e(fddZYeeLjMddd6e(dddZZeeLjMddddZ[eeLjMddddZ\eLjMddd dZ]eLjMddd dZ^eeLjMddd dZ_eLjMddd dZ`xZaS(!rBa!!! 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__: Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. __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]rUzClassVar[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]rnzClassVar[Dict[str, FieldInfo]]rXz:ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]__pydantic_setattr_handlers__z&ClassVar[Dict[str, ComputedFieldInfo]]__pydantic_computed_fields__)initDict[str, Any] | None__pydantic_extra__set[str]rdrizXPydantic models should inherit from BaseModel, BaseModel cannot be instantiated directlyzbase-model-instantiatedcode validator) val_or_serr serializer)rcrdrridatar rKrLc zd}|j||}||urtjdddSdS)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)rnvalidate_pythonwarningswarn)selfr__tracebackhide__validated_selfs r\__init__zBaseModel.__init__sg!4DDTY]D^^ ~ % % ML        & %r^Tdict[str, FieldInfo]c$t|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. rXrWclss r\ model_fieldszBaseModel.model_fieldsss12666r^dict[str, ComputedFieldInfo]c$t|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 r\model_computed_fieldszBaseModel.model_computed_fieldsss:B???r^dict[str, Any] | Nonec|jS)zGet extra fields set during validation. Returns: A dictionary of extra fields, or `None` if `config.extra` is not set to `"allow"`. )rrs r\ model_extrazBaseModel.model_extras &&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. )rdrs r\model_fields_setzBaseModel.model_fields_set%s ++r^ _fields_setset[str] | Nonevaluesrc <||}i}t}|jD]\}}|j;|j|vr2||j||<||||vr|jt|jtr |jj n|jg}|D]} t| tr3| |vr/|| ||<||nPt| tr:| |} | tur| ||<||n||vra||vr/||||<||T|s|d|||<||}|jddkr|nd} t'|d|t'|d||jst'|d| |jrZ|dt/|d r4|j-|D]\} } | |jvr | |j| <n|jst'|d d|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_dataextraallowrcrdrri)__new__setrXitemsaliaspoprevalidation_alias isinstancer(choicesrIr)search_dict_for_pathr is_required get_defaultrUrVrtrrmodel_post_inithasattrrir{)rrrm fields_values fields_setrHfieldvalidation_aliasesrrJ_extrakvs r\model_constructzBaseModel.model_construct/s. KK  (* UU 288:: u uKD%{&5;&+@+@&,jj&=&= d#t$$$J&&U-C-O"%"8,GG2E*2201# 0 " "E!%-- "%6//.4jj.?.? d+"t,,,#E955" % : :6 B B (99927M$/&NN4000!E:%%6>>*0**T*:*:M$'NN4((((**,,u*/*;*;QUfs*;*t*tM$'  $K252B2F2Fw2O2OSZ2Z2Z`d:}5554kBBB* = A3V < < <  % =  d # # #q011 6a6L6X"LLNN66DAqA44445.q1, = A5t < < <r^)updatedeeprMapping[str, Any] | Nonerboolc|r|n|}|r|jddkrG|D]1\}}||jvr ||j|<|ji|_||j|<2n|j||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__rUrVrrXrcrrrdkeys)rrrcopiedrrs r\ model_copyzBaseModel.model_copys&)-A""$$$$--//  A $$W--88"LLNN99DAqD444-.**!4<8:F5781!44 9&&v...  * 1 1&++-- @ @ @ r^python) modeincludeexcludecontextby_alias exclude_unsetexclude_defaults exclude_noneexclude_computed_fields round_triprfallbackserialize_as_anyrLiteral['json', 'python'] | strr IncEx | Nonerr Any | Noner bool | Nonerrrrrr'bool | Literal['none', 'warn', 'error']rCallable[[Any], Any] | Nonerdict[str, Any]c R|j|||||||||| | | | | 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. Returns: A dictionary representation of the model. ) rrrrrrrrrrrrr)r to_python)rrrrrrrrrrrrrrs r\ model_dumpzBaseModel.model_dumpsO\+55 '-%$;!-6   r^indent ensure_asciirrrrrrrrrrrrr int | NonerrIcx|j|||||||||| | | | | |S)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. Returns: A JSON string representation of the model. r)rto_jsondecode)rrrrrrrrrrrrrrrs r\model_dump_jsonzBaseModel.model_dump_jsons]^+33 %'-%$;!-4  &((! r^ validationany_of) union_format ref_templateschema_generatortype[GenerateJsonSchema]r2r)Literal['any_of', 'primitive_type_array']c,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. )rrrrr)r4)rrrrrrs r\r4zBaseModel.model_json_schema"s-<! %%-     r^paramstuple[type[Any], ...]ct|tstdd|D}d|}|jd|dS)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.cdg|]-}t|tr|ntj|.S)rrIr$display_as_type).0params r\ z5BaseModel.model_parametrized_name..`s8mmm]b 5# 6 6XuuE! u  !4!4#N7  )99 +:   r^r)rrrr+ json_datastr | bytes | bytearraycxd}|dur|durtdd|j||||||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. TFr/r0rr2)r/rn validate_json)rr3r)rrrr+rs r\model_validate_jsonzBaseModel.model_validate_jsonsm@! u  !4!4#N7  )77 fE7X_f8   r^cxd}|dur|durtdd|j||||||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. TFr/r0rr2)r/rnvalidate_strings)rr,r)rrrr+rs r\model_validate_stringsz BaseModel.model_validate_stringssl4! u  !4!4#N7  ):: eWxY`;   r^sourcerGhandlerr*r8ctjdtd|jd}|!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~) rrrrcrVrr!MockCoreSchemar~)rr;r<schemas r\__get_pydantic_core_schema__z&BaseModel.__get_pydantic_core_schema__(sq    '     !!"<==  j9U&V&V / /wvr^ core_schemar+r3c||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)rrAr<s r\__get_pydantic_json_schema__z&BaseModel.__get_pydantic_json_schema__<s0w{###r^kwargsc dS)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. NrrrDs r\__pydantic_init_subclass__z$BaseModel.__pydantic_init_subclass__Vrr^cdS)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 r\__pydantic_on_complete__z"BaseModel.__pydantic_on_complete__mrr^typevar_values!type[Any] | tuple[type[Any], ...]3type[BaseModel] | _forward_ref.PydanticRecursiveRefc> tj||}||S|turtdt |dst|d|jds t |jvrt|dt|ts|f}tj || td D}tj  r r|}tj|||nn|jd}|s|}nt fd|D}|jd p|}||}tt"tj }tj||5} tj||||}||cdddS| | cdddS t-jd pi} || n#t2$rYnwxYwtj||||}tj|||||dddn #1swxYwY|S) 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 classc3K|]}|VdSrbr)rrs r\ z.BaseModel.__class_getitem__..s"@@Qq@@@@@@r^argsc3BK|]}tj|VdSrb)r replace_types)rarg typevars_maps r\rQz.BaseModel.__class_getitem__..s0__CY4S,GG______r^originr)r)r)r get_cached_generic_type_earlyrBr rrr __bases__rtuplemap_generic_model_argumentsrr& all_identicalrset_cached_generic_typer dictfromkeysiter_contained_typevarsgeneric_recursion_self_typeget_cached_generic_type_later%rr'r.create_generic_submodel) rrJcachedsubmodel parent_argsrRrW model_namermaybe_self_typer%rVs @r\__class_getitem__zBaseModel.__class_getitem__xs|8nMM  M )  _`` `s,-- mskkkll l0> =7RUR_C_C_s;;;<< <.%00 /,.N!8 L L L L;FCK `%____S^_____6x@GCF77==J i? @S@S@U@UVVWWF6vtDD _"?^U[]abb%! _ _ _ _ _ _ _ _ #.*  _ _ _ _ _ _ _ _  !. DRS T T T ZXZI(()(DDDD2D %z&BaseModel.__copy__..s)bbb$!QqPaGaGaAGaGaGar^) rRrrtrrcrrdrrir)rrrs r\rzBaseModel.__copy__s4jj KK  :tDM':':;;;/d6M1N1NOOO4d4;W6X6XYYYt344 8Q8Y A5t < < < < &bb$";"A"A"C"Cbbb    r^memodict[int, Any] | Nonec t|}||}t|dt|j|t|dt|j|t|dt |jt|dr|j t|ddnAt|dtd|j D||S)z!Returns a deep copy of the model.rc)rorrdriNc,i|]\}}|tu||Srrlrms r\rnz*BaseModel.__deepcopy__..s*kkk41aPQYjPjPj!QPjPjPjr^) rRrrtrrcrrrdrrir)rrorrs r\rzBaseModel.__deepcopy__s4jj KK  :x D'I'I'IJJJ/$:QX\1]1]1]^^^ 4d4;W6X6XYYYt344 8Q8Y A5t < < < < &kk4+D+J+J+L+Lkkkrvwww    r^itemcxt|d}||vr||}t|dr#||t |S |j|S#t $r,}tt |jd||d}~wwxYw t|d}n#t$rd}YnwxYw|r ||vr||St|j |r!t|Stt |jd|)Nr{__get__ object has no attribute r) rj__getattribute__rrurRriKeyErrorAttributeErrorrZ __class__super)rrsprivate_attributes attributeexcpydantic_extrarzs r\ __getattr__zBaseModel.__getattr__st!'!8!8?W!X!X ))).t4 9i00?$,,T4::>>>o4T::ooo(DJJ,?)d)d\`)d)deeknno *%+%<%.s9J9J5RU9V9Vr^rvrc0||Srbr)r_rr`r#s r\rpz,BaseModel._setattr_handler..1seS1I1Ir^rorr"z" object has no field "rwru)rzrzryrZris_valid_field_namer{rVrrxrtrWrrr]propertyrUrX ValueErrorr)rrHrJrr#r}s @@r\rzBaseModel._setattr_handler s.Cs)))$ee#,eeEH\eeTXeee066 !$!;!?!?!E!EEIRy)44CVVVVV7 BB#D$66643d++D $00 C/0ABB #tU + + +$)) ?IIIII!%%&;<< ?/0EFFS444#''00G;;$%U%U%Ud%U%U%UVVV\49D+D144MBB/ >>r^c|j}||jvrk|j|}t|dr||dS |j|=dS#t $r}t |jd||d}~wwxYwt||d}t|trt ||St||d||jvrt ||dS|j||jvr |j|=dS t ||dS#t $r't t!|jd|wxYw)N __delete__rv)rHrJ)rzr{rrrirxryrZrWrrrj __delattr__r]rXrrR)rrsrr}r~r#s r\rzBaseModel.__delattr__Bs.Ct222 7= 9l33((...Fh1$7Fhhh(CL)])]UY)])]^^dggh3d++D$00 6))$555 #D 5 5 5 5t///""4.....(4AX9X9X+D111f&&tT22222%fff(DJJ,?)d)d\`)d)deeefs$A A9A44A9D--1Echangesc .||S)N)r)r)rrs r\ __replace__zBaseModel.__replace__es??'?22 2r^dict[Any, Any]c||j}|rd|D}|j|j|j|dS)Nc,i|]\}}|tu||Srrlrms r\rnz*BaseModel.__getstate__..ks)VVV11DU;U;Uq!;U;U;Ur^)rcrrdri)rirrcrrd)rrvs r\ __getstate__zBaseModel.__getstate__hsQ+  WVV VVVG "&"9'+'C$+    r^statec.t|d|dit|d|dit|d|dit|d|didS)Nrdrrirc)rtrV)rrs r\ __setstate__zBaseModel.__setstate__ss7C\^`9a9abbb2EII>RTV4W4WXXX4eii@VXZ6[6[\\\j%))J*C*CDDDDDr^otherc t|trh|jdp|j}|jdp|j}||kr4t |ddt |ddkr|j|jksdS|j|jkrdSt|j }|j |kr|j |krdS|rtj |nd} ||j||jkS#t$rMtj|j}tj|j}||||kcYSwxYwtS)NrWriFTctjSrb)r& _SENTINEL_s r\rpz"BaseModel.__eq__..s [a[kr^)rrBrrzrWrrcrRrXroperator itemgetterrxr&SafeGetItemProxyNotImplemented)rr self_type other_typergetterself_fields_proxyother_fields_proxys r\__eq__zBaseModel.__eq__{s%++4 &!>xHZDN "@J]eo ++&4J4JJJSSS )/(? (N(N%)/)@)P)P&!6"344?Q8R8RRRRRS&%s!D%%AE<;E<Unpack[ConfigDict]c dS)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. NrrFs r\__init_subclass__zBaseModel.__init_subclass__rr^rDc#Kd|jDEd{V|j}|r|Ed{VdSdS)zSo `dict(model)` works.cFg|]\}}|d||fSr) startswithrms r\rz&BaseModel.__iter__..s2XXXv1allSVFWFWXQFXXXr^N)rcrr)rrs r\__iter__zBaseModel.__iter__szXX)<)<)>)>XXXXXXXXXX'  %{{}} $ $ $ $ $ $ $ $ $ % %r^c\|d|ddS)N(r)) __repr_name__ __repr_str__rs r\__repr__zBaseModel.__repr__s3$$&&CC):):4)@)@CCCCr^_repr.ReprArgsc#KfdjD}jD]L\}}j|}|r+|jr$|ur||fV3||fVM td}n#t$rd}YnwxYw|$d|DEd{V|Ed{VdS)NcHg|]\}}|j |t|fSr)reprrW)rrrrs r\rz+BaseModel.__repr_args__..sE% % % &*a[\[a% a  !% % % r^rc3$K|] \}}||fV dSrbrrms r\rQz*BaseModel.__repr_args__..s*BB41aABBBBBBr^) rrrcrXrVr__repr_recursion__rjrwry)rcomputed_fields_repr_argsrrrrs` r\ __repr_args__zBaseModel.__repr_args__sZ% % % % .2.O.U.U.W.W% % % !M'')) 8 8DAq,0033E 8 8D==Q$JJJJT44Q777777  "#44T;OPPNN " " "!NNN "  %BB>+?+?+A+ABBB B B B B B B B,,,,,,,,,,sB,, B;:B;c,|dS)N )rrs r\__str__zBaseModel.__str__s  %%%r^XThe `__fields__` attribute is deprecated, use the `model_fields` class property instead.)categorycvtjdtdtt |diS)NrrrrrX)rrrrWrRrs r\ __fields__zBaseModel.__fields__sA  f.    tDzz#8"===r^MThe `__fields_set__` attribute is deprecated, use `model_fields_set` instead.cHtjdtd|jS)Nrrr)rrrrdrs r\__fields_set__zBaseModel.__fields_set__ s1  [.    ++r^:The `dict` method is deprecated; use `model_dump` instead.rrrrrrDict[str, Any]cptjdtd|||||||S)Nrrrr)rrrr)rrrrrrrs r\r^zBaseModel.dictsU  H.    '-%    r^?The `json` method is deprecated; use `model_dump_json` instead.)rrrrrrencodermodels_as_dictrr dumps_kwargsc tjdtd|turt d|turt d| rt d|||||||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)rrrrr r) rrrrrrrrrrs r\jsonzBaseModel.json0s  M.    + + +kll l !2 2 2stt t  YWXX X##'-% $   r^CThe `parse_obj` method is deprecated; use `model_validate` instead.cdtjdtd||S)Nrrrrrrr1rr,s r\ parse_objzBaseModel.parse_objRs<  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_pickleb str | bytesr str | NonerrDeprecatedParseProtocol | Nonerctjdtdddlm} ||||||}n#t tf$r}ddl} t|trd} n2t|| j rd } nt|t rd } nd } tj | t|d |d } tj|j| gd}~wwxYw||S)Nrrrrparserrrrrzvalue_error.unicodedecodezvalue_error.jsondecode value_error type_error)__root__rQ)rrr deprecatedrload_str_bytesrr rrUnicodeDecodeErrorJSONDecodeError pydantic_corePydanticCustomErrorrIrrYrZr1) rrrrrrrr,r~rtype_strerrors r\ parse_rawzBaseModel.parse_raw\sX   I.     &%%%%% [&&)!) 'CCI& [ [ [ KKK#122 (6C!566 (3C,, ((' &9(CHHMM$ 55E  /CCCLSXRYZZ Z) [*!!#&&&s?C/BC**C/The `parse_file` method is deprecated; load the data from file, then if your data is JSON use `model_validate_json`, otherwise `model_validate` instead.path str | Pathctjdtdddlm}||||||}||S)Nrrrrrr)rrrrr load_filer)rrrrrrrr,s r\ parse_filezBaseModel.parse_filesx   M.     &%%%%%oo %%   }}S!!!r^qThe `from_orm` method is deprecated; set `model_config['from_attributes']=True` and use `model_validate` instead.ctjdtd|jddst dd||S)Nrrrr*zHYou must set the config attribute `from_attributes=True` to use from_ormr)rrrrUrVr/r1rs r\from_ormzBaseModel.from_ormsz   W.     ##$5t<< #Zae !!#&&&r^DThe `construct` method is deprecated; use `model_construct` instead.c Xtjdtd|jdd|i|S)Nrrrrr)rrrr)rrrs r\ constructzBaseModel.constructsF  R.    #s"EE{EfEEEr^The `copy` method is deprecated; use `model_copy` instead. See the docstring of `BaseModel.copy` for details about how to handle `include` and `exclude`.)rrrr+AbstractSetIntStr | MappingIntStrAny | Nonec tjdtdddlm}t ||dd||dfi|pi}|jd}n#d |jD}|j d}n||j }t|j D]} | |vr| | t|D]#} | |j vr| | || <$|r|j |z} nt|j } |r| t|z} |||| ||| S) 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_dictrrrrNc,i|]\}}|tu||Srrlrms r\rnz"BaseModel.copy..s)hhh1QVgMgMgq!MgMgMgr^)r)rrrrrr^_iterrirrrlistrrdrr_copy_and_set_values) rrrrrrrrvrrrs r\rzBaseModel.copysF   m.     /.....  eeWgej !    |     $ ,GGhh(A(G(G(I(IhhhG  " *+/EE+0022E$122 ! !F??IIaLLL&\\ - -///%zz!}}E!H  ;5 EJJT9::J  ' #g,, &J224UT[bf2gggr^CThe `schema` method is deprecated; use `model_json_schema` instead.chtjdtd|||S)Nr rrrr)rrrr4)rrrs r\r?zBaseModel.schemasA  Q.    $$h\$RRRr^WThe `schema_json` method is deprecated; use `model_json_schema` and json.dumps instead.rc tjdtdddl}ddlm}|j|||fd|i|S) Nrrrrr)pydantic_encoderrdefault)rrrrdeprecated.jsonrdumpsr4)rrrrrrs r\ schema_jsonzBaseModel.schema_json(s  e.     555555tz  ! !8, ! O O  $    r^BThe `validate` method is deprecated; use `model_validate` instead.cdtjdtd||S)Nrrrr)rrJs r\validatezBaseModel.validate?s<  P.    !!%(((r^LThe `update_forward_refs` method is deprecated; use `model_rebuild` instead.localnsc tjdtd|rtd|ddS)Nrrrz,`localns` arguments are not longer accepted.T)r)rrrr r')rrs r\update_forward_refszBaseModel.update_forward_refsIs]  Z.     LJKK K %%%%%r^HThe private method `_iter` will be removed and should no longer be used.rRchtjdtdddlm}|j|g|Ri|S)Nrrrrr)rrrrrr rrRrDrs r\r zBaseModel._iterXs]  V.    /.....#~#D:4:::6:::r^WThe private method `_copy_and_set_values` will be removed and should no longer be used.chtjdtdddlm}|j|g|Ri|S)Nr rrrr)rrrrrr rs r\r zBaseModel._copy_and_set_valueses]  e.    /.....2~24I$III&IIIr^MThe private method `_get_value` will be removed and should no longer be used.chtjdtdddlm}|j|g|Ri|S)Nr"rrrr)rrrrr _get_value)rrRrDrs r\r$zBaseModel._get_valuess]  [.    /.....(~(>t>>>v>>>r^RThe private method `_calculate_keys` will be removed and should no longer be used.chtjdtdddlm}|j|g|Ri|S)Nr%rrrr)rrrrr_calculate_keysrs r\r'zBaseModel._calculate_keyss]  `.    /.....-~-dDTDDDVDDDr^)rr rKrL)rKr)rKr)rKr)rKrrb)rrrr rKr)rrrrrKr)rrrrrrrrrrrrrrrrrrrrrrrrrrrKr)rrrrrrrrrrrrrrrrrrrrrrrrrrrrrKrI) rrrrIrrrr2rrrKr)rrrKrI)rr rKrL) rrrrrrrrrKr)r,r r)rrr-r*rrrrrr+rrKr)r3r4r)rrr-rrrrr+rrKr)r,r r)rrr-rrrrr+rrKr)r;rGr<r*rKr8)rAr8r<r+rKr3)rDr rKrL)rKrL)rJrKrKrL)rKr)rorprKr)rsrIrKr )rHrIrJr rKrL)rHrIrJr rKr)rr rKr)rKr)rrrKrL)rr rKr)rDr)rKrD)rKrI)rKr)rrrrrrrrrrrrrKr)rrrrrrrrrrrrrrrrrr rKrI)r,r rKr) rrrrrrIrrrrrKr) rrrrrrIrrrrrKr) rrrrrrrrrKr)rrrrIrKr)rrrrIrr rKrI)rJr rKr)rr rKrL)rRr rDr rKr )brZ __module__ __qualname____doc__r,rU__annotations__r}rDecoratorInfosrrrr" NoInitFieldrrdrir r!r>r~rrnr __slots__r__pydantic_base_init__r&deprecated_instance_property classmethodrrrrrrrrrr0r1r4r rr'r1r7r:r@rCrGrIrirrrrkrrrrrrrrrrr$Representationrrr __pretty__ __rich_repr__rtyping_extensionsrrrr^rrrrrrrrr?rrrr r r$r' __classcell__)rzs@r\rBrBvsD D*4L5555'&&&@AAAA=&&&&S,11111V2222',,,,;E_KD^D`D`````^ONNNlFJ!IIIIQGGGGE.33333N7777UPPPPX7777^]]]uHHHHI0O0C0OUZ0[0[0[[[[[s(G(;(GU(S(S(SSSSSB2Q2E2QW\2]2]2]]]]]A  $@=#? f*$ $ $  ":!9 f"*" " "  #;-": f#*# # #  dI('+H# (777[)(7 (@@@[)(@'''X',,,X,NNNN[N`@DRW      J19 $ $" $#!&"(- <@04!&= = = = = = D"" $ $" $#!&"(- <@04!&!??????B05G+ $ CK$ $ $ $ $ [$ L555[54    !'(48 9 9 9 9 9 [9 v #$('+" $#. . . . . [. ` #$(" $#) ) ) ) ) [) V #$(" $## # # # # [# J[&$$$[$2   [ ,   [ AAAAF&* C3 j j j j j j: K K K K4 ?4 ?4 ?4 ?l f f f fF 3 3 3 3     EEEE 7&5 &5 &5 &5 &n     ,%%%%DDDD----:(6M-@'4L%0J(6M&&&&!!bmq>>>X>!!W,,, X ,"!"^imnnn!% $#!&"     on 0"!"cnrsss!% $#!&"/@0     ts B!!"grvwww'''xw['!! E$(04".'.'.'.'.' [ .'`!! I$(04"""""" [ "4!! S ' ' ' [ '!!"hswxxxFFFFyx[F"! i@D?C(, FhFhFhFhFh  FhP!!"grvwww"8LSSSSxw[S!!a "&;O     [  $!!"fquvvv)))wv[)!!V&&& [ &"!R]a;;;;"!aJJJ J!!W??? [ ?"!\EEE EEEEEr^) metaclassModelT)bound) __config__r*__base__r(__validators____cls_kwargs__r)rgr:ConfigDict | Noner*rr;r(r<$dict[str, Callable[..., Any]] | Noner=rr)field_definitionsAny | tuple[str, Any]c dSrbr rgr:r*r;r(r<r=r)r@s r\rCrCs cr^)r:r*r(r<r=r)'type[ModelT] | tuple[type[ModelT], ...] type[ModelT]c dSrbrrCs r\rCrCs 3r^.type[ModelT] | tuple[type[ModelT], ...] | Nonec |tdtf}nt|ts|f}|pi}i} i} |D]^\} } t| tr?t | dkrt d| dd| d| | <| d | | <Y| | | <_|!tjd } | j d }| |d }|r||d <|||d <|r| || | |r||d<tj |}tj |||\}}}||ur||d<| |||||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. NrErzField 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-definitionsrrrrZ)r+r(r*r)rU)kwds__orig_bases__F)#__pydantic_reset_parent_namespace___create_model_module)rrBrrZrlenr/sys _getframe f_globalsrtypes resolve_bases prepare_class)rgr:r*r;r(r<r=r)r@fieldsrf_namef_deff namespaceresolved_basesmetansrIs r\rCrCsb335 % ( (;#)rNF"$K*0022 ( (  eU # # (5zzQ'}F}}}9 #((K "1XF6NN"'K   M!  [, 4?z Z ZI'& )$0 .!)((( V/$. .!(22N(^.YYYND"dX%%'  R 4 -2'       r^)rFrGrHrIrJr rKrL)r_rBrHrIr`r rKrL)rgrIr:r>r*rr;rLr(rIr<r?r=rr)rr@rArKrG)rgrIr:r>r*rr;rDr(rIr<r?r=rr)rr@rArKrE)rgrIr:r>r*rr;rGr(rr<r?r=rr)rr@rArKrE)or* __future__r _annotationsrrNrQrcollections.abcrrrr functoolsrtypingr r r r r rrrrrrrr5rrrrrrr _internalrrrrr r!r"r#r$r%r& _migrationr'aliasesr(r)annotated_handlersr*r+configr,r-errorsr.r/ json_schemar0r1r2r3r4plugin._schema_validatorr5inspectr6pathlibr7r8r9r:_internal._namespace_utilsr;_internal._utilsr<r=deprecated.parser>DeprecatedParseProtocolrTr?r@rA__all__rZrIrDr+rrrrEobject_setattrrtr]rgrlrxModelMetaclassrBr8rZrCrrr^r\rssz 322222 ........%%%%%%                          <<<<<<<<5555555555CCCCCCCC                          *))))),,,,,,,,JJJJJJJJ++++++++BBBBBBBBuuuuuuuuuuuuuu>>>>>> G!!!!!!KKKKKKKKKK<<<<<<EEEEEEEEEEEEEEFFFFFFFFFF &&eCHotT&ABBBBBS3s8WS% :N5N-OQXY\^cdkmqdq^rYrQssttttt%4    ,,,, ++++0vv'UUMM QQXEXEXEXEXE-<XEXEXEXEv0  + + + %);?,0#        %);?,0#       &%)?C!;?,0#ddddddN )) r^