
    RPf/                    >   d dl mZ d dl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 eseZerddl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/d0dd1dd2d3d4dd5dd6dd7dd8dd9dd:dd;dd<d=d>dd?dd@d!Z!dEdAZ" e#ejH                  jK                               Z&h dBZ'ddddd#dddd&d0dC
Z(dFdDZ)y)G    )annotationsN)contextmanager)TYPE_CHECKINGAnyCallablecast)core_schema)LiteralSelf   )AliasGenerator)
ConfigDictExtraValuesJsonDictJsonEncoderJsonSchemaExtraCallable)PydanticUserError)PydanticDeprecatedSince20)GenerateSchemazGSupport 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d/<   d0ed1<   d2ed3<   ded4<   d5ed6<   ded7<   d8ed9<   ded:<   ded;<   d<ed=<   d>d?dFd@ZedGdA       Ze	sdHdBZ
dIdCZdD ZyE)JConfigWrapperzIInternal wrapper for Config which exposes ConfigDict items as attributes.)config_dictr   r   z
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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']ser_json_byteszLiteral['null', 'constants']ser_json_inf_nanvalidate_defaultvalidate_returnztuple[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configrB   s      T/var/www/fastapitest/venv/lib/python3.12/site-packages/pydantic/_internal/_config.py__init__zConfigWrapper.__init__X   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|s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   rE   listkeysconfig_keyspop)clsbases	namespacekwargs
config_newbaserG   config_class_from_namespaceconfig_dict_from_namespaceraw_annotationsconfig_from_namespaceks               rH   	for_modelzConfigWrapper.for_model^   s
   "  \
 	1DT>48F!!&++-0	1
 '0mmH&=#%.]]>%B"#--(92>~.7Q#r6 
 '+E#$Y`mnn : inMh>i/0fkkm$ 	.AK &

1
1	. :rJ   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)rF   names     rH   __getattr__zConfigWrapper.__getattr__   sb    X''-- XX*400 X(+CD8)LMSWWXXs    	A&A?Ac                4   dd}t        j                  di  |di d| j                  j                  d      xs |xr |j                  d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d	| j                  j                  d	      d
| j                  j                  d
      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      d| j                  j                  d      }|S )a  Create a pydantic-core config, `obj` is just used to populate `title` if not set in config.

        Pass `obj=None` if you do not want to attempt to infer the `title`.

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

        Args:
            obj: An object used to populate `title` if not set in config.

        Returns:
            A `CoreConfig` object created from config.
        c                 \    | j                         D ci c]  \  }}|	|| c}}S c c}}w rD   )items)r[   rb   vs      rH   dict_not_nonez0ConfigWrapper.core_config.<locals>.dict_not_none   s(    %+\\^ETQq}AqDEEEs   
((r   extra_fields_behaviorr!   r+   r#   r   r   r   r.   r0   r1   r2   r'   r(   r/   r3   r    r   r6   r<   r=   r>   r@   )r[   r   returnr    )r	   
CoreConfigr   rS   __name__)rF   objrn   core_configs       rH   ru   zConfigWrapper.core_config   s   	F ",, 
 &&**73M8L&*&6&6&:&:7&C #..22?C "&!1!1!5!56H!I	
 &*%5%5%9%9:P%Q "--11.A "--11.A ''++H5 $(#3#3#7#78L#M  $//334DE "&!1!1!5!56H!I !% 0 0 4 45F G "--11.A &*%5%5%9%9:P%Q "&!1!1!5!56H!I   $//334DE!"  $//334DE#$ &*%5%5%9%9:P%Q%& '+&6&6&:&:;R&S'( "--11.A)* (,'7'7';';<T'U+, #..22?C-
4 rJ   c                n    dj                  d | j                  j                         D              }d| dS )Nz, c              3  0   K   | ]  \  }}| d |  yw)=Nrq   ).0rb   rm   s      rH   	<genexpr>z)ConfigWrapper.__repr__.<locals>.<genexpr>   s     Htq!1QElHs   zConfigWrapper())joinr   rl   )rF   cs     rH   __repr__zConfigWrapper.__repr__   s4    IIHt/?/?/E/E/GHHs!$$rJ   N)rG   .ConfigDict | dict[str, Any] | type[Any] | NonerB   r   )rY   ztuple[type[Any], ...]rZ   dict[str, Any]r[   r   rp   r   )rh   strrp   r   )rt   r   rp   zcore_schema.CoreConfig)rs   
__module____qualname____doc__	__slots__rN   rI   classmethodrc   r   ri   ru   r~   rq   rJ   rH   r   r   "   s+   S I L!! AA##@@99 LJJ33--22))--11155KK44  ""88`d 8 + +\ 	X+Z%rJ   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 rD   _config_wrapper_stackrF   config_wrappers     rH   rI   zConfigWrapperStack.__init__   s    ;I:J"rJ   c                     | j                   d   S )Nr   )rF   s    rH   tailzConfigWrapperStack.tail   s    ))"--rJ   c              #    K   |d  y t        |t              st        |d      }| j                  j                  |       	 d  | j                  j	                          y # | j                  j	                          w xY ww)NFrA   )
isinstancer   r   appendrW   r   s     rH   pushzConfigWrapperStack.push   sh     !.-8*>GN"")).9	-&&**,D&&**,s   A BA" B"A>>BN)r   r   )rp   r   )r   z!ConfigWrapper | ConfigDict | None)	rs   r   r   r   rI   propertyr   r   r   rq   rJ   rH   r   r      s3    /K . . - -rJ   r   r   r   Fr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   Tr)   r*   rq   r+   r,   r.   r/   neverr0   iso8601r1   utf8r2   nullr3   r4   r5   )model_r6   r-   r7   r8   r9   r:   r;   r<   r=   z
rust-regexr>   r?   r@   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   dictwarningswarnDEPRECATION_MESSAGEDeprecationWarningdir
startswithrP   r   check_deprecated)rG   rb   r   s      rH   rE   rE     sz     ~|fd#)+=>14VWAALLQUDV!WVQ''W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_KEYSrU   V2_RENAMED_KEYSsortedrl   r|   r   r   UserWarning)	r   deprecated_removed_keysdeprecated_renamed_keysrb   	renamingsrm   renamed_bulletsremoved_bulletsmessages	            rH   r   r   A  s     .0@0@0BB-224{7G7G7II"94:;R4STqQ**T	TLUOOL]^DAqRu$9!?^^@FG^@_`1Ru$56``))DEWZiijg{+ #:T^`s   C4CC$)rG   r   rp   r   )r   r   rp   None)*
__future__r   _annotationsr   
contextlibr   typingr   r   r   r   pydantic_corer	   typing_extensionsr
   r   aliasesr   rG   r   r   r   r   r   errorsr   r   r   #_internal._schema_generation_sharedr   r   r   r   rf   rE   setrN   rU   rV   r   r   r   rq   rJ   rH   <module>r      sI   2  %  &
 % \ \ & 0 3D_ e% e%P- -4  (
(( ( 	(
 ( ( ( ( ( ( ( "( ( (  !(" #($ %(& '(( )(* !+(, !-(. /(0 1(2 3(4 5(6 %7(8 9(: ;(< =(> ?(@ A(B 16C(D #E(F  G(H I(J !K(L #M(N O(V* *,,1134 '9"5"%))!'&,rJ   