
    g1                    p   d dl mZ d dlZd dlmZ d dlmZ d dlm	Z	m
Z
mZmZ d dlmZ d dlmZmZ dd	lmZ dd
lmZmZmZmZmZ ddlmZ ddlmZmZ e	seZe	rddlm Z  ddl!m"Z"m#Z# dZ$ G d d      Z% G d d      Z& ed(i dddddddddd ddddddddddddd dd!dd"d#d$dd%dd&dd'd(d)d#d*dd+dd,d-d.d/d0d1d2d1d3d4d5dd6dd7d8d9dd:dd;dd<dd=dd>dd?dd@ddAdBdCddDddEd#Z'dJdFZ( e)ejT                  jW                               Z,h dGZ-ddddd'ddd!d*d5dH
Z.dKdIZ/y)L    )annotationsN)contextmanager)Pattern)TYPE_CHECKINGAnyCallablecast)core_schema)LiteralSelf   )AliasGenerator)
ConfigDictExtraValuesJsonDictJsonEncoderJsonSchemaExtraCallable)PydanticUserError)PydanticDeprecatedSince20PydanticDeprecatedSince210)GenerateSchema)ComputedFieldInfo	FieldInfozGSupport for class-based `config` is deprecated, use ConfigDict instead.c                     e Zd ZU dZdZded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded <   d!ed"<   d#ed$<   ded%<   d&ed'<   d(ed)<   d*ed+<   d*ed,<   d-ed.<   ded/<   ded0<   d1ed2<   ded3<   ded4<   d5ed6<   d7ed8<   ded9<   d:ed;<   ded<<   d=ed><   ded?<   ded@<   dAedB<   dCdDdKdEZedLdF       Ze	sdMdGZ
dNdHZdI ZyJ)OConfigWrapperzIInternal wrapper for Config which exposes ConfigDict items as attributes.)config_dictr   r   
str | Nonetitleboolstr_to_lowerstr_to_upperstr_strip_whitespaceintstr_min_lengthz
int | Nonestr_max_lengthzExtraValues | Noneextrafrozenpopulate_by_nameuse_enum_valuesvalidate_assignmentarbitrary_types_allowedfrom_attributesloc_by_aliasz,Callable[[str], str] | AliasGenerator | Nonealias_generatorzCallable[[type], str] | Nonemodel_title_generatorz:Callable[[str, FieldInfo | ComputedFieldInfo], str] | Nonefield_title_generatorztuple[type, ...]ignored_typesallow_inf_nanz)JsonDict | JsonSchemaExtraCallable | Nonejson_schema_extraz&dict[type[object], JsonEncoder] | Nonejson_encodersstrictz0Literal['always', 'never', 'subclass-instances']revalidate_instanceszLiteral['iso8601', 'float']ser_json_timedeltaz Literal['utf8', 'base64', 'hex']ser_json_bytesval_json_bytesz'Literal['null', 'constants', 'strings']ser_json_inf_nanvalidate_defaultvalidate_returnztuple[str | Pattern[str], ...]protected_namespaceshide_input_in_errorsdefer_buildzdict[str, object] | Noneplugin_settingsztype[GenerateSchema] | Noneschema_generator+json_schema_serialization_defaults_requiredz,Literal['validation', 'serialization', None]json_schema_mode_overridecoerce_numbers_to_strz"Literal['rust-regex', 'python-re']regex_enginevalidation_error_causeuse_attribute_docstringsz%bool | Literal['all', 'keys', 'none']cache_stringsTcheckc               T    |rt        |      | _        y t        t        |      | _        y N)prepare_configr   r	   r   )selfconfigrJ   s      O/var/www/openai/venv/lib/python3.12/site-packages/pydantic/_internal/_config.py__init__zConfigWrapper.__init__]   s!    -f5D#J7D    c                   t               }|D ]1  }t        |dd      }|s|j                  |j                                3 |j	                  d      }|j	                  d      }|j	                  di       }	|	j	                  d      r|t        dd      |r|rt        dd	      |xs t        |      }
|j                  |
       t        |j                               D ]  }|t        v s|j                  |      ||<   !  | |      S )
a  Build a new `ConfigWrapper` instance for a `BaseModel`.

        The config wrapper built based on (in descending order of priority):
        - options from `kwargs`
        - options from the `namespace`
        - options from the base classes (`bases`)

        Args:
            bases: A tuple of base classes.
            namespace: The namespace of the class being created.
            kwargs: The kwargs passed to the class being created.

        Returns:
            A `ConfigWrapper` instance for `BaseModel`.
        model_configNConfig__annotations__z``model_config` cannot be used as a model field name. Use `model_config` for model configuration.zmodel-config-invalid-field-name)codez3"Config" and "model_config" cannot be used togetherzconfig-both)r   getattrupdatecopygetr   rM   listkeysconfig_keyspop)clsbases	namespacekwargs
config_newbaserO   config_class_from_namespaceconfig_dict_from_namespaceraw_annotationsconfig_from_namespaceks               rP   	for_modelzConfigWrapper.for_modelc   s   "  \
DT>48F!!&++-0 
 '0mmH&=#%.]]>%B"#--(92>~.3M3U#r6 
 '+E#$Y`mnn : inMh>i/0fkkm$AK &

1
1 % :rR   c                    	 | j                   |   S # t        $ r) 	 t        |   cY S # t        $ r t        d|      d w xY ww xY w)NzConfig has no attribute )r   KeyErrorconfig_defaultsAttributeError)rN   names     rP   __getattr__zConfigWrapper.__getattr__   sb    X''-- XX*400 X(+CD8)LMSWWXXs    	A&A?Ac           
     2   | j                   }|j                  d      t        j                  dt        d       i d|j                  d      xs |xs dd|j                  d      d	|j                  d	      d
|j                  d
      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      d|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      d}t        j                  di |j                         D ci c]  \  }}|	|| c}}S c c}}w ) a  Create a pydantic-core config.

        We don't use getattr here since we don't want to populate with defaults.

        Args:
            title: The title to use if not set in config.

        Returns:
            A `CoreConfig` object created from config.
        rA   NzfThe `schema_generator` setting has been deprecated since v2.10. This setting no longer has any effect.r   )
stacklevelr   extra_fields_behaviorr&   r2   r(   r"   r    r!   r5   r7   r8   r9   r:   r,   r-   r6   r;   r%   r$   r>   rD   rE   rF   rH   )r$   r>   rD   rE   rF   rH    )r   r[   warningswarnr   r
   
CoreConfigitems)rN   r   rO   core_config_valuesrj   vs         rP   core_configzConfigWrapper.core_config   sF    !!::()5MMx*
VZZ(9E9T
#VZZ%8
 VZZ8
 

+= >	

 #FJJ/E$F
 FJJ~6
 FJJ~6
 fjj*
 !&**-A"B
 fjj)9:
 fjj)9:
 

+= >
 vzz*;<
 FJJ~6
 #FJJ/E$F
  

+= >!
" fjj)9:#
$ %jj)9:$*JJ/E$F%+ZZ0G%H"JJ~6&,jj1I&J#ZZ8/
4 %%g:L:R:R:T(f:T$!QXYXeA:T(fgg(fs   =
HHc                n    dj                  d | j                  j                         D              }d| dS )Nz, c              3  0   K   | ]  \  }}| d |  yw)=Nru   ).0rj   r{   s      rP   	<genexpr>z)ConfigWrapper.__repr__.<locals>.<genexpr>   s!     H/Gtq!1QEl/Gs   zConfigWrapper())joinr   ry   )rN   cs     rP   __repr__zConfigWrapper.__repr__   s4    IIHt/?/?/E/E/GHHs!$$rR   N)rO   .ConfigDict | dict[str, Any] | type[Any] | NonerJ   r   )ra   ztuple[type[Any], ...]rb   dict[str, Any]rc   r   returnr   )rp   strr   r   )r   r   r   zcore_schema.CoreConfig)__name__
__module____qualname____doc__	__slots__rV   rQ   classmethodrk   r   rq   r|   r   ru   rR   rP   r   r   $   s>   S I L!! AA77UU##@@99 LJJ334444==88--11155KK44  ""88`d 8 + +\ 	X.h`%rR   r   c                  <    e Zd ZdZddZedd       Zedd       Zy)	ConfigWrapperStackz%A stack of `ConfigWrapper` instances.c                    |g| _         y rL   _config_wrapper_stackrN   config_wrappers     rP   rQ   zConfigWrapperStack.__init__   s    ;I:J"rR   c                     | j                   d   S )Nr   )rN   s    rP   tailzConfigWrapperStack.tail   s    ))"--rR   c              #    K   |d  y t        |t              st        |d      }| j                  j                  |       	 d  | j                  j	                          y # | j                  j	                          w xY ww)NFrI   )
isinstancer   r   appendr_   r   s     rP   pushzConfigWrapperStack.push   sh     !.-8*>GN"")).9	-&&**,D&&**,s   A BA" B"A>>BN)r   r   )r   r   )r   z!ConfigWrapper | ConfigDict | None)	r   r   r   r   rQ   propertyr   r   r   ru   rR   rP   r   r      s3    /K . . - -rR   r   r   r    Fr!   r"   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   Tr.   r/   r0   r1   ru   r2   r3   r5   r6   neverr7   iso8601r8   utf8r9   r:   nullr;   r<   r=   )model_validate
model_dumpr>   r4   r?   rA   r@   rB   rC   rD   rE   z
rust-regexrF   rG   rH   c                $   | 
t               S t        | t              sSt        j                  t
        t               t        |       D ci c]!  }|j                  d      r|t        | |      # } }t        t         |       }t        |       |S c c}w )zCreate a `ConfigDict` instance from an existing dict, a class (e.g. old class-based config) or None.

    Args:
        config: The input config.

    Returns:
        A ConfigDict object created from config.
    __)r   r   dictrv   rw   DEPRECATION_MESSAGEDeprecationWarningdir
startswithrX   r	   check_deprecated)rO   rj   r   s      rP   rM   rM     s{     ~|fd#)+=>14VWAALLQUDV!WVQ''Wz6*K[!	 Xs   BB>
   fields
json_dumps
json_loadsgetter_dictsmart_unionallow_mutationpost_init_callerror_msg_templatescopy_on_model_validationunderscore_attrs_are_private)
allow_population_by_field_nameanystr_loweranystr_strip_whitespaceanystr_upperkeep_untouchedmax_anystr_lengthmin_anystr_lengthorm_modeschema_extravalidate_allc                   t         | j                         z  }t        j                         | j                         z  }|s|rt        |      D ci c]  }|t        |    }}|j	                         D cg c]  \  }}d|d| }}}t        |      D cg c]  }d|d
 }}dj                  dg|z   |z         }t        j                  |t               yyc c}w c c}}w c c}w )zjCheck for deprecated config keys and warn the user.

    Args:
        config_dict: The input config.
    z* z has been renamed to z has been removed
z%Valid config keys have changed in V2:N)	V2_REMOVED_KEYSr]   V2_RENAMED_KEYSsortedry   r   rv   rw   UserWarning)	r   deprecated_removed_keysdeprecated_renamed_keysrj   	renamingsr{   renamed_bulletsremoved_bulletsmessages	            rP   r   r   L  s     .0@0@0BB-224{7G7G7II"94:;R4ST4SqQ**4S	TLUOOL]^L]DAqRu$9!?L]^@FG^@_`@_1Ru$56@_`))DEWZiijg{+ #:T^`s   C4CC$)rO   r   r   r   )r   r   r   None)0
__future__r   _annotationsrv   
contextlibr   rer   typingr   r   r   r	   pydantic_corer
   typing_extensionsr   r   aliasesr   rO   r   r   r   r   r   errorsr   r   r   r   #_internal._schema_generation_sharedr   r   r   r   r   r   r   rn   rM   setrV   r]   r^   r   r   r   ru   rR   rP   <module>r      ss   2  %   &
 % \ \ & L 3D5_ k% k%\- -4  +
++ + 	+
 + + + + + + + "+ + +  !+" #+$ %+& '+( )+* ++, -+. !/+0 !1+2 3+4 5+6 7+8 9+: ;+< :=+> ?+@ A+B C+D E+F G+H 16I+J #K+L  M+N O+P !Q+R #S+T U+\* *,,1134 '9"5"%))!'&,rR   