§
    .P„j`Æ  ã            
      ó`  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Z
mZmZ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 dd
lmZ 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'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2  ee3¦  «        Z4 G d„ de5e6¦  «        Z7 G d„ dej8        ¦  «        Z8	 	 	 	 dNdde2j9        e!j:        e-j:        e1j;        e$ddœdOd5„Z<	 	 	 	 	 dPde2j9        e!j:        e-j:        e1j;        e$dd7œdQd=„Z=dRdA„Z>dSdB„Z?dTdD„Z@dSdE„ZAdSdF„ZBdUdM„ZCdS )Vz>Simple, Elegant Argument parsing.

@author: Fabrice Normandin
é    )ÚannotationsN)ÚSUPPRESSÚActionÚHelpFormatterÚ	NamespaceÚ_)Údefaultdict)ÚSequence)Ú	getLogger)ÚPath)ÚAnyÚCallableÚoverload)ÚSubgroupKey)ÚDataclassWrapperTypeé   )Úutils)ÚConflictResolutionÚConflictResolver)ÚSimpleHelpFormatter)Ú	read_file)Ú	DataclassÚ
DataclassTÚ
dict_unionÚis_dataclass_instanceÚis_dataclass_type)ÚDashVariantÚDataclassWrapperÚFieldWrapper)ÚArgumentGenerationModeÚ
NestedModec                  ó   — e Zd ZdS )ÚParsingErrorN)Ú__name__Ú
__module__Ú__qualname__© ó    ú[/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/simple_parsing/parsing.pyr#   r#   )   s   € € € € € Ø€Dr(   r#   c                  ó¾  ‡ — e Zd ZdZddej        ej        ej        e	j
        eddddœ
dfˆ fd„Zdgˆ fd„Zeddedœdhd)„¦   «         Zeded*œdid.„¦   «         Zeddedœdjd1„¦   «         Zddedœdkd4„Z	 	 	 dldmˆ fd;„Z	 	 	 	 	 dndoˆ fd@„Zdpdqˆ fdA„Zdrdsˆ fdE„ZdrdtdF„ZdddeddGœdudO„ZdvdwdQ„ZdxdT„Z	 drdydY„Zdzd[„Zd{d^„Zd|da„Zed}dc„¦   «         Zej        d~de„¦   «         Zˆ xZ S )ÚArgumentParsera  Creates an ArgumentParser instance.

    Parameters
    ----------
    - conflict_resolution : ConflictResolution, optional

        What kind of prefixing mechanism to use when reusing dataclasses
        (argument groups).
        For more info, check the docstring of the `ConflictResolution` Enum.

    - add_option_string_dash_variants : DashVariant, optional

        Whether or not to add option_string variants where the underscores in
        attribute names are replaced with dashes.
        For example, when set to DashVariant.UNDERSCORE_AND_DASH,
        "--no-cache" and "--no_cache" can both be used to point to the same
        attribute `no_cache` on some dataclass.

    - argument_generation_mode : ArgumentGenerationMode, optional

        How to generate the arguments. In the ArgumentGenerationMode.FLAT mode,
        the default one, the arguments are flat when possible, ignoring
        their nested structure and including it only on the presence of a
        conflict.

        In the ArgumentGenerationMode.NESTED mode, the arguments are always
        composed reflecting their nested structure.

        In the ArgumentGenerationMode.BOTH mode, both kind of arguments
        are generated.

    - nested_mode : NestedMode, optional

        How to handle argument generation in for nested arguments
        in the modes ArgumentGenerationMode.NESTED and ArgumentGenerationMode.BOTH.
        In the NestedMode.DEFAULT mode, the nested arguments are generated
        reflecting their full 'destination' path from the returning namespace.

        In the NestedMode.WITHOUT_ROOT, the first level is removed. This is useful when
        parser.add_arguments is only called once, and where the same prefix would be shared
        by all arguments. For example, if you have a single dataclass MyArguments and
        you call parser.add_arguments(MyArguments, "args"), the arguments could look like this:
        '--args.input.path --args.output.path'.
        We could prefer to remove the root level in such a case
            so that the arguments get generated as
        '--input.path --output.path'.

    - formatter_class : Type[HelpFormatter], optional

        The formatter class to use. By default, uses
        `simple_parsing.SimpleHelpFormatter`, which is a combination of the
        `argparse.ArgumentDefaultsHelpFormatter`,
        `argparse.MetavarTypeHelpFormatter` and
        `argparse.RawDescriptionHelpFormatter` classes.

    - add_config_path_arg : bool, str, optional
        When set to `True`, adds a `--config_path` argument, of type Path, which is used to parse.
        If set to a string then this is the name of the config_path argument.

    - config_path: str, optional
        The values read from this file will overwrite the default values from the dataclass definitions.
        When `add_config_path_arg` is also set the defaults are first updated using `config_path`, and then
        updated with the contents of the `--config_path` file(s). By setting this value it will be default set
        `add_config_path_arg` to True.
    r'   TN)
ÚparentsÚadd_helpÚconflict_resolutionÚadd_option_string_dash_variantsÚargument_generation_modeÚnested_modeÚformatter_classÚadd_config_path_argÚconfig_pathÚadd_dest_to_option_stringsr,   úSequence[ArgumentParser]r-   Úboolr.   r   r/   r   r1   r!   r2   útype[HelpFormatter]r3   úbool | str | Noner4   ú(Path | str | Sequence[Path | str] | Noner5   úbool | Nonec       
   	     óæ  •— ||d<    t          ¦   «         j        |g ddœ|¤Ž || _        t          t          ¦  «        | _        t          | j        ¦  «        | _        g | _        |
rt          j
        }d| _        || _        || _        || _        |t          _        |t          _        |t          _        t#          |¦  «        | _        || _        | j        r[| j        }d|v rdn|d         }t          ¦   «                              |dz   |dz  dz   dt,          t/          d	¦  «        ¬
¦  «        | _        t3          |	t4          ¦  «        rt7          |	¦  «        n|	| _        |€t;          |	¦  «        }|| _        d S )Nr2   F)r,   r-   ú-r   Úhé   Úhelpzshow this help message and exit)ÚactionÚdefaultr@   )ÚsuperÚ__init__r.   r	   ÚdictÚconstructor_argumentsr   Ú_conflict_resolverÚ	_wrappersr    ÚBOTHÚ_preprocessing_doner/   r0   r1   r   Úadd_dash_variantsÚtupleÚ_parentsr-   Úprefix_charsÚadd_argumentr   r   Ú_help_actionÚ
isinstanceÚstrr   r4   r7   r3   )Úselfr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   ÚargsÚkwargsrN   Údefault_prefixÚ	__class__s                  €r)   rD   zArgumentParser.__init__p   sƒ  ø€ ð %4ˆÐ Ñ!ð 	�‰ŒÔ˜$¨°UÐEÐE¸fÐEÐEÐEØ#6ˆÔ õ
 ALÍDÑ@QÔ@QˆÔ"å"2°4Ô3KÑ"LÔ"LˆÔØ13ˆŒà%ð 	CÝ'=Ô'BÐ$à).ˆÔ Ø/NˆÔ,Ø(@ˆÔ%Ø&ˆÔà)H�Ô&Ø0H�Ô-Ø#.�Ô Ý˜g™œˆŒà ˆŒØŒ=ð 		ØÔ,ˆLØ$'¨<Ð$7Ð$7˜S˜S¸\È!¼_ˆNÝ %¡¤× 4Ò 4Ø Ñ$Ø Ñ" VÑ+ØÝ ÝÐ8Ñ9Ô9ð !5ñ !ô !ˆDÔõ 1;¸;ÍÑ0LÔ0LÐ]�4 Ñ,Ô,Ð,ÐR]ˆÔØÐ&å"& {Ñ"3Ô"3ÐØ#6ˆÔ Ð Ð r(   Úname_or_flagsrR   Úreturnr   c                ó6   •—  t          ¦   «         j        |i |¤ŽS ©N)rC   rO   )rS   rX   rU   rW   s      €r)   rO   zArgumentParser.add_argument­   s+   ø€ ð
 $�u‰wŒwÔ#Øð
àð
ð 
ð 	
r(   Ú )ÚprefixrB   Údataclass_wrapper_classÚ	dataclassútype[DataclassT]Údestr]   rB   úDataclassT | Noner^   útype[DataclassWrapper]úDataclassWrapper[DataclassT]c               ó   — d S r[   r'   ©rS   r_   ra   r]   rB   r^   s         r)   Úadd_argumentszArgumentParser.add_arguments·   ó	   € ð 	ˆr(   )r]   r^   útype[Dataclass]útype[DataclassWrapperType]r   c               ó   — d S r[   r'   )rS   r_   ra   r]   r^   s        r)   rg   zArgumentParser.add_argumentsÃ   s	   € ð 	ˆr(   r   ÚNonec               ó   — d S r[   r'   rf   s         r)   rg   zArgumentParser.add_argumentsÎ   rh   r(   útype[DataclassT] | DataclassTú3DataclassWrapper[DataclassT] | DataclassWrapperTypec               óœ  — t          |¦  «        r=|�t          d¦  «        ‚t          j        t          |¦  «        }t          |¦  «        }|}nKt          |¦  «        st          d|› d�¦  «        ‚t          j        t
          t                   |¦  «        }|}|}|                      |||||¬¦  «        }| j         	                    |¦  «         |S )a‹  Adds command-line arguments for the fields of `dataclass`.

        Parameters
        ----------
        dataclass : Union[Type[Dataclass], Dataclass]
            The dataclass whose fields are to be parsed from the command-line.
            If an instance of a dataclass is given, it is used as the default
            value if none is provided.
        dest : str
            The destination attribute of the `argparse.Namespace` where the
            dataclass instance will be stored after calling `parse_args()`
        prefix : str, optional
            An optional prefix to add prepend to the names of the argparse
            arguments which will be generated for this dataclass.
            This can be useful when registering multiple distinct instances of
            the same dataclass, by default ""
        default : Dataclass, optional
            An instance of the dataclass type to get default values from, by
            default None
        dataclass_wrapper_class : Type[DataclassWrapper], optional
            The type of `DataclassWrapper` to use for this dataclass. This can be used to customize
            how the arguments are generated. However, I'd suggest making a GitHub issue if you find
            yourself using this often.

        Returns
        -------
        The generated DataclassWrapper instance. Feel free to inspect / play around with this if
        you want :)
        Nz=Can't use `default` when `dataclass` is a dataclass instance.z8`dataclass` should be a dataclass type or instance. Got ú.)Údataclass_typeÚnamer]   rB   r^   )
r   Ú
ValueErrorÚtypingÚcastr   Útyper   Ú_add_argumentsrH   Úappend)rS   r_   ra   r]   rB   r^   rr   Únew_wrappers           r)   rg   zArgumentParser.add_argumentsÚ   sæ   € õL ! Ñ+Ô+ð 	ØÐ"Ý Ð!`ÑaÔaÐaÝœ¥J°	Ñ:Ô:ˆIÝ! )™_œ_ˆNØˆGˆGå$ YÑ/Ô/ð Ý Ø[ÈyÐ[Ð[Ð[ñô ð õ œ¥D­Ô$4°iÑ@Ô@ˆIØ&ˆNØˆGà×)Ò)Ø)ØØØØ$;ð *ñ 
ô 
ˆð 	Œ×Ò˜kÑ*Ô*Ð*ØÐr(   FrT   úSequence[str] | NoneÚ	namespaceúNamespace | NoneÚattempt_to_reorderc                óf  •— |€t           j        dd …         }nt          |¦  «        }|€t          ¦   «         }| j        rDt          | j        t          ¦  «        r	| j        g}n| j        }|D ]}|                      |¦  «         Œ| j        �rt          | j        t          ¦  «        r| j        nd}t          ddt          j        t          j        t          j        ¬¦  «        }|                     d|› �t          d| j        d¬¦  «         |                     |¦  «        \  }}t#          ||                     d	d
¦  «        ¦  «        }	|	�4t          |	t          ¦  «        r|	n|	g}|D ]}|                      |¦  «         Œ|                      d|› �t          |	d¬¦  «         t          |t          ¦  «        sJ ‚|                      ||¬¦  «         t(                               dt-          | ¦  «        › d|› d|› �¦  «         t/          ¦   «                              ||¦  «        \  }
}|r{| j        rt|rrt(                               d|› d�¦  «         |                     |d         ¦  «        }||d …         |d |…         z   }t/          ¦   «                              |¦  «        \  }
}|                      |
¦  «        }
|
|fS )Nr   r4   F)r3   r-   r/   r0   r1   z--Ú*z7Path to a config file containing default values to use.)rw   ÚnargsrB   r@   r=   r   )rw   rB   r@   ©rT   r|   úParser z is parsing args: z, namespace: zhUnparsed arguments when using subparsers. Will attempt to automatically re-order the unparsed arguments rq   r   )ÚsysÚargvÚlistr   r4   rQ   r   Úset_defaultsr3   rR   r+   r   rK   r0   r1   rO   Úparse_known_argsÚgetattrÚreplaceÚ_preprocessingÚloggerÚdebugÚidrC   Ú_subparsersÚwarningÚindexÚ_postprocessing)rS   rT   r|   r~   Úconfig_pathsÚconfig_fileÚconfig_path_nameÚtemp_parserÚargs_with_config_pathr4   Úparsed_argsÚunparsed_argsÚindex_in_startÚnew_start_argsrW   s                 €r)   rˆ   zArgumentParser.parse_known_args  s   ø€ ð ˆ<å”8˜A˜B˜B”<ˆDˆDõ ˜‘:”:ˆDð ÐÝ!™œˆIØÔð 	/Ý˜$Ô*­DÑ1Ô1ð 0Ø $Ô 0Ð1��à#Ô/�Ø+ð /ð /�Ø×!Ò! +Ñ.Ô.Ð.Ð.àÔ#ñ #	õ ˜dÔ6½Ñ<Ô<ð#�Ô(Ð(à"ð õ
 )Ø$)ØÝ0<Ô0NÝ)5Ô)NÝ(Ô4ðñ ô ˆKð ×$Ò$Ø'Ð%Ð'Ð'ÝØØÔ(ØNð %ñ ô ð ð +6×*FÒ*FÀtÑ*LÔ*LÑ'Ð! 4Ý!Ð"7Ð9I×9QÒ9QÐRUÐWZÑ9[Ô9[Ñ\Ô\ˆKàÐ&Ý.8¸ÅdÑ.KÔ.KÐ^˜{˜{ÐR]ÐQ^�Ø#/ð 3ð 3�KØ×%Ò% kÑ2Ô2Ð2Ð2ð ×ÒØ'Ð%Ð'Ð'ÝØ#ØNð	 ñ ô ð õ ˜$¥Ñ%Ô%Ð%Ð%Ð%Ø×Ò °ÐÑ;Ô;Ð;å�ŠÐY�r $™xœxÐYÐY¸4ÐYÐYÈiÐYÐYÑZÔZÐZÝ%*¡W¤W×%=Ò%=¸dÀIÑ%NÔ%NÑ"ˆ�]àð 		R˜TÔ-ð 		RÐ2Dð 		RÝ�NŠNð$à ð$ð $ð $ñô ð ð
 "ŸZšZ¨°aÔ(8Ñ9Ô9ˆNà! . / /Ô2°T¸/¸>¸/Ô5JÑJˆNÝ).©¬×)AÒ)AÀ.Ñ)QÔ)QÑ&ˆK˜à×*Ò*¨;Ñ7Ô7ˆØ˜MÐ)Ð)r(   Útitleú
str | NoneÚdescriptionúargparse._ArgumentGroupc                óz   •— t          ¦   «                              |||p| j        |p| j        |p| j        ¬¦  «        S )N)rœ   rž   rN   Úargument_defaultÚconflict_handler)rC   Úadd_argument_grouprN   r¡   r¢   )rS   rœ   rž   rN   r¡   r¢   rW   s         €r)   r£   z!ArgumentParser.add_argument_groupm  sM   ø€ õ ‰wŒw×)Ò)ØØ#Ø%Ð:¨Ô):Ø-ÐF°Ô1FØ-ÐF°Ô1Fð *ñ 
ô 
ð 	
r(   c                ó”   •— |                       |rt          |¦  «        ng ¬¦  «         t          ¦   «                              |¦  «        S )N)rT   )r‹   r†   rC   Ú
print_help)rS   ÚfilerT   rW   s      €r)   r¥   zArgumentParser.print_help}  sA   ø€ Ø×Ò¨tÐ!;¥ d¡¤ ¸ÐÑ<Ô<Ð<Ý‰wŒw×!Ò! $Ñ'Ô'Ð'r(   ústr | Path | NonerU   r   c                ób  •— |rtt          |¦  «        }| j        t          j        k    r@t	          | j        ¦  «        dk    r(| j        d         j        |i}| j        d         j        |i}t          ||¦  «        }i }| j        D ]÷}|j        |v rì||j                 }t          |t          t          f¦  «        rt          |¬¦  «        }nCt          |t          ¦  «        s.t          j        |¦  «        st          d|j        › d|› �¦  «        ‚|                     |¦  «         |j        |vsJ ‚t          |t          ¦  «        r|nt          j        |¦  «        }|||j        <   |                     |j        ¦  «         Œøt          | j        |d„ ¬¦  «        | _         t'          ¦   «         j        d	i |¤Ž dS )
zUSet the default argument values, either from a config file, or from the given kwargs.r   r   )ÚpathzGot a default for field z' that isn't a dataclass, dict or path: c                 ó*   — t          t          ¦  «        S r[   )r	   rE   r'   r(   r)   ú<lambda>z-ArgumentParser.set_defaults.<locals>.<lambda>²  s   € ¥­TÑ!2Ô!2€ r(   )Údict_factoryNr'   )r   r1   r!   ÚWITHOUT_ROOTÚlenrH   ra   r   rQ   rR   r   rE   ÚdataclassesÚis_dataclassrt   Úset_defaultÚasdictÚpoprF   rC   r‡   )	rS   r4   rU   ÚdefaultsÚ!kwarg_defaults_set_in_dataclassesÚwrapperÚdefault_for_dataclassÚvalue_for_constructor_argumentsrW   s	           €r)   r‡   zArgumentParser.set_defaults�  s  ø€ àð 	2Ý  Ñ-Ô-ˆHØÔ¥:Ô#:Ò:Ð:½sÀ4Ä>Ñ?RÔ?RÐVWÒ?WÐ?Wð
 !œN¨1Ô-Ô2°HÐ=�àœ.¨Ô+Ô0°&Ð9�å ¨&Ñ1Ô1ˆFð -/Ð)Ø”~ð 	)ð 	)ˆGØŒ|˜vÐ%Ð%Ø(.¨w¬|Ô(<Ð%åÐ3µc½4°[ÑAÔAð Ý,5Ð;PÐ,QÑ,QÔ,QÐ)Ð)Ý#Ð$9½4Ñ@Ô@ð ÍÔIaØ)ñJô Jð õ %ð9°7´<ð 9ð 9Ø!6ð9ð 9ñô ð ð ×#Ò#Ð$9Ñ:Ô:Ð:ð ”|Ð+LÐLÐLÐLÐLõ "Ð"7½Ñ>Ô>ðCÐ)Ð)å$Ô+Ð,AÑBÔBð 0ð
 CbÐ1°'´,Ñ?à—
’
˜7œ<Ñ(Ô(Ð(øå%/ØÔ&Ø-Ø2Ð2ð&
ñ &
ô &
ˆÔ"ð 	�‰ŒÔÐ&Ð&˜vÐ&Ð&Ð&Ð&Ð&r(   c                óÀ   — |                       |rt          |¦  «        ng ¦  «         d}| j        D ]#}|dz  }||                     ¦   «         z  }|dz  }Œ$|dz  }|dz  }|S )zúReturns the argparse code equivalent to that of `simple_parsing`.

        TODO: Could be fun, pretty sure this is useless though.

        Returns
        -------
        str
            A string containing the auto-generated argparse code.
        zOparser = ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)ú
zargs = parser.parse_args()
zprint(args)
)r‹   r†   rH   Úequivalent_argparse_code)rS   rT   Úcoder¶   s       r)   r»   z'ArgumentParser.equivalent_argparse_code¸  s�   € ð 	×Ò¨$Ð6�D ™JœJ˜J°BÑ7Ô7Ð7Ø`ˆØ”~ð 	ð 	ˆGØ�D‰LˆDØ�G×4Ò4Ñ6Ô6Ñ6ˆDØ�D‰LˆDˆDØÐ.Ñ.ˆØ�ÑˆØˆr(   )r]   Údataclass_fnrB   r^   Úparentrr   rs   r½   ú Callable[..., DataclassT] | NoneúDataclassT | dict | Noner¾   úDataclassWrapper | Nonec               óø  ‡ ‡	— t          |¦  «        sJ ‚|�4t          |¦  «        s%|t          j        u st	          |t
          ¦  «        sJ ‚|�t          |¦  «        sJ ‚‰ j        D ]8}|j        |k    r+|j	        |k    r t          j
        d d|› d|› d|› d�¬¦  «        ‚Œ9t	          |t          ¦  «        s|€|}t          |¦  «        }|p|} |||||||¬¦  «        Š	‰	j        ‰ j        v r%‰	                     ‰ j        ‰	j                 ¦  «         ‰ j        t          j        k    rXt#          ˆ fd„‰	j        D ¦   «         ¦  «        r8‰	                     ˆ	fd„‰ j                             ¦   «         D ¦   «         ¦  «         ‰	S )	NzDestination attribute z' is already used for dataclass of type z>. Make sure all destinations are unique. (new dataclass type: ú))ÚargumentÚmessage)r_   rs   r]   rB   r¾   r½   c              3  ó4   •K  — | ]}|j         ‰j        v V — Œd S r[   )rs   Ú	_defaults)Ú.0ÚfieldrS   s     €r)   ú	<genexpr>z0ArgumentParser._add_arguments.<locals>.<genexpr>ü  s=   øè è € ð ?
ð ?
Ø-2ˆEŒJ˜$œ.Ð(ð?
ð ?
ð ?
ð ?
ð ?
ð ?
r(   c                óf   •— i | ]-\  }}|d „ t          j        ‰j        ¦  «        D ¦   «         v ¯*||“Œ.S )c                ó   — g | ]	}|j         ‘Œ
S r'   )rs   )rÈ   Úfs     r)   ú
<listcomp>z<ArgumentParser._add_arguments.<locals>.<dictcomp>.<listcomp>  s   € ÐWÐWÐW¨˜QœVÐWÐWÐWr(   )r¯   Úfieldsr_   )rÈ   ÚkÚvrz   s      €r)   ú
<dictcomp>z1ArgumentParser._add_arguments.<locals>.<dictcomp>  sQ   ø€ ð ð ð á˜˜1ØÐWÐW­[Ô-?ÀÔ@UÑ-VÔ-VÐWÑWÔWÐWÐWð �qàWÐWÐWr(   )r   r   Úargparser   rQ   rE   ÚcallablerH   ra   r_   ÚArgumentErrorrw   rÇ   r±   r1   r!   r­   ÚallrÏ   Úitems)
rS   rr   rs   r]   r½   rB   r^   r¾   r¶   rz   s
   `        @r)   rx   zArgumentParser._add_argumentsÌ  s#  øø€ õ ! Ñ0Ô0Ð0Ð0Ð0àˆOÝ$ WÑ-Ô-ð à�(Ô+Ð+Ð+Ý˜'¥4Ñ(Ô(ð ,Ð+ð)ð
 Ð#¥x°Ñ'=Ô'=Ð#Ð#Ð=à”~ð 	ð 	ˆGØŒ|˜tÒ#Ð#ØÔ$¨Ò6Ð6Ý"Ô0Ø!%ð!O¸ð !Oð !OØ-;ð!Oð !Oà=Kð!Oð !Oð !Oðñ ô ð øõ ˜.­$Ñ/Ô/ð 	2ØˆØ(�Ý! .Ñ1Ô1ˆNà#Ð5 ~ˆð .Ð-Ø$ØØØØØ%ð
ñ 
ô 
ˆð Ô˜tœ~Ð-Ð-Ø×#Ò# D¤N°;Ô3CÔ$DÑEÔEÐEØÔ�zÔ6Ò6Ð6½3ð ?
ð ?
ð ?
ð ?
Ø6AÔ6Hð?
ñ ?
ô ?
ñ <
ô <
Ð6ð
 ×#Ò#ðð ð ð à $¤× 4Ò 4Ñ 6Ô 6ðñ ô ñô ð ð Ðr(   úSequence[str]c           	     óê  — t                                d¦  «         | j        rdS t          |¦  «        }| j                             ¦   «         }| j                             |¦  «        }|                      |||¬¦  «        \  }}t          |¦  «        }|D ]R}t                                dt          | ¦  «        › d|j        › d|j        › �¦  «         |                     | ¬¦  «         ŒS|| _        d| _        dS )	zJResolve potential conflicts, resolve subgroups, and add all the arguments.z
PREPROCESSING
N)ÚwrappersrT   r|   rƒ   z$ is Adding arguments for dataclass: z at destinations )ÚparserT)rŒ   r�   rJ   r†   rH   ÚcopyrG   Úresolve_and_flattenÚ_resolve_subgroupsÚ_flatten_wrappersrŽ   r_   Údestinationsrg   )rS   rT   r|   Úwrapped_dataclassesÚchosen_subgroupsÚwrapped_dataclasss         r)   r‹   zArgumentParser._preprocessing  s-  € å�ŠÐ(Ñ)Ô)Ð)àÔ#ð 	ØˆFå�D‰zŒzˆà"œn×1Ò1Ñ3Ô3Ðà"Ô5×IÒIÐJ]Ñ^Ô^Ðà04×0GÒ0GØ(¨t¸yð 1Hñ 1
ô 1
Ñ-ÐÐ-õ 0Ð0CÑDÔDÐð "5ð 	9ð 	9ÐÝ�LŠLðD�"˜T™(œ(ð Dð DÐHYÔHcð Dð DØ#4Ô#AðDð Dñô ð ð ×+Ò+°4Ð+Ñ8Ô8Ð8Ð8à,ˆŒà#'ˆÔ Ð Ð r(   r˜   r   c                ó¨  — t                                d¦  «         t                                d|› �¦  «         |                      |¦  «         t          | j        ¦  «        }| j                             ¦   «         }|D ]"}|j        D ]}|                     |i ¦  «         ŒŒ#|  	                    |||¬¦  «        \  }}|  
                    |||¬¦  «        }|S )a)  Process the namespace by extract the fields and creating the objects.

        Instantiate the dataclasses from the parsed arguments and set them at
        their destination attribute in the namespace.

        Parameters
        ----------
        parsed_args : Namespace
            the result of calling `super().parse_args(...)` or
            `super().parse_known_args(...)`.
            TODO: Try and maybe return a nicer, typed version of parsed_args.


        Returns
        -------
        Namespace
            The original Namespace, with all the arguments corresponding to the
            dataclass fields removed, and with the added dataclass instances.
            Also keeps whatever arguments were added in the traditional fashion,
            i.e. with `parser.add_argument(...)`.
        z
POST PROCESSING
z(raw) parsed args: )rÚ   Úinitial_constructor_arguments)rÚ   rF   )rŒ   r�   Ú _remove_subgroups_from_namespacerß   rH   rF   rÜ   rà   Ú
setdefaultÚ'_fill_constructor_arguments_with_fieldsÚ_instantiate_dataclasses)rS   r˜   rÚ   rF   r¶   Údestinations         r)   r’   zArgumentParser._postprocessing,  s  € õ, 	�ŠÐ*Ñ+Ô+Ð+Ý�ŠÐ8¨;Ð8Ð8Ñ9Ô9Ð9à×-Ò-¨kÑ:Ô:Ð:õ % T¤^Ñ4Ô4ˆà $Ô :× ?Ò ?Ñ AÔ AÐØð 	Bð 	BˆGØ&Ô3ð Bð B�Ø%×0Ò0°¸bÑAÔAÐAÐAðBð .2×-YÒ-YØ (ÐJ_ð .Zñ .
ô .
Ñ*ˆÐ*ð ×3Ò3Ø (ÐBWð 4ñ 
ô 
ˆð Ðr(   rÚ   úlist[DataclassWrapper]ú	list[str]ú-tuple[list[DataclassWrapper], dict[str, str]]c                ó	  ‡— t          |¦  «        }i Š|s|i fS t          j        d| j        d¬¦  «        }t	          j        ¦   «         D �]=}t                               d|› dt          | 	                    ¦   «         ¦  «        › �¦  «         | 
                    ¦   «         D ]Ñ\  }}|j        }	|j        }
|j        t          j        u r|
d         sJ ‚n(|
d         |j        u sJ ‚t!          |
d         ¦  «        rJ ‚t          j        |j        j        v r%|
d         t          j        u sJ ‚t          j        |
d<   t                               d|	› dt)          |
¦  «        › d	�¦  «          |j        |	i |
¤Ž ŒÒ|                     ||¬
¦  «        \  }}t                               d|› d|› d|› d|› �¦  «         t          | 
                    ¦   «         ¦  «        D �]ˆ\  }}|j        }t1          ||¦  «        }||v sJ ‚t                               d|›d|›�¦  «         ||         }t!          |¦  «        r1|}t3          j        t          j        |¦  «        }t9          |¦  «        }nd}|}|j        j        d         |         }|�t!          |¦  «        sJ ‚t?          |¦  «        sJ ‚tA          |¦  «        sJ ‚| !                    d¦  «        d         }|j        }|  "                    |||||¬¦  «        }||j#        vsJ ‚|j#         $                    |¦  «         |j        |u sJ ‚|tK          |¦  «        v sJ ‚|tK          |¦  «        v sJ ‚| &                    |¦  «         |‰|<   �ŒŠ| j'         (                    |¦  «        }t          |¦  «        }ˆfd„| 
                    ¦   «         D ¦   «         }t                               dt          | 	                    ¦   «         ¦  «        › �¦  «         t                               d‰› �¦  «         t                               dt          | 	                    ¦   «         ¦  «        › �¦  «         |st                               d¦  «          n0t                               d|› dtS          |¦  «        › d�¦  «         �Œ?|‰fS )a  Iteratively add and resolve all the choice of argument subgroups, if any.

        This modifies the wrappers in-place, by possibly adding children to the wrappers in the
        list.
        Returns a list with the modified wrappers.

        Each round does the following:
        1.  Resolve any conflicts using the conflict resolver. Two subgroups at the same nesting
            level, with the same name, get a different prefix, for example "--generator.optimizer"
            and "--discriminator.optimizer".
        2.  Add all the subgroup choice arguments to a parser.
        3.  Add the chosen dataclasses to the list of dataclasses to parse later in the main
            parser. This is done by adding wrapping the dataclass and adding it to the `wrappers`
            list.
        F)r-   r2   Úallow_abbrevz Starting subgroup parsing round z: ÚrequiredrB   z(Adding subgroup argument: add_argument(*z **rÃ   r‚   zNesting level z: args: z, parsed_args: z, unused_args: zresolved the subgroup at z: will use the subgroup at key NÚsubgroup_dataclass_typesrq   éÿÿÿÿ)rr   rs   r½   rB   r¾   c                ó$   •— i | ]\  }}|‰v¯	||“ŒS r'   r'   )rÈ   rÐ   rÑ   Úresolved_subgroupss      €r)   rÒ   z5ArgumentParser._resolve_subgroups.<locals>.<dictcomp>õ  s1   ø€ ð $ð $ð $Ù˜˜AÀÐI[Ð@[Ð@[��1Ð@[Ð@[Ð@[r(   zAll subgroups: zResolved subgroups: zUnresolved subgroups: zDone parsing all the subgroups!z4Done parsing a round of subparsers at nesting level z%. Moving to the next round which has z unresolved subgroup choices.)*Ú_get_subgroup_fieldsrÓ   r+   r2   Ú	itertoolsÚcountrŒ   r�   r†   Úkeysr×   Úoption_stringsÚarg_optionsÚsubgroup_defaultr¯   ÚMISSINGr   r   r¾   r´   rR   rO   rˆ   Úsubgroup_choicesr‰   Ú	functoolsÚpartialrŠ   rw   rÉ   ÚmetadatarÔ   r   Úsplitrx   Ú	_childrenry   rß   r³   rG   Úresolver®   )rS   rÚ   rT   r|   Úunresolved_subgroupsÚsubgroup_choice_parserÚcurrent_nesting_levelra   Úsubgroup_fieldÚflagsÚargument_optionsr˜   Úunused_argsÚsubgroup_dictÚchosen_subgroup_keyÚdefault_or_dataclass_fnrB   r½   rr   rs   Úparent_dataclass_wrapperrz   Úall_subgroup_fieldsrô   s                          @r)   rÞ   z!ArgumentParser._resolve_subgroupsW  sÀ  ø€ õ,  4°HÑ=Ô=Ðð 68Ðà#ð 	 à˜R�<Ðõ "*Ô!8Øð
 !Ô0ð ð"
ñ "
ô "
Ðõ  &/¤_Ñ%6Ô%6ð |	ñ |	Ð!õ �LŠLØoÐ3HÐoÐoÍDÐQe×QjÒQjÑQlÔQlÑLmÔLmÐoÐoñô ð ð )=×(BÒ(BÑ(DÔ(Dð Pð PÑ$��nØ&Ô5�Ø#1Ô#=Ð à!Ô2µkÔ6IÐIÐIØ+¨JÔ7Ð7Ð7Ð7Ð7à+¨IÔ6¸.Ô:YÐYÐYÐYÐYÝ4Ð5EÀiÔ5PÑQÔQÐQÐQÐQõ Ô$¨Ô(=Ô(FÐFÐFØ+¨IÔ6½(Ô:KÐKÐKÐKÐKÝ2:Ô2CÐ$ YÑ/å—’Øa¸uÐaÐaÍÐM]ÑI^ÔI^ÐaÐaÐañô ð ð 4Ð&Ô3°UÐOÐ>NÐOÐOÐOÐOð (>×'NÒ'NØ Yð (Oñ (ô (Ñ$ˆK˜õ �LŠLðJÐ!6ð Jð JÀð Jð JØ +ðJð JØ<GðJð Jñô ð õ
 )-Ð-A×-GÒ-GÑ-IÔ-IÑ(JÔ(Jð ;?ñ ;?Ñ$��nð !/Ô ?�Ý3:¸;ÈÑ3MÔ3MÐ#Ø*¨mÐ;Ð;Ð;Ð;õ —’ð/°ð /ð /Ø*ð/ð /ñô ð ð
 +8Ð8KÔ*LÐ'Ý(Ð)@ÑAÔAð 
à5�GÝ#,Ô#4µ[Ô5HÈ'Ñ#RÔ#R�LÝ%)¨'¡]¤]�N�Nà"�GØ#:�LØ%3Ô%9Ô%BÐC]Ô%^Ø+ô&�Nð �Õ*?ÀÑ*HÔ*H��ÐHÝ Ñ-Ô-Ð-Ð-Ð-Ý(¨Ñ8Ô8Ð8Ð8Ð8à—z’z #‘” rÔ*�Ø+9Ô+@Ð(ð #×1Ò1Ø#1ØØ!-Ø#Ø3ð 2ñ ô �ð #Ð*BÔ*LÐLÐLÐLÐLØ(Ô2×9Ò9¸+ÑFÔFÐFØ"Ô)Ð-EÐEÐEÐEÐEØ/Õ3DÀXÑ3NÔ3NÐNÐNÐNÐNØ"Õ&7¸Ñ&AÔ&AÐAÐAÐAÐAð %×(Ò(¨Ñ.Ô.Ð.Ø+>Ð" 4Ñ(Ñ(ð Ô.×6Ò6°xÑ@Ô@ˆHå"6°xÑ"@Ô"@Ðð$ð $ð $ð $Ø!4×!:Ò!:Ñ!<Ô!<ð$ñ $ô $Ð õ �LŠLÐM­4Ð0C×0HÒ0HÑ0JÔ0JÑ+KÔ+KÐMÐMÑNÔNÐNÝ�LŠLÐDÐ0BÐDÐDÑEÔEÐEÝ�LŠLÐUµ$Ð7K×7PÒ7PÑ7RÔ7RÑ2SÔ2SÐUÐUÑVÔVÐVà'ð Ý—’Ð>Ñ?Ô?Ð?Ø�å—’ðPØ,ðPð PåÐ/Ñ0Ô0ðPð Pð Pñô ð ñ ð
 Ð+Ð+Ð+r(   úargparse.Namespacec                óÂ   — t          | j        ¦  «        }|sdS t          |d¦  «        si |_        |D ],}t	          ||¦  «        }||j        |<   t          ||¦  «         Œ-dS )zjRemoves the subgroup choice results from the namespace.

        Modifies the namespace in-place.
        NÚ	subgroups)rõ   rH   Úhasattrr  r‰   Údelattr)rS   r˜   Úsubgroup_fieldsra   Úchosen_values        r)   ræ   z/ArgumentParser._remove_subgroups_from_namespace  s‚   € õ /¨t¬~Ñ>Ô>ˆàð 	ØˆFå�{ KÑ0Ô0ð 	'Ø$&ˆKÔ!à#ð 	'ð 	'ˆDÝ" ;°Ñ5Ô5ˆLØ*6ˆKÔ! $Ñ'Ý�K Ñ&Ô&Ð&Ð&ð	'ð 	'r(   rF   údict[str, dict[str, Any]]c                óÒ  — |                      ¦   «         }| j        t          j        k    r*t	          |¦  «        t	          |¦  «        k    s
J d¦   «         ‚t          |d„ d¬¦  «        }t	          |¦  «        t	          t          |¦  «        ¦  «        k    sJ ‚|D �]É}t                               d|j	        › �¦  «         |j	        D �]›}t                               d|› �¦  «         |j
        }|                     |¦  «        }t          j        |j        v r|i k    rd}	n|}	nt          |||¦  «        }	t          j        |j        v r!|	€t                               d|› d	�¦  «         Œ |j        �Gt#          j        |¦  «        \  }
}t                               d
|	› d|› d|
› d�¦  «         |	||
         |<   Œît'          ||¦  «        s3t                               d|› d|	› �¦  «         t)          |||	¦  «         �Œ1t+          ||¦  «        }|j        | j        v r6t                               d|› d|› d|	› �¦  «         t)          |||	¦  «         �Œ…t1          d|› d|› d|	› �¦  «        ‚�ŒË|rJ ‚|S )a-  Create the instances set them at their destination in the namespace.

        We now have all the constructor arguments for each instance.
        We can now sort out the dependencies, create the instances, and set them
        as attributes of the Namespace.

        Since the dataclasses might have nested children, and we need to pass
        all the constructor arguments when calling the dataclass constructors,
        we create the instances in a "bottom-up" fashion, creating the deepest
        objects first, and then setting their value in the
        `constructor_arguments` dict.

        Parameters
        ----------
        parsed_args : argparse.Namespace
            The 'raw' Namespace that is produced by `parse_args`.

        wrappers : list[DataclassWrapper]
            The (assumed flattened) list of dataclass wrappers that were created with
            `add_arguments`.

        constructor_arguments : dict[str, dict[str, Any]]
            The partially populated dict of constructor arguments for each dataclass. This will be
            consumed in order to create the dataclass instances for each DataclassWrapper.

        Returns
        -------
        argparse.Namespace
            The transformed namespace with the instances set at their
            corresponding destinations.
        ú should have one dict per wrapperc                ó   — | j         S r[   )Únesting_level)Úws    r)   r«   z9ArgumentParser._instantiate_dataclasses.<locals>.<lambda>H  s   €  A¤O€ r(   T)ÚkeyÚreversez,Instantiating the wrapper with destinations z+Instantiating the dataclass at destination NzSuppressing entire destination zE because none of itssubattributes were specified on the command line.zSetting a value of z at attribute z in parent at key rq   zsetting attribute 'z!' on the Namespace to a value of z6Overwriting defaults in the namespace at destination 'z' on the Namespace (z) to a value of z%Namespace should not already have a 'z?' attribute!
The value would be overwritten:
- existing value: z
- new value:      )rÜ   r.   r   ÚALWAYS_MERGEr®   ÚsortedÚsetrŒ   r�   rà   r½   r³   rÓ   r   r´   Ú_create_dataclass_instancer¾   r   Ú
split_destr  Úsetattrr‰   ra   rÇ   ÚRuntimeError)rS   r˜   rÚ   rF   Úsorted_dc_wrappersÚ
dc_wrapperrê   ÚconstructorÚconstructor_argsÚvalue_for_dataclass_fieldÚ
parent_keyÚattrÚexistings                r)   ré   z'ArgumentParser._instantiate_dataclasses  sy  € ðJ !6× :Ò :Ñ <Ô <Ðð Ô#Õ'9Ô'FÒFÐFÝ�x‘=”=¥CÐ(=Ñ$>Ô$>Ò>Ð>Ð>Ð@bÑ>Ô>Ð>õ 6<ØÐ3Ð3¸Tð6
ñ 6
ô 6
Ðõ Ð%Ñ&Ô&­#­cÐ2DÑ.EÔ.EÑ*FÔ*FÒFÐFÐFÐFà,ð <	ñ <	ˆJÝ�LŠLÐaÈ
ÔH_ÐaÐaÑbÔbÐbà)Ô6ð 9ñ 9�Ý—’ÐXÈ;ÐXÐXÑYÔYÐYð )Ô5�Ø#8×#<Ò#<¸[Ñ#IÔ#IÐ õ Ô$¨
Ô(;Ð;Ð;Ø'¨2Ò-Ð-Ø48Ð1Ð1ð 5EÐ1Ð1å0JØ" KÐ1Añ1ô 1Ð-õ Ô$¨
Ô(;Ð;Ð;Ð@YÐ@aÝ—L’LðM¸+ð Mð Mð Mñô ð ð ð
  Ô&Ð2Ý',Ô'7¸Ñ'DÔ'DÑ$�J Ý—L’Lð7Ð.Gð 7ð 7ÐW[ð 7ð 7Ø)3ð7ð 7ð 7ñô ð ð ?XÐ)¨*Ô5°dÑ;Ð;å  ¨kÑ:Ô:ð Ý—L’LðE¨kð Eð EØ)BðEð Eñô ð õ ˜K¨Ð6OÑPÔPÐPÑPõ  ' {°KÑ@Ô@�HØ!”¨$¬.Ð8Ð8ÝŸšðgÐU`ð gð gØ19ðgð gØKdðgð gñô ð õ   ¨[Ð:SÑTÔTÐTÑTå*ðMÀKð Mð Mð 2:ðMð Mð 2Kð	Mð Mñô ð ñg9ðx )Ð(Ð(Ð(àÐr(   rå   ú4tuple[argparse.Namespace, dict[str, dict[str, Any]]]c                ó¤  — | j         t          j        k    r*t          |¦  «        t          |¦  «        k    s
J d¦   «         ‚|                     ¦   «         }t          |¦  «        }i }|D ]™}|j        D ]�}t          j        |j	        v r
|j
        |vrŒ|j        r#t                               d|j
        › �¦  «         ŒI|j        j        sŒV|                     |j
        |j        ¦  «        }	|	||j
        <    || ||	|¬¦  «         Œ�Œšt          j        di |¤Ž}
|r:t                               d|› �¦  «         t                               d|
› �¦  «         |
|fS )a”  Create the constructor arguments for each instance.

        Creates the arguments by consuming all the attributes from
        `parsed_args`.
        Here we imitate a custom action, by having the FieldWrappers be
        callables that set their value in the `constructor_args` attribute.

        Parameters
        ----------
        parsed_args : argparse.Namespace
            the argparse.Namespace returned from super().parse_args().

        wrappers : list[DataclassWrapper]
            The (assumed flattened) list of dataclass wrappers that were created with
            `add_arguments`.

        constructor_arguments : dict[str, dict[str, Any]]
            The dict of constructor arguments to create for each dataclass. This will be filled by
            each FieldWrapper.

        Returns
        -------
        argparse.Namespace
            The namespace, without the consumed arguments.
        r  z/Not calling the subgroup FieldWrapper for dest )rÛ   r|   ÚvaluesrF   zdeleted values: zleftover args: r'   )r.   r   r  r®   rÜ   ÚvarsrÏ   rÓ   r   r´   ra   Úis_subgrouprŒ   r�   rÉ   Úinitr³   rB   r   )rS   r˜   rÚ   rå   rF   Úparsed_arg_valuesÚdeleted_valuesr¶   rÉ   r0  Úleftover_argss              r)   rè   z6ArgumentParser._fill_constructor_arguments_with_fields�  s¯  € ð@ Ô#Õ'9Ô'FÒFÐFÝ�x‘=”=¥CØ-ñ%ô %ò ð ð à1ñô ð ð
 !>× BÒ BÑ DÔ DÐå  Ñ-Ô-ÐØ)+ˆàð 	ð 	ˆGØ œð ð �ÝÔ$¨Ô(8Ð8Ð8¸U¼ZÈ{Ð=ZÐ=ZØàÔ$ð å—L’LÐ!_ÐSXÔS]Ð!_Ð!_Ñ`Ô`Ð`Øà”{Ô'ð àð +×.Ò.¨u¬z¸5¼=ÑIÔI�Ø-3�˜uœzÑ*ð �ØØ)Ø!Ø*?ð	ñ ô ð ð ð-õ> !Ô*Ð?Ð?Ð->Ð?Ð?ˆØð 	<Ý�LŠLÐ<¨NÐ<Ð<Ñ=Ô=Ð=Ý�LŠLÐ:¨=Ð:Ð:Ñ;Ô;Ð;àÐ3Ð3Ð3r(   Úintc                ó   — | j         j        S r[   ©rG   Úmax_attempts)rS   s    r)   Úconfilct_resolver_max_attemptsz-ArgumentParser.confilct_resolver_max_attemptsá  s   € àÔ&Ô3Ð3r(   Úvaluec                ó   — || j         _        d S r[   r9  )rS   r<  s     r)   r;  z-ArgumentParser.confilct_resolver_max_attemptså  s   € à/4ˆÔÔ,Ð,Ð,r(   )r,   r6   r-   r7   r.   r   r/   r   r1   r!   r2   r8   r3   r9   r4   r:   r5   r;   )rX   rR   rY   r   )r_   r`   ra   rR   r]   rR   rB   rb   r^   rc   rY   rd   )
r_   ri   ra   rR   r]   rR   r^   rj   rY   r   )r_   r   ra   rR   r]   rR   rB   rl   r^   rc   rY   rd   )r_   rn   ra   rR   r]   rR   rB   rb   r^   rj   rY   ro   )NNF)rT   r{   r|   r}   r~   r7   )NNNNN)rœ   r�   rž   r�   rY   rŸ   )NN)rT   r{   r[   )r4   r§   rU   r   rY   rl   )rT   r{   rY   rR   )rr   r`   rs   rR   r]   rR   r½   r¿   rB   rÀ   r^   rj   r¾   rÁ   rY   ro   )r'   N)rT   rØ   r|   r}   rY   rl   )r˜   r   rY   r   )rÚ   rë   rT   rì   r|   r}   rY   rí   )r˜   r  rY   rl   )r˜   r  rÚ   rë   rF   r  rY   r  )r˜   r  rÚ   rë   rå   r  rY   r.  )rY   r7  )r<  r7  )!r$   r%   r&   Ú__doc__r   ÚAUTOr   r    ÚFLATr!   ÚDEFAULTr   rD   rO   r   r   rg   rˆ   r£   r¥   r‡   r»   rx   r‹   r’   rÞ   ræ   ré   rè   Úpropertyr;  ÚsetterÚ__classcell__)rW   s   @r)   r+   r+   -   s<  ø€ € € € € ð@ð @ðJ -/ØØ2DÔ2IØ7BÔ7GØ!7Ô!<Ø",Ô"4Ø/BØ15Ø@DØ26ð:7ð :7ð :7ð :7ð :7ð :7ð :7ð :7ðz
ð 
ð 
ð 
ð 
ð 
ð ð Ø%)Ø:Jð	ð 	ð 	ð 	ð 	ñ „Xð	ð ð Ø>Nðð ð ð ð ñ „Xðð ð ØØ:Jð	ð 	ð 	ð 	ð 	ñ „Xð	ð  Ø%)Ø>Nð=ð =ð =ð =ð =ð =ðB &*Ø&*Ø#(ð	R*ð R*ð R*ð R*ð R*ð R*ð R*ðl !Ø"&ØØØð
ð 
ð 
ð 
ð 
ð 
ð 
ð (ð (ð (ð (ð (ð (ð (ð5'ð 5'ð 5'ð 5'ð 5'ð 5'ð 5'ðnð ð ð ð ð2 Ø9=Ø,0Ø>NØ*.ð=ð =ð =ð =ð =ð =ð~(ð (ð (ð (ð (ðB)ð )ð )ð )ð^ '+ð	n,ð n,ð n,ð n,ð n,ð`'ð 'ð 'ð 'ð&sð sð sð sðjP4ð P4ð P4ð P4ðd ð4ð 4ð 4ñ „Xð4ð $Ô*ð5ð 5ð 5ñ +Ô*ð5ð 5ð 5ð 5ð 5r(   r+   Úconfigr\   T)r]   r-   r1   r.   r/   r0   r2   r3   Úconfig_classr`   r4   úPath | str | NonerT   ústr | Sequence[str] | NonerB   rb   ra   rR   r]   r-   r7   r1   r!   r.   r   r/   r   r2   r8   r3   r9   rY   r   c               ó(  — ||k    rt          d¦  «        ‚t          d|||||	|
||dœ|¤Ž}|                     | |||¬¦  «         t          |t          ¦  «        rt          j        |¦  «        }|                     |¦  «        }t          ||¦  «        }|S )a9  Parse the given dataclass from the command-line.

    See the `ArgumentParser` constructor for more details on the arguments (they are the same here
    except for `nested_mode`, which has a different default value).

    If `config_path` is passed, loads the values from that file and uses them as defaults.
    z3`add_config_path_arg` cannot be the same as `dest`.©r1   r-   r4   r.   r/   r0   r2   r3   )r]   ra   rB   r'   )	rt   r+   rg   rQ   rR   Úshlexr  Ú
parse_argsr‰   )rF  r4   rT   rB   ra   r]   r-   r1   r.   r/   r0   r2   r3   rU   rÛ   r˜   rE  s                    r)   ÚparserM  ë  sÁ   € ð0 Ð"Ò"Ð"ÝÐNÑOÔOÐOåð 
ØØØØ/Ø(GØ!9Ø'Ø/ð
ð 
ð ð
ð 
€Fð ×Ò˜¨f¸4ÈÐÑQÔQÐQå�$�ÑÔð !ÝŒ{˜4Ñ Ô ˆØ×#Ò# DÑ)Ô)€Kå ¨TÑ2Ô2€FØ€Mr(   F)r-   r1   r.   r/   r0   r2   r3   ri   úDataclass | Noner~   r;   útuple[Dataclass, list[str]]c          
     ó  — t          |t          ¦  «        rt          j        |¦  «        }t	          |||||	|
||¬¦  «        }|                     | ||¬¦  «         |                     ||¬¦  «        \  }}t          ||¦  «        }||fS )a[  Parse the given dataclass from the command-line, returning the leftover arguments.

    See the `ArgumentParser` constructor for more details on the arguments (they are the same here
    except for `nested_mode`, which has a different default value).

    If `config_path` is passed, loads the values from that file and uses them as defaults.
    rJ  )ra   rB   )r~   )rQ   rR   rK  r  r+   rg   rˆ   r‰   )rF  r4   rT   rB   ra   r~   r-   r1   r.   r/   r0   r2   r3   rÛ   r˜   Úunknown_argsrE  s                    r)   rˆ   rˆ     s¯   € õ0 �$�ÑÔð !ÝŒ{˜4Ñ Ô ˆÝØØàØ/Ø(GØ!9Ø'Ø/ð
ñ 
ô 
€Fð ×Ò˜¨D¸'ÐÑBÔBÐBØ &× 7Ò 7ØÐ!3ð !8ñ !ô !Ñ€K�õ   ¨TÑ2Ô2€FØ�<ÐÐr(   rÚ   rë   údict[str, FieldWrapper]c                ó˜   — i }t          | ¦  «        }|D ]5}|j        D ]+}|j        r"||                     ¦   «         vsJ ‚|||j        <   Œ,Œ6|S r[   )rß   rÏ   r2  r0  ra   )rÚ   r  Úall_wrappersr¶   rÉ   s        r)   rõ   rõ   I  sv   € Ø€OÝ$ XÑ.Ô.€LØð 4ð 4ˆØ”^ð 	4ð 	4ˆEØÔ ð 4Ø O×$:Ò$:Ñ$<Ô$<Ð<Ð<Ð<Ð<Ø.3� ¤
Ñ+øð	4ð Ðr(   c                ó:   — t          t          | ¦  «        ¦  «        S r[   )r†   r!  ©rÚ   s    r)   Ú_remove_duplicatesrW  T  s   € Ý•�H‘”ÑÔÐr(   rl   c                ó~   — t          | ¦  «        t          t          | ¦  «        ¦  «        k    rt          d¦  «        ‚d S )Nz“Duplicate wrappers found! This is a potentially nasty bug on our part. Please make an issue at https://www.github.com/lebrice/SimpleParsing/issues )r®   r!  r%  rV  s    r)   Ú_assert_no_duplicatesrY  X  sA   € Ý
ˆ8�}„}��C ™MœMÑ*Ô*Ò*Ð*Ýðañ
ô 
ð 	
ð +Ð*r(   c                ór   — t          | ¦  «         t          | ¦  «        }t          d„ |D ¦   «         g ¦  «        S )zITakes a list of nodes, returns a flattened list of all nodes in the tree.c              3  óF   K  — | ]}|gt          |j        ¦  «        z   V — Œd S r[   )r†   Údescendants©rÈ   r  s     r)   rÊ   z$_flatten_wrappers.<locals>.<genexpr>d  s3   è è € Ð>Ð>¨a��•d˜1œ=Ñ)Ô)Ñ)Ð>Ð>Ð>Ð>Ð>Ð>r(   )rY  Ú_unflatten_wrappersÚsum)rÚ   Ú
roots_onlys     r)   rß   rß   `  s<   € å˜(Ñ#Ô#Ð#Ý$ XÑ.Ô.€JÝÐ>Ð>°:Ð>Ñ>Ô>ÀÑCÔCÐCr(   c                ó8   — t          | ¦  «         d„ | D ¦   «         S )z¸Given a list of nodes in one or more trees, returns only the root nodes.

    In our context, this is all the dataclass arg groups that were added with
    `parser.add_arguments`.
    c                ó    — g | ]}|j         ­	|‘ŒS r[   )r¾   r]  s     r)   rÎ   z'_unflatten_wrappers.<locals>.<listcomp>n  s   € Ð4Ð4Ð4�! 1¤8Ð#3ˆAÐ#3Ð#3Ð#3r(   )rY  rV  s    r)   r^  r^  g  s&   € õ ˜(Ñ#Ô#Ð#Ø4Ð4�xÐ4Ñ4Ô4Ð4r(   r¶   rd   r(  úCallable[..., DataclassT]r)  údict[str, Any]c           	     óV  — | j         rz| j        €s| j        D ]F}||j                 }|j        }t                               d|j        › d|› d|› �¦  «         ||k    r n&ŒGt                               d| j        › d�¦  «         d S t                               d|› d|› d�¦  «          |d	i |¤ŽS )
Nzfield z, arg value: z, default value: zAll fields for z' were either at their default, or None.zCalling constructor: z(**rÃ   r'   )ÚoptionalrB   rÏ   rs   rŒ   r�   ra   )r¶   r(  r)  Úfield_wrapperÚ	arg_valueÚdefault_values         r)   r"  r"  q  sý   € ð Ôð ˜GœOÐ3Ø$œ^ð 	ð 	ˆMØ(¨Ô);Ô<ˆIØ)Ô1ˆMÝ�LŠLð2˜Ô+ð 2ð 2¸)ð 2ð 2Ø"/ð2ð 2ñô ð ð ˜MÒ)Ð)ð �ð *õ
 �LŠLÐ`¨7¬<Ð`Ð`Ð`ÑaÔaÐaØ�4Ý
‡L‚LÐL¨ÐLÐLÐ9IÐLÐLÐLÑMÔMÐMØˆ;Ð*Ð*Ð)Ð*Ð*Ð*r(   )NNNrE  )rF  r`   r4   rG  rT   rH  rB   rb   ra   rR   r]   rR   r-   r7   r1   r!   r.   r   r/   r   r2   r8   r3   r9   rY   r   )NNNrE  F)rF  ri   r4   rG  rT   rH  rB   rN  ra   rR   r~   r7   r-   r7   r1   r!   r.   r   r/   r   r2   r8   r3   r;   rY   rO  )rÚ   rë   rY   rR  )rÚ   rë   rY   rë   )rÚ   rë   rY   rl   )r¶   rd   r(  rc  r)  rd  rY   rb   )Dr>  Ú
__future__r   rÓ   r¯   rþ   rö   rK  r„   ru   r   r   r   r   r   Úcollectionsr	   Úcollections.abcr
   Úloggingr   Úpathlibr   r   r   r   Ú simple_parsing.helpers.subgroupsr   Ú)simple_parsing.wrappers.dataclass_wrapperr   r\   r   Ú	conflictsr   r   Úhelp_formatterr   Ú"helpers.serialization.serializabler   r   r   r   r   r   rÚ   r   r   r   Úwrappers.field_wrapperr    r!   r$   rŒ   r%  Ú
SystemExitr#   r+   r­   r?  r@  rM  rˆ   rõ   rW  rY  rß   r^  r"  r'   r(   r)   ú<module>rv     s“  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø 
€
€
€
Ø €€€Ø BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BØ #Ð #Ð #Ð #Ð #Ð #Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø JÐ JÐ JÐ JÐ JÐ Jà Ð Ð Ð Ð Ð Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø /Ð /Ð /Ð /Ð /Ð /Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9ðð ð ð ð ð ð ð ð ð ð ð ð ð ð BÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AØ FÐ FÐ FÐ FÐ FÐ FÐ FÐ Fà	ˆ�8Ñ	Ô	€ð	ð 	ð 	ð 	ð 	�< ñ 	ô 	ð 	ðz5ð z5ð z5ð z5ð z5�XÔ,ñ z5ô z5ð z5ð@ &*Ø'+Ø!%Øð.ð ØØ(Ô5Ø.@Ô.EØ3>Ô3CØ3Ô8Ø+>Ø-1ð.ð .ð .ð .ð .ð .ðf &*Ø'+Ø $ØØ$ð* ð Ø(Ô5Ø.@Ô.EØ3>Ô3CØ3Ô8Ø+>Ø'+ð* ð * ð * ð * ð * ð * ðZð ð ð ðð ð ð ð
ð 
ð 
ð 
ðDð Dð Dð Dð5ð 5ð 5ð 5ð+ð +ð +ð +ð +ð +r(   