Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
main.cpython-313.pyc299 linesDownload Raw Back to __pycache__
1�

2��j������SSKJr SSKrSSKrSSKrSSKrSSKrSSKJ	r	 SSK3Jr SSKJ
r
 SSKJrJrJrJrJrJr SSKJr SSKJr SS	KJr SS4KJrJr SSKJr SSK J!r! S
SK"J#r# S
SK$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6 S
SK7J8r8 \"S5r9"SS\SS9r:\\;"\:RxR{55-r"SS\!5r>"SS5r?g)�)�annotationsN)�	Namespace)�Mapping)�SimpleNamespace)�Any�ClassVar�Literal�TextIO�TypeVar�cast)�5ConfigDict)�config_keys)�_field_name_for_signature)�deep_update�is_model_class)�is_pydantic_dataclass)�	BaseModel�)�
SettingsError)�ENV_FILE_SENTINEL�CliSettingsSource�DefaultSettingsSource�DotenvFiltering�DotEnvSettingsSource�6DotenvType�EnvPrefixTarget�EnvSettingsSource�InitSettingsSource�JsonConfigSettingsSource�PathType�PydanticBaseSettingsSource�
PydanticModel�!PyprojectTomlConfigSettingsSource�SecretsSettingsSource�TomlConfigSettingsSource�YamlConfigSettingsSource�get_subcommand)�_get_alias_names�Tc��\rSrSr%S\S'S\S'S\S'S\S	'S7\S'S\S
'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S'S\S 'S!\S"'S\S#'S$\S%'S&\S''S(\S)'S(\S*'S\S+'S(\S,'S\S-'S\S.'S/\S0'S1\S2'S(\S3'S\S4'S5rg6)7�SettingsConfigDict�.�bool�case_sensitive�bool | None�#nested_model_default_partial_update�str�8env_prefixr�env_prefix_target�DotenvType | None�env_file�9str | None�env_file_encodingzDotenvFiltering | None�dotenv_filtering�env_ignore_empty�env_nested_delimiter�10int | None�env_nested_max_split�env_parse_none_str�env_parse_enums�
cli_prog_name�)bool | list[str] | tuple[str, ...] | None�cli_parse_args�cli_parse_none_str�cli_hide_none_type�cli_avoid_json�cli_enforce_required�cli_use_class_docs_for_groups�cli_exit_on_error�11cli_prefix�cli_flag_prefix_char�'bool | Literal['dual', 'toggle'] | None�cli_implicit_flags�cli_ignore_unknown_args�(bool | Literal['all', 'no_enums'] | None�cli_kebab_case�$Mapping[str, str | list[str]] | None�
cli_shortcuts�PathType | None�secrets_dir�	json_file�json_file_encoding�	yaml_file�yaml_file_encoding�yaml_config_section�int�pyproject_toml_depth�tuple[str, ...]�pyproject_toml_table_header�	toml_file�enable_decoding�N)�__name__�12__module__�__qualname__�__firstlineno__�__annotations__�__static_attributes__r^��\D:\code\apps\devtools\python\user_packages\Python313\site-packages\pydantic_settings/main.pyr+r+.s�����)4�4��O�&�&���!�!�,�,���$�$�$�$�"�"� � ���=�=�"�"�������#'�'����O���?�?�(�(�<�<�7�7� � ���"�"���"�"�#�#�����"1�0�	����rer+F)�totalc�^�\rSrSr%SrSSSS\SSSSSSSSSSSSSSSSSSSSSSS4S9U4Sjjjr\S:Sj5r\SSSS\SSSSSSSSSSSSSSSSSSSSSSS4S;Sjj5r	\S<Sj5r13\S=Sj5r\S>S14j5r
\"S80SS_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S_S!S_S"S_S#S_S$S_S%S_S&S_S'S(_S)S_S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_S2S_S3S_S4S5_S6S_6rS7\S	'S8rU=r$)?�BaseSettings�xa;15Base class for settings, allowing values to be overridden by environment variables.16 17This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose),18Heroku and any 12 factor app design.19 20All the below attributes can be set via `model_config`.21 22Args:23    _case_sensitive: Whether environment and CLI variable names should be read with case-sensitivity.24        Defaults to `None`.25    _nested_model_default_partial_update: Whether to allow partial updates on nested model default object fields.26        Defaults to `False`.27    _env_prefix: Prefix for all environment variables. Defaults to `None`.28    _env_prefix_target: Targets to which `_env_prefix` is applied. Default: `variable`.29    _env_file: The env file(s) to load settings values from. Defaults to `Path('')`, which30        means that the value from `model_config['env_file']` should be used. You can also pass31        `None` to indicate that environment variables should not be loaded from an env file.32    _env_file_encoding: The env file encoding, e.g. `'latin-1'`. Defaults to `None`.33    _env_ignore_empty: Ignore environment variables where the value is an empty string. Default to `False`.34    _env_nested_delimiter: The nested env values delimiter. Defaults to `None`.35    _env_nested_max_split: The nested env values maximum nesting. Defaults to `None`, which means no limit.36    _env_parse_none_str: The env string value that should be parsed (e.g. "null", "void", "None", etc.)37        into `None` type(None). Defaults to `None` type(None), which means no parsing should occur.38    _env_parse_enums: Parse enum field names to values. Defaults to `None.`, which means no parsing should occur.39    _cli_prog_name: The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`.40        Otherwise, defaults to sys.argv[0].41    _cli_parse_args: The list of CLI arguments to parse. Defaults to None.42        If set to `True`, defaults to sys.argv[1:].43    _cli_settings_source: Override the default CLI settings source with a user defined instance. Defaults to None.44    _cli_parse_none_str: The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into45        `None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if46        _cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`.47    _cli_hide_none_type: Hide `None` values in CLI help text. Defaults to `False`.48    _cli_avoid_json: Avoid complex JSON objects in CLI help text. Defaults to `False`.49    _cli_enforce_required: Enforce required fields at the CLI. Defaults to `False`.50    _cli_use_class_docs_for_groups: Use class docstrings in CLI group help text instead of field descriptions.51        Defaults to `False`.52    _cli_exit_on_error: Determines whether or not the internal parser exits with error info when an error occurs.53        Defaults to `True`.54    _cli_prefix: The root parser command line arguments prefix. Defaults to "".55    _cli_flag_prefix_char: The flag prefix character to use for CLI optional arguments. Defaults to '-'.56    _cli_implicit_flags: Controls how `bool` fields are exposed as CLI flags.57 58        - False (default): no implicit flags are generated; booleans must be set explicitly (e.g. --flag=true).59        - True / 'dual': optional boolean fields generate both positive and negative forms (--flag and --no-flag).60        - 'toggle': required boolean fields remain in 'dual' mode, while optional boolean fields generate a single61          flag aligned with the default value (if default=False, expose --flag; if default=True, expose --no-flag).62    _cli_ignore_unknown_args: Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`.63    _cli_kebab_case: CLI args use kebab case. Defaults to `False`.64    _cli_shortcuts: Mapping of target field name to alias names. Defaults to `None`.65    _secrets_dir: The secret files directory or a sequence of directories. Defaults to `None`.66    _build_sources: Pre-initialized sources and init kwargs to use for building instantiation values.67        Defaults to `None`.68Nc��>�UbUO3URRUUUUUUUUU	U69UUU
UUUUUUUUUUUUUUUS9unn[T U]"S0URR	UU5D6 g)N)�_case_sensitive�$_nested_model_default_partial_update�_env_prefix�_env_prefix_target�	_env_file�_env_file_encoding�_env_ignore_empty�_env_nested_delimiter�_env_nested_max_split�_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_exit_on_error�_cli_prefix�_cli_flag_prefix_char�_cli_implicit_flags�_cli_ignore_unknown_args�_cli_kebab_case�_cli_shortcuts�_secrets_dir�_init_kwargsr^)�	__class__�_settings_init_sources�super�__init__�_settings_build_values)!�__pydantic_self__rlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr�r�r�r�r�r�r��_build_sources�values�sources�init_kwargsr�s!                                �rfr��BaseSettings.__init__�s����D�)�
�"�,�,�C�C� /�5Y�'�#5�#�#5�"3�&;�&;�$7�!1�-� /�%9�$7�$7� /�&;�/M�#5�'�&;�$7�)A� /�-�)�#�9D��	���F	���d�,�6�6�M�M�g�Wb�c�drec�70�X#XE4$)a�71Define the sources and their order for loading the settings values.72 73Args:74    settings_cls: The Settings class.75    init_settings: The `InitSettingsSource` instance.76    env_settings: The `EnvSettingsSource` instance.77    dotenv_settings: The `DotEnvSettingsSource` instance.78    file_secret_settings: The `SecretsSettingsSource` instance.79 80Returns:81    A tuple containing the sources and their order for loading the settings values.82r^)�cls�settings_cls�
init_settings�env_settings�dotenv_settings�file_secret_settingss      rf�settings_customise_sources�'BaseSettings.settings_customise_sources�s��,�O�Q�Qrec�H	�UbUOURRS5nUbUOURRS5nUbUOURRS5nUbUOURRS5n U[:waUOURRS5n!UbUOURRS5n"UbUOURRS5n#UbUOURRS5n$U	bU	OURRS	5n%U83bU84OURRS855n&UbUOURRS5n'UbUOURRS5n(U
bU
OURRS
5n)UbUOURRS5n*UbUOURRS5n+U&(dU+OU&n+UbUOURRS5n,UbUOURRS5n-UbUOURRS5n.UbUOURRS5n/UbUOURRS5n0UbUOURRS5n1UbUOURRS5n2UbUOURRS5n3UbUOURRS5n4UbUOURRS5n5UbUOURRS5n6UbUOURRS5n7[UU S9n8[	UUbUO0U S9n9[UUUUU$U%U#U&U'S9	n:[
UU!U"UUUU$U%U#U&U'S9n;[UU7UUUS 9n<URUU9U:U;U<S!9U84-n=U=V>s/sHn>[U>[5(dMU>PM n?n>[U?5(dH[U*[5(aU*4U=-n=OOU)b([["U4U(U)U+U,U-U.U/U0U1U2U3U4U5U6US".6n@U@4U=-n=O#U)S#;aU?S$R(d	U?S$"U)S%9 URU=UR5 U=UbU4$04$s sn>f)&Nr.r2r3r0r5r7r9r:r<r=r>r?rA�cli_settings_sourcerBrCrDrErFrGrHrIrKrLrNrPrR)r0)r�r0)r.r2r3r:r<r9r=r>)86r5r7r.r2r3r:r<r9r=r>)rRr.r2r3)r�r�r�r�)r?rArBrCrDrErFrGrHrIrKrLrNrPr.�NFr��args)�model_config�getrrrrrr$r��87isinstancer�anyr�env_vars�!_settings_warn_unused_config_keys)Ar�rlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr�r�r�r�r�r�r�r�r.r2r3r0r5r7r9r:r<r=r>r?rAr�rBrCrDrErFrGrHrIrKrLrNrPrR�default_settingsr�r�r�r�r��source�custom_cli_sources�cli_settingssA                                                                 rfr��#BaseSettings._settings_init_sourcessu��B-<�,G��S�M]�M]�Ma�Ma�br�Ms��$/�$;�[��AQ�AQ�AU�AU�Vb�Ac�88�"4�"@��c�FV�FV�FZ�FZ�[n�Fo�	�894�?�
1��!�!�%�%�&K�L�	,�90!*�->� >�9�C�DT�DT�DX�DX�Yc�Dd��"4�"@��c�FV�FV�FZ�FZ�[n�Fo�	�"3�!>��C�DT�DT�DX�DX�Yk�Dl�	�&;�%F�!�C�L\�L\�L`�L`�aw�Lx�	�&;�%F�!�C�L\�L\�L`�L`�aw�Lx�	�$7�#B���HX�HX�H\�H\�]q�Hr�	�/?�.J�*�PS�P`�P`�Pd�Pd�ev�Pw��*8�*D��#�JZ�JZ�J^�J^�_n�Jo�
�,;�,G��S�M]�M]�Ma�Ma�br�Ms��$8�$D� �#�JZ�JZ�J^�J^�_t�Ju�	�$7�#B���HX�HX�H\�H\�]q�Hr�	�8J�/�Oa��#6�#B���HX�HX�H\�H\�]q�Hr�	�-<�,G��S�M]�M]�Ma�Ma�br�Ms��%:�%F�!�C�L\�L\�L`�L`�aw�Lx�	�91.�9�
+��!�!�%�%�&E�F�	&�#5�"@��c�FV�FV�FZ�FZ�[n�Fo�	�%0�$;�[��AQ�AQ�AU�AU�Vb�Ac�92�%:�%F�!�C�L\�L\�L`�L`�aw�Lx�	�$7�#B���HX�HX�H\�H\�]q�Hr�	�93(�3�
%��!�!�%�%�&?�@�	 �94-<�,G��S�M]�M]�Ma�Ma�br�Ms��*8�*D��#�JZ�JZ�J^�J^�_n�Jo�
�&2�&>�l�C�DT�DT�DX�DX�Yf�Dg��1��5X�95��+��(4�(@��b�0S�96�
�97)��)�!�/�!5�!5�-�1�+�9899��/���/�)�!�/�!5�!5�-�1�+�100�� 5��#�)�!�/� 101���0�0��'�%�+�!5�1�102���
 ��4;�d�7��j��Qb�>c�f�7��d��%�&�&��-�/@�A�A�.�0�7�:���+�0��5�� �"/�#1�'9�'9�#1�)=�2O�&7�)�)=�'9�,C�#1�"/�#1�! ��$(�/�G�3���
�=�
0�9K�A�9N�9W�9W��q�!�~�6��-�-�g�s�7G�7G�H���(@��H�H�b�H�H��=es�R�6Rc���U(a�0n0n0nUH�n[U[5(a"URU5 URU5 [	US5(aUR103O[
U5R104nU"5n[U[5(aUnX�U'[X�5nM� UR5V	V105s0sHup�X�;d106XIU107:wdMX�_M nn	n108URXU5 U$0$s sn109n	f)Nr_)r�r!�_set_current_state�_set_settings_sources_data�hasattrr_�typerr�items�"_settings_restore_init_kwarg_names)r�r�r��state�defaults�statesr��source_name�source_state�key�vals           rfr��#BaseSettings._settings_build_values�s����$&�E�')�H�02�F�!���f�&@�A�A��-�-�e�4��5�5�f�=�18���1L�1L�f�o�o�RV�W]�R^�Rg�Rg��%�x���f�&;�<�<�+�H�&2�{�#�#�L�8��"�/4�k�k�m�k�m�(�#�s�?R�V^�Vc�gj�Vj�X�S�X�m�E�k��2�2�3�U�K��L��I��ls�C6�C6c���U(GabU(GaY[UR55n[UR55nURR5GHupV[	XV5tpx[U5n	UR110R
SS5=(d UR111R
SS5n112U113(aU	RU5 XI-nX9-nU(dM�U(dM�[[U55n
SnUHnX�;dM114Un O UcX\;aUO[[U55nURU5nX�1-115HnURUS5 M UX-'GM116 ggg)z�117Restore the init_kwarg key names to the final merged state dictionary.118 119This function renames keys in state to match the original init_kwargs key names,120preserving the merged values from the source priority order.121�populate_by_nameF�validate_by_nameN)�set�keys�model_fieldsr�r(r�r��add�next�iter�pop)r�r�r��state_kwarg_names�init_kwarg_names�122field_name�123field_info�alias_names�_�matchable_names�include_name�init_kwarg_name�state_kwarg_name�124target_key�125source_key�alias�valuer�s                  rfr��/BaseSettings._settings_restore_init_kwarg_names�sV���5� #�E�J�J�L� 1��"�;�#3�#3�#5�6��*6�*C�*C�*I�*I�*K�&�126�"2�:�"J���"%�k�"2��+�8�8�<�<�&�� � N�!�.�.�2�2�3E�u�M�� �#�'�'�127�3�"2�"D��#4�#F� �"�?�'7�'7�"&�d�?�&;�!<�J�"&�J�!,�� �4�).�J�!�"-�"�)�3=�3Q�Z�W[�\`�aq�\r�Ws�128�!�I�I�j�1�E�/�,�>���	�	�#�t�,� ?�(-�E�%�;+L�!�;rer�c�^^�SUU4SjjnU"[S5 U"[S5 U"[S5 U"[S5 g)a129Warns if any values in model_config were set but the corresponding settings source has not been initialised.130 131The list alternative sources and their config keys can be found here:132https://docs.pydantic.dev/latest/concepts/pydantic_settings/#other-settings-source133 134Args:135    sources: The tuple of configured sources136    model_config: The model config to check for unused config keys137c138��>^�[U4SjT55(dVUHOnTRU5cM[R"SUSTRSTRS3[139SS9 MQ gg)Nc3�<># �UHn[UT5v� M g7f�N)r�)�.0r��source_types  �rf�	<genexpr>�[BaseSettings._settings_warn_unused_config_keys.<locals>.warn_if_not_used.<locals>.<genexpr>"s����M�W�6�z�&�+�6�6�W�s�zConfig key `z8` is set in model_config but will be ignored because no z5 source is configured. To use this config key, add a zH source to the settings sources via the settings_customise_sources hook.�)�140stacklevel)r�r��warnings�warnr_�UserWarning)r�r�r�r�r�s`  ��rf�warn_if_not_used�HBaseSettings._settings_warn_unused_config_keys.<locals>.warn_if_not_used!sx����M�W�M�M�M��C�#�'�'��,�8� �
�
�*�3�%�/g�*�3�3�4�4i�*�3�3�4�5?�?�(�'(�
� �Nre)rSrT)rYr[)r\)rUrVrWN)r�z type[PydanticBaseSettingsSource]r�rZ�return�None)rr#r%r&)r�r�r�s`` rfr��.BaseSettings._settings_warn_unused_config_keyss>���	�	�	�1�3V�W��:�<s�t��1�>�B��1�3m�nre�extra�forbid�arbitrary_types_allowedT�validate_defaultr.Fr2�r3�variabler0r5r7r9r:r<r=r>r?rArBrCrDrErFrGrHrI�-rKrLrNrPrSrTrUrVrWr\rR�protected_namespaces)�model_validate�141model_dumpr�r]zClassVar[SettingsConfigDict]r^)<rlr/rmr/rnr6ro�EnvPrefixTarget | Nonerpr4rqr6rrr/rsr6rtr;rur6rvr/rwr6rxr@ry�CliSettingsSource[Any] | Nonerzr6r{r/r|r/r}r/r~r/rr/r�r6r�r6r�rJr�r/r�rMr�rOr�rQr�zDtuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]] | Noner�rr�r�)r��type[BaseSettings]r�r!r�r!r�r!r�r!r��&tuple[PydanticBaseSettingsSource, ...]):rlr/rmr/rnr6ror�rpr4rqr6rrr/rsr6rtr;rur6rvr/rwr6rxr@ryr�rzr6r{r/r|r/r}r/r~r/rr/r�r6r�r6r�rJr�r/r�rMr�rOr�rQr�zdict[str, Any] | Noner�z=tuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]])r�r�r��dict[str, Any]r�r�)r�r�r�r�r�r�r�r�)r�ztuple[object, ...]r�r+r�r�)r_r`rarb�__doc__rr��classmethodr�r�r��staticmethodr�r�r+r�rcrd�
__classcell__)r�s@rfririxs���6�z(,�<@�"&�59�'8�)-�)-�,0�,0�*.�(,�%)�EI�>B�*.�+/�'+�-1�6:�*.�"&�,0�GK�04�DH�?C�(,�_c�;Ce�$�Ce�/:�Ce� �	Ce�1423�Ce�%�
Ce�'�Ce�'�Ce� *�Ce� *�Ce�(�Ce�&�Ce�#�Ce�C�Ce�<�Ce� (�!Ce�")�#Ce�$%�%Ce�& +�'Ce�()4�)Ce�*(�+Ce�, �-Ce�. *�/Ce�0E�1Ce�2#.�3Ce�4B�5Ce�6=�7Ce�8&�9Ce�:]�;Ce�<�=Ce�>143�?Ce�Ce�J�R�(�R�2�R�1�	R�1444�R�9�
R�1450�R��R�.�(,�<@�"&�59�'8�)-�)-�,0�,0�*.�(,�%)�EI�>B�*.�+/�'+�-1�6:�*.�"&�,0�GK�04�DH�?C�(,�.2�;tI�$�tI�/:�tI� �	tI�1463�tI�%�
tI�'�tI�'�tI� *�tI� *�tI�(�tI�&�tI�#�tI�C�tI�<�tI� (�!tI�")�#tI�$%�%tI�& +�'tI�()4�)tI�*(�+tI�, �-tI�. *�/tI�0E�1tI�2#.�3tI�4B�5tI�6=�7tI�8&�9tI�:,�;tI�<147G�=tI��tI�l��<��KY��	����>�).�(�).�7E�).�N\�).�	
�).��).�V�o��o�<2D�&2��&2� $�&2��&2��	&2�148�&2�%�
&2�-2�&2��&2��&2��&2�"�&2�"�&2� �&2��&2��&2� �!&2�" �#&2�$!�%&2�&�'&2�(#�)&2�*',�+&2�,�-&2�.�/&2�0!�1&2�2!�3&2�4!&�5&2�6�7&2�8�9&2�:�;&2�< �=&2�>�?&2�@ �A&2�B!�C&2�D�E&2�F�G&2�H\�I&2�J�K&2�L�.�&�&reric�j�\rSrSr%Sr0rS\S'\R"S5r	S\S'\149SSj5r\150SS	j5r\151SSSjj5r
\152SSSjj5r\153SSS
jj5r\154SSSjj5r\155SSSjj5rSrg156)�CliAppi\z|157A utility class for running Pydantic `BaseSettings`, `BaseModel`, or `pydantic.dataclasses.dataclass` as158CLI applications.159z<ClassVar[dict[int, tuple[CliSettingsSource[Any], Any, str]]]�_subcommand_stackz\x1b\[[0-9;]*mzClassVar[re.Pattern[str]]�_ansi_colorc�\^�[T[5(aT$"U4SjS[T5nU$)Nc160�H>�\rSrSrYRr\"SSSSSSSS9rSrg)�9CliApp._get_base_settings_cls.<locals>.CliAppBaseSettingsijT)r0r.rCrDrErKrNr^N)r_r`rarbr�r+r�rd)�	model_clss�rf�CliAppBaseSettingsr�js-����'�'�G�-�48�#�#'�#�%)�#'�#��Lrer)�161issubclassri)rrs` rf�_get_base_settings_cls�CliApp._get_base_settings_clses,����i��.�.���162	��y�163	�"�!rec�D^^^�[[T5US5mTc.U(a%[S[T5RSUS35eT$[R164"T5(a�[R"5nU(adUR5(aO/mSUUU4Sjjn[R"US9nUR5 UR5 T(aTSeT$[R"T"T55 T$T"T5 T$![a SnN�f=f)N�Error: z class is missing z entrypointc�>�[R"T"T55 g![anTRU5 SnAgSnAff=fr�)�asyncio�run�	Exception�append)�e�command�exception_container�models ���rf�run_coro�%CliApp._run_cli_cmd.<locals>.run_coro�s9���6����G�E�N�3��$�6�+�2�2�1�5�5��6�s� �165A�A�A)�targetr)r�r�)�getattrr�rr_�inspect�iscoroutinefunctionr�get_running_loop�RuntimeError�166is_running�	threading�Thread�start�joinr	)r�cli_cmd_method_name�is_required�loopr�threadr
rs`     @@rf�_run_cli_cmd�CliApp._run_cli_cmdxs����$�u�+�':�D�A���?��#�g�d�5�k�.B�.B�-C�CU�Vi�Uj�ju�$v�w�w��L��&�&�w�/�/�
��/�/�1������)�)�')�#�6�6�#�)�)��:���������
�&�-�a�0�0�'������G�E�N�+�167��
�E�N����9 �
���
�s�'D�D�DNc��[U5(d)[U5(d[SURS35eSnUcSOUnUb.[	U[168[[45(aU"US9nO2U"US9nO+[	U[169[[45(a[S5e[U[5(d�[RU5nURUUUUS9up�U"S0URX�5D6n0nURR5Hup�[!X�5U[#X�5'M U"S0UD6nOURUUUUS9up�U"X�4S	9nS170nU	Vs/sHn[	U[$5(dMUPM snSnX"R&U4[R([+U5'[R-X�SS
9n[R([+U5	U$s snf![R([+U5	f=f)a�171Runs a Pydantic `BaseSettings`, `BaseModel`, or `pydantic.dataclasses.dataclass` as a CLI application.172Running a model as a CLI application requires the `cli_cmd` method to be defined in the model class.173 174Args:175    model_cls: The model class to run as a CLI application.176    cli_args: The list of CLI arguments to parse. If `cli_settings_source` is specified, this may177        also be a namespace or dictionary of pre-parsed CLI arguments. Defaults to `sys.argv[1:]`.178    cli_settings_source: Override the default CLI settings source with a user defined instance.179        Defaults to `None`.180    cli_exit_on_error: Determines whether this function exits on error. If model is subclass of181        `BaseSettings`, defaults to BaseSettings `cli_exit_on_error` value. Otherwise, defaults to182        `True`.183    cli_cmd_method_name: The CLI command method name to run. Defaults to "cli_cmd".184    model_init_data: The model init data.185 186Returns:187    The ran instance of model.188 189Raises:190    SettingsError: If model_cls is not subclass of `BaseModel` or `pydantic.dataclasses.dataclass`.191    SettingsError: If model_cls does not have a `cli_cmd` entrypoint defined.192rz? is not subclass of BaseModel or pydantic.dataclasses.dataclassNT)�parsed_argsr�zRError: `cli_args` must be list[str] or None when `cli_settings_source` is not used)rxrryr�)r��:subcommandrF�rr^)rrrr_r�rr�dictrrir�rr�r�r�r�rrr�root_parserr��idr!)r�cli_argsr�rGr�model_init_datar�rA�base_settings_clsr�r�rr�r�r
�subcommand_destr��193data_models                  rfr	�194CliApp.run�s
��B&�i�0�0�N�9�4M�4M���)�,�,�-�-l�m��
���!)�!1��x���*��.�9�o�t�*L�M�M�2�~�N��2��G��
���O�T�(J�
K�
K�� t�u�u��)�\�2�2� &� =� =�i� H��#4�#K�#K� .�#4�%1�,�	$L�$� �G�&�g�(9�(P�(P�QX�(f�g�E� �O�*;�*H�*H�*N�*N�*P�&�195�U\�]b�Uo�� 9�*� Q�R�+Q��2�/�2�G�#,�#C�#C� .�#4�%1�,�	$D�$� �G� ��/E�F�G�'��4;�e�G�&�z�&�Rc�?d�v�G�e�fg�h��1D�Fe�Fe�gv�0w�� � ��G��-�	6��,�,�W�W\�,�]�J��(�(��G��5����
f��196�(�(��G��5�s�G�7G�,G!�!G=c�b�[U5[R;a [R[U5up4nO=[["[R[
U555nURnSnUcUROUn/n[USXS9nU(aVUSnURcBURc5URb(USURU53n	[
U5"U	5SeUe[[[[
U55n197URUU198nUR S3nUR"nX<U4[R[U5'[R%XrSS9n
[R[U5	U
$![R[U5	f=f)	a�199Runs the model subcommand. Running a model subcommand requires the `cli_cmd` method to be defined in200the nested model subcommand class.201 202Args:203    model: The model to run the subcommand from.204    cli_exit_on_error: Determines whether this function exits with error if no subcommand is found.205        Defaults to model_config `cli_exit_on_error` value if set. Otherwise, defaults to `True`.206    cli_cmd_method_name: The CLI command method name to run. Defaults to "cli_cmd".207 208Returns:209    The ran subcommand model.210 211Raises:212    SystemExit: When no subcommand is found and cli_exit_on_error=`True` (the default).213    SettingsError: When no subcommand is found and cli_exit_on_error=`False`.214r%NT)rrG�_suppress_errorsr�215z.:subcommandr&)r)r�r�rrrr�r(rGr'�__context__�	__cause__�_format_helprr�_parser_map�dest�parserr!)rrGrr�r8r-�errors�216subcommand�err�
error_message�subcommand_cls�subcommand_arg�subcommand_parserr.s              rf�run_subcommand�CliApp.run_subcommand�s���,�e�9��0�0�0�;A�;S�;S�TV�W\�T]�;^�8���"3�C�"8��9V�9V�W[�\a�Wb�9c�"d��(�4�4�F�+�O�EV�E^�/�A�A�du��35��#��t�7H�217�218����)�C����&�3�=�=�+@�EX�Ee�Ee�Eq�#&�%�r�*=�*J�*J�6�*R�)S� T�
��3�i�
�.�D�8��	��d�9�o�t�J�/?�@��,�8�8��I�.�Y��+�0�0�1��>��*�1�1��4G�\k�3l�� � ��J��0�	9��,�,�Z�Z^�,�_�J��(�(��J��8�����(�(��J��8�s�"F�F.c��[R[U55n[["U5RUUUUS9n[R"XS5$)a!219Serializes the CLI arguments for a Pydantic data model.220 221Args:222    model: The data model to serialize.223    list_style:224        Controls how list-valued fields are serialized on the command line.225        - 'json' (default):226          Lists are encoded as a single JSON array.227          Example: `--tags '["a","b","c"]'`228        - 'argparse':229          Each list element becomes its own repeated flag, following230          typical `argparse` conventions.231          Example: `--tags a --tags b --tags c`232        - 'lazy':233          Lists are emitted as a single comma-separated string without JSON234          quoting or escaping.235          Example: `--tags a,b,c`236    dict_style:237        Controls how dictionary-valued fields are serialized.238        - 'json' (default):239          The entire dictionary is emitted as a single JSON object.240          Example: `--config '{"host": "localhost", "port": 5432}'`241        - 'env':242          The dictionary is flattened into multiple CLI flags using243          environment-variable-style assignement.244          Example: `--config host=localhost --config port=5432`245    positionals_first: Controls whether positional arguments should be serialized246        first compared to optional arguments. Defaults to `False`.247 248Returns:249    The serialized CLI arguments for the data model.250)�251list_style�252dict_style�positionals_first)r�rr�rr�_serialized_args�_flatten_serialized_args)rrCrDrEr,�serialized_argss      rf�	serialize�CliApp.serialize+sZ��R#�9�9�$�u�+�F��+�C�0�1B�C�T�T��!�!�/�	U�253��!�9�9�/�]�]rec��[U[5(aUO254[U5nUcn[U[5(d;[U5[R;a[R[U5tpO[[R
U55nURUR5nU(dU$[RRSU5$)av255Return a string containing a help message for a Pydantic model.256 257Args:258    model: The model or model class.259    cli_settings_source: Override the default CLI settings source with a user defined instance.260        Defaults to `None`.261    strip_ansi_color: Strips ANSI color codes from the help message when set to `True`.262 263Returns:264    The help message string for the model.265r�)r�r�r)r�r�rrr5r(r��sub)rr��strip_ansi_colorrr��help_messages      rf�format_help�CliApp.format_help]s���$(��t�4�4�E�$�u�+�	��&��e�T�*�*�r�%�y�F�<T�<T�/T�*0�*B�*B�2�e�9�*M�'�#�a�&7��8U�8U�V_�8`�&a�#�*�7�7�8K�8W�8W�X��#3�|�a��9K�9K�9O�9O�PR�T`�9a�arec�>�[[RUUUS9US9 g)a�266Print a help message for a Pydantic model.267 268Args:269    model: The model or model class.270    cli_settings_source: Override the default CLI settings source with a user defined instance.271        Defaults to `None`.272    file: A text stream to which the help message is written. If `None`, the output is sent to sys.stdout.273    strip_ansi_color: Strips ANSI color codes from the help message when set to `True`.274)r�rM)�fileN)�printr�rO)rr�rRrMs    rf�275print_help�CliApp.print_helpxs-��"	�����$7�!1�
�
�276�
	277rer^)rz	type[Any]r�r�)rrrr1rr-r�r)NNN�cli_cmd)rztype[T]r*z?list[str] | Namespace | SimpleNamespace | dict[str, Any] | Noner�r�rGr/rr1r+rr�r))NrV)rr"rGr/rr1r�r")�jsonrWF)278rr"rCz#Literal['json', 'argparse', 'lazy']rDzLiteral['json', 'env']rEr-r�z	list[str]r�)r�PydanticModel | type[T]r�r�rMr-r�r1)NNF)279rrXr�r�rRz
TextIO | NonerMr-r�r�)r_r`rarbr�r�rc�re�compiler�r�rr!r	r@rIrOrTrdr^rerfr�r�\s����280WY��S�X�-/�Z�Z�8I�-J�K�*�J��"��"�$�+��+�Z�UY�=A�)-�#,�L��L�Q�L�;�L�'�	L�281!�L��
L�282�L��L�\�`i�3��3�1<�3�Z]�3�	�3��3�j�;A�-3�"'�	/^��/^�7�/^�+�/^� �	/^�283284�/^��/^�b�>B�!&�b�&�b�:�b��b�285
�	b��b�4�>B�"�!&�	286�&�287�:�288��289��	290�291292�293��294rer�)@�295__future__r�_annotationsrrrYrr��argparser�collections.abcr�typesr�typingrrr	r296rr�pydanticr
�pydantic._internal._configr�pydantic._internal._signaturer�pydantic._internal._utilsrr�pydantic.dataclassesr�
pydantic.mainr�297exceptionsrr�rrrrrrrrrrr r!r"r#r$r%r&r'�
sources.utilsr(r)r+r�rcr�rir�r^rerf�<module>ris���2���	����#�!�@�@��2�C�A�6�#�%������(,��C�L��>��5�>�N�s�%�5�5�:�:�<�=�=��a�9�a�Ht298�t299re