U
    ={f=                     @  s   d dl mZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ dd	lmZmZmZmZmZmZmZmZmZ G d
d de	ddZeeej O ZG dd deZdS )    )annotations)Path)AnyClassVar)
ConfigDict)config_keys)deep_update)	BaseModel   )	ENV_FILE_SENTINELCliSettingsSourceDotEnvSettingsSource
DotenvTypeEnvSettingsSourceInitSettingsSourcePathTypePydanticBaseSettingsSourceSecretsSettingsSourcec                   @  s   e Zd ZU 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%S )&SettingsConfigDictboolcase_sensitivestr
env_prefixDotenvType | Noneenv_file
str | Noneenv_file_encodingenv_ignore_emptyenv_nested_delimiterenv_parse_none_strbool | Noneenv_parse_enumscli_prog_name)bool | list[str] | tuple[str, ...] | Nonecli_parse_argsCliSettingsSource[Any] | Nonecli_settings_sourcecli_parse_none_strcli_hide_none_typecli_avoid_jsoncli_enforce_requiredcli_use_class_docs_for_groups
cli_prefixstr | Path | Nonesecrets_dirzPathType | None	json_filejson_file_encoding	yaml_fileyaml_file_encodingintZpyproject_toml_depthztuple[str, ...]Zpyproject_toml_table_header	toml_fileN)__name__
__module____qualname____annotations__ r9   r9   U/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/pydantic_settings/main.pyr      s2   
r   F)totalc                      s  e Zd ZU dZddedddddddddddddddfddddddddddddddddddd	d
d fddZedddddddddZd dddddddddddddddddddddddZe	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Z
ded<   ZS )!BaseSettingsa
  
    Base class for settings, allowing values to be overridden by environment variables.

    This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose),
    Heroku and any 12 factor app design.

    All the below attributes can be set via `model_config`.

    Args:
        _case_sensitive: Whether environment variables names should be read with case-sensitivity. Defaults to `None`.
        _env_prefix: Prefix for all environment variables. Defaults to `None`.
        _env_file: The env file(s) to load settings values from. Defaults to `Path('')`, which
            means that the value from `model_config['env_file']` should be used. You can also pass
            `None` to indicate that environment variables should not be loaded from an env file.
        _env_file_encoding: The env file encoding, e.g. `'latin-1'`. Defaults to `None`.
        _env_ignore_empty: Ignore environment variables where the value is an empty string. Default to `False`.
        _env_nested_delimiter: The nested env values delimiter. Defaults to `None`.
        _env_parse_none_str: The env string value that should be parsed (e.g. "null", "void", "None", etc.)
            into `None` type(None). Defaults to `None` type(None), which means no parsing should occur.
        _env_parse_enums: Parse enum field names to values. Defaults to `None.`, which means no parsing should occur.
        _cli_prog_name: The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`.
            Otherwse, defaults to sys.argv[0].
        _cli_parse_args: The list of CLI arguments to parse. Defaults to None.
            If set to `True`, defaults to sys.argv[1:].
        _cli_settings_source: Override the default CLI settings source with a user defined instance. Defaults to None.
        _cli_parse_none_str: The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into
            `None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if
            _cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`.
        _cli_hide_none_type: Hide `None` values in CLI help text. Defaults to `False`.
        _cli_avoid_json: Avoid complex JSON objects in CLI help text. Defaults to `False`.
        _cli_enforce_required: Enforce required fields at the CLI. Defaults to `False`.
        _cli_use_class_docs_for_groups: Use class docstrings in CLI group help text instead of field descriptions.
            Defaults to `False`.
        _cli_prefix: The root parser command line arguments prefix. Defaults to "".
        _secrets_dir: The secret files directory. Defaults to `None`.
    Nr    r   r   r#   r%   r-   r   None)_case_sensitive_env_prefix	_env_file_env_file_encoding_env_ignore_empty_env_nested_delimiter_env_parse_none_str_env_parse_enums_cli_prog_name_cli_parse_args_cli_settings_source_cli_parse_none_str_cli_hide_none_type_cli_avoid_json_cli_enforce_required_cli_use_class_docs_for_groups_cli_prefix_secrets_dirvaluesreturnc                   s>   t  jf | j||||||||||	|
||||||||d d S )N)r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   )super__init___settings_build_values)Z__pydantic_self__r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   	__class__r9   r:   rS   u   s.    zBaseSettings.__init__ztype[BaseSettings]r   z&tuple[PydanticBaseSettingsSource, ...])settings_clsinit_settingsenv_settingsdotenv_settingsfile_secret_settingsrQ   c                 C  s   ||||fS )a  
        Define the sources and their order for loading the settings values.

        Args:
            settings_cls: The Settings class.
            init_settings: The `InitSettingsSource` instance.
            env_settings: The `EnvSettingsSource` instance.
            dotenv_settings: The `DotEnvSettingsSource` instance.
            file_secret_settings: The `SecretsSettingsSource` instance.

        Returns:
            A tuple containing the sources and their order for loading the settings values.
        r9   )clsrW   rX   rY   rZ   r[   r9   r9   r:   settings_customise_sources   s    z'BaseSettings.settings_customise_sourceszdict[str, Any])init_kwargsr>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   c           ,      C  s  |d k	r|n
| j d}|d k	r$|n
| j d}|tkr<|n
| j d}|d k	rT|n
| j d}|d k	rl|n
| j d}|d k	r|n
| j d}|d k	r|n
| j d}|	d k	r|	n
| j d}|
d k	r|
n
| j d	}|d k	r|n
| j d
}|d k	r|n
| j d}|d k	r|n
| j d}|s,|n|}|d k	r>|n
| j d} |d k	rX|n
| j d}!|d k	rr|n
| j d}"|d k	r|n
| j d}#|d k	r|n
| j d}$|d k	r|n
| j d}%t| j|d}&t| j||||||d}'t| j||||||||d	}(t| j|%||d})| j| j|&|'|(|)d}*t	dd |*D s|d k	s^|d k	r|d krt
| j|||| |!|"|#|$|d
n|}+|+f|* }*|*rttdd |*D  S i S d S )Nr   r   r   r   r   r   r   r!   r"   r$   r&   r'   r(   r)   r*   r+   r,   r.   )r^   )r   r   r   r   r   r!   )r   r   r   r   r   r   r   r!   )r.   r   r   )rX   rY   rZ   r[   c                 S  s   g | ]}t |tr|qS r9   )
isinstancer   .0sourcer9   r9   r:   
<listcomp>#  s     
 z7BaseSettings._settings_build_values.<locals>.<listcomp>)	r"   r$   r'   r(   r)   r*   r+   r,   r   c                 S  s   g | ]
}| qS r9   r9   r`   r9   r9   r:   rc   7  s     )model_configgetr   r   rV   r   r   r   r]   anyr   r   reversed),selfr^   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   r   r   r   r   r   r   r   r!   r"   r$   r&   r'   r(   r)   r*   r+   r,   r.   rX   rY   rZ   r[   sourcesZcli_settingsr9   r9   r:   rT      s    


	   
z#BaseSettings._settings_build_valuesZforbidTF )Zmodel_Z	settings_)extraZarbitrary_types_allowedZvalidate_defaultr   r   r   r   r   r   r   r!   r"   r$   r&   r'   r(   r)   r*   r+   r,   r/   r0   r1   r2   r4   r.   Zprotected_namespaceszClassVar[SettingsConfigDict]rd   )NNNNNNNNNNNNNNNNNN)r5   r6   r7   __doc__r   rS   classmethodr]   rT   r   rd   r8   __classcell__r9   r9   rU   r:   r<   O   s   
':/                  6 r<   N)
__future__r   Z_annotationspathlibr   typingr   r   Zpydanticr   Zpydantic._internal._configr   Zpydantic._internal._utilsr   Zpydantic.mainr	   ri   r   r   r   r   r   r   r   r   r   r   setr8   keysr<   r9   r9   r9   r:   <module>   s   ,4