o
    )Tiu                     @   s  U d Z ddlZddlZddlZddl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 ddlmZmZmZmZmZmZ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  g dZ!e" Z#ee e$d< G dd de%Z&dddZ'dd Z(dd Z)e(dG dd dZ*e(dG dd dZ+e(dG dd  d Z,e(d!G d"d# d#eZ-e(d$d%e.fd&d'Z/e(d(	)	)dd*e.d+e.fd,d-Z0e(d.d/e1fd0d1Z2e(d2dd3ee. fd4d5Z3d6Z4d7d8 Z5d9Z6d:Z7d;Z8dd=d>Z9d?Z:d@Z;G dAdB dBZ<G dCdD dDe=Z>e(dEdFedGe1d/dfdHdIZ?dJZ@dKdL ZAdMZBG dNdO dOZCdPeDdQe.d/e.fdRdSZEdPeDdTe.d/e.fdUdVZFeZGddWdXZHeHdY eHdZ eHd[ eHd eHd\ eHd] eHd^ eHd_ eHd` eHda eHdb eHdc eHdd eHde eHdfdgdhi e(diG djdk dkZIe(dlG dmdn dneZe(dodaed/ee1ef fdpdqZJe(drdseDe1ef d/efdtduZKeddxdyZLedvee1ef d/ee1ef fdzdyZLe(d{d|dy ZLG d}d~ d~ZMe(ddd ZNdS )zDeprecated code.    N)ArgumentError)Enum)import_module)Path)
ModuleType)AnyCallableDictOptionalSetUnionoverload   )Actionnull_logger)LoggerProperty)	Namespace)ArgumentParserruamelCommentedMap)
ActionEnumActionJsonnetExtVarsActionOperators
ActionPathActionPathListHelpFormatterDeprecationsr   PathDeprecationsParserDeprecationsParserErrorcompose_dataclassesget_config_read_modedict_to_namespacenamespace_to_dictr   set_docstring_parse_optionsset_config_read_modeset_url_support
strip_metausage_and_exit_error_handlershown_deprecation_warningsc                   @      e Zd ZdS )JsonargparseDeprecationWarningN__name__
__module____qualname__ r.   r.   L/home/ubuntu/.local/lib/python3.10/site-packages/jsonargparse/_deprecated.pyr)   .       r)   c                 C   s   t jdd }|dk}|dk}|r@| tvs|rBddlm} ttdkr0|s0|dt|d	 d
 ||t|d	 d
 t	|  d S d S d S )N!JSONARGPARSE_DEPRECATION_WARNINGS offallr   )warningr   a!  
                By default only one JsonargparseDeprecationWarning per type is shown. To see
                all warnings set environment variable JSONARGPARSE_DEPRECATION_WARNINGS=all
                and to disable the warnings set JSONARGPARSE_DEPRECATION_WARNINGS=off.
                   
stacklevel)
osenvirongetlowerr'   _utilr5   lenr)   add)	componentmessager8   env_varshow_warningsall_warningsr5   r.   r.   r/   deprecation_warning2   s   	rE   c                    s    fdd}|S )Nc                    s|   d d } j d u rdn j |  _ t r0t j fdd} j _| _ }|S t  fdd}|S )Nz

.. warning::
    
r2   c                    s   t   | j|i | d S N)rE   _original_initselfargskwargsr@   rA   r.   r/   	init_wrapN   s   
z;deprecated.<locals>.deprecated_decorator.<locals>.init_wrapc                     s   t    | i |S rG   )rE   )rK   rL   rM   r.   r/   	decoratedY   s   
z;deprecated.<locals>.deprecated_decorator.<locals>.decorated)__doc__inspectisclass	functoolswraps__init__rH   )r@   r5   rN   rO   rA   )r@   r/   deprecated_decoratorH   s   

	z(deprecated.<locals>.deprecated_decoratorr.   )rA   rW   r.   rV   r/   
deprecatedG   s   rX   c                     s&  ddl m  t drJ dddddtffd	d
 j _ _ fdd} | d | d | d | d dtttt	t
f f dtttt	t
f f fdd} j _| _dtttt	t
f f dt	fdd} j _| _dddtttt	t
f f dtddfdd} j _| _dS )zAdds parse_as_dict support to ArgumentParser as a patch.

    This is a temporal backward compatible support for parse_as_dict to have
    cleaner code in v4.0.0 and warn users about the deprecation and future
    removal.
    r   )r   _unpatched_initab  
    ``parse_as_dict`` parameter was deprecated in v4.0.0 and will be removed in
    v5.0.0. After removal, the parse_*, dump, save and instantiate_classes
    methods will only return Namespace and/or accept Namespace objects. If
    needed for some use case, config objects can be converted to a nested dict
    using the Namespace.as_dict method.
    z
    ``with_meta`` parameter was deprecated in v4.44.0 and will be removed in
    v5.0.0. After removal, config objects will always include metadata. To
    remove metadata from a config object, do ``.clone(with_meta=False)``.
    F)parse_as_dictrZ   c                   s(   || _ |r
t  | j|i | d S rG   )_parse_as_dictrE   rY   )rJ   rZ   rK   rL   )message_parse_as_dictpatched_initr.   r/   r]   |   s   
z)parse_as_dict_patch.<locals>.patched_initc                    sd   d|  d dddt t dtdtttttf f f fdd tt|  t|   d S )	N_unpatched_F)	with_meta_skip_validationr_   r`   returnc                   sd   t | }||d|i|}t|trt  |s'|d u r!| js'|jdd}| jr0|s0| S |S )Nr`   F)r_   )getattr
isinstanceboolrE   _default_metacloner[   as_dict)rJ   r_   r`   rK   rL   parse_methodcfg)message_with_metapatched_parseunpatched_method_namer.   r/   rk      s   


zFparse_as_dict_patch.<locals>.patch_parse_method.<locals>.patched_parse)	r
   rd   r   r   r	   strr   setattrrb   )method_name)r   rj   )rk   rl   r/   patch_parse_method   s   z/parse_as_dict_patch.<locals>.patch_parse_method
parse_argsparse_object	parse_envparse_stringri   ra   c                 [   s8   t |tr
| |}| j|fi |}| jr| S |S rG   )rc   dict_apply_actions_unpatched_instantiate_classesr[   rg   )rJ   ri   rL   r.   r.   r/   patched_instantiate_classes   s   

z8parse_as_dict_patch.<locals>.patched_instantiate_classesc                 _   s0   t |tr| j|dd}| j|g|R i |S )NTr`   )rc   ru   rr   _unpatched_dump)rJ   ri   rK   rL   r.   r.   r/   patched_dump   s   
z)parse_as_dict_patch.<locals>.patched_dumpT)	multifiler|   Nc                _   s8   |rt |tr| j|dd}| j|g|R d|i|S )NTry   r|   )rc   ru   rr   _unpatched_save)rJ   ri   r|   rK   rL   r.   r.   r/   patched_save   s   z)parse_as_dict_patch.<locals>.patched_save)_corer   hasattrrd   rU   rY   r   r   r	   rm   r   instantiate_classesrw   dumprz   saver}   )rp   rx   r{   r~   r.   )r   r\   rj   r]   r/   parse_as_dict_patchc   s2   
",
r   z
    ActionEnum was deprecated in v3.9.0 and will be removed in v5.0.0. Enums now
    should be given directly as a type as explained in :ref:`enums`.
c                   @       e Zd ZdZdd Zdd ZdS )r   zEAn action based on an Enum that maps to-from strings and enum values.c                 K   s@   d|v rddl m} ||d tstd|d | _d S td)Nenumr   )is_subclassz(Expected enum to be an subclass of Enum.zExpected enum keyword argument.)_commonr   r   
ValueError_type)rJ   rL   r   r.   r.   r/   rU      s   zActionEnum.__init__c                 O   4   | dr	tdddlm} || jddi |S )Ntypez ActionEnum doesn't allow a type.r   ActionTypeHinttypehintr.   r;   r   
_typehintsr   r   rJ   rK   rL   r   r.   r.   r/   __call__      
zActionEnum.__call__Nr+   r,   r-   rP   rU   r   r.   r.   r.   r/   r      s    
r   z
    ActionOperators was deprecated in v3.0.0 and will be removed in v5.0.0. Now
    types should be used as explained in :ref:`restricted-numbers`.
c                   @   r   )r   z5Action to restrict a value with comparison operators.c                 K   s   d|v rLt |d tr|d gn|d }tt||dt|ddf}ddlm}m} ||v r8|| | _d S |d |dt|d |dd| _d S t	d)Nexprr   joinandr   )registered_typesrestricted_number_typezExpected expr keyword argument.)
rc   tuplesortedr;   inttypingr   r   r   r   )rJ   rL   restrictionsregister_keyr   r   r.   r.   r/   rU      s    "
zActionOperators.__init__c                 O   r   )Nr   z%ActionOperators doesn't allow a type.r   r   r   r.   r   r   r.   r.   r/   r      r   zActionOperators.__call__Nr   r.   r.   r.   r/   r      s    r   z
    ActionPath was deprecated in v3.11.0 and will be removed in v5.0.0. Paths
    now should be given directly as a type as explained in :ref:`parsing-paths`.
c                   @   s.   e Zd ZdZ	d
dedefddZdd Zd	S )r   z!Action to check and store a path.Fmode
skip_checkc                 C   s   ddl m} |||d| _d S )Nr   	path_typer   )r   r   r   )rJ   r   r   r   r.   r.   r/   rU     s   zActionPath.__init__c                 O   r   )Nr   z ActionPath doesn't allow a type.r   r   r   r.   r   r   r.   r.   r/   r   
  r   zActionPath.__call__N)F)r+   r,   r-   rP   rm   rd   rU   r   r.   r.   r.   r/   r      s    
	r   z
    ActionPathList was deprecated in v4.20.0 and will be removed in v5.0.0. Instead
    use as type ``List[<path_type>]`` with ``enable_path=True``.
c                       s@   e Zd ZdZddee def fddZdd	 Zd
d Z  Z	S )r   zUAction to check and store a list of file paths read from a plain text file or stream.Ncwdr   relc                    s   |dur"ddl m} ||| _|| _| jdvr td| j ddS d|vr*td|d| _|d	| _t jd
i | dS )a  Initializer for ActionPathList instance.

        Args:
            mode: The required type and access permissions among [fdrwxcuFDRWX] as a keyword argument (uppercase means
                not), e.g. ActionPathList(mode='fr').
            rel: Whether relative paths are with respect to current working directory 'cwd' or the list's parent
                directory 'list'.

        Raises:
            ValueError: If any of the parameters (mode or rel) are invalid.
        Nr   r   >   r   listz(rel must be either "cwd" or "list", got .r   zExpected mode keyword argument._relr.   )r   r   r   r   r   popsuperrU   )rJ   r   r   rL   r   	__class__r.   r/   rU     s   

zActionPathList.__init__c                 O   sj   t |dkr%d|v r|d dvrtd| j|d< | j|d< td
i |S t|d | j| |d  d	S )zParses an argument as a PathList and if valid sets the parsed value to the corresponding key.

        Raises:
            TypeError: If the argument is not a valid PathList.
        r   nargs>   r   +z/ActionPathList only supports nargs of 1 or "+".r   r   r   r6   Nr.   )r>   r   r   r   r   rn   dest_check_typerI   r.   r.   r/   r   4  s   

zActionPathList.__call__c                    s  |g kr|S ddl m} | }|st|ts|g}t|trt fdd|D r|}g }|D ]}z&|dkr:tjnt|}dd | D }W d    n1 sRw   Y  W n t	yo } zt
d| d	| |d }~ww t }	 jd
kr|dkrttjtj|tj z5t|D ])\}
}z	 |||
< W q t
y } zt
d|
d  d| d| |d }~ww W t|	 nt|	 w ||7 }q0|S )Nr   )_is_action_value_listc                 3   s    | ]
}t | j V  qd S rG   )rc   r   ).0vrJ   r.   r/   	<genexpr>K  s    z-ActionPathList._check_type.<locals>.<genexpr>-c                 S   s   g | ]}|  qS r.   )strip)r   xr.   r.   r/   
<listcomp>Q  s    z.ActionPathList._check_type.<locals>.<listcomp>zProblems reading path list: z :: r   zPath number z	 in list z, )_actionsr   rc   r   r4   sysstdinopen	readlinesFileNotFoundError	TypeErrorr9   getcwdr   chdirpathabspathr   pardir	enumerater   )rJ   valuer   islistpath_list_filespath_list_filef	path_listexr   numvalr.   r   r/   r   C  sD     
zActionPathList._check_type)Nr   )
r+   r,   r-   rP   r
   rm   rU   r   r   __classcell__r.   r.   r   r/   r     s
    r   z
    set_url_support was deprecated in v3.12.0 and will be removed in v5.0.0.
    Optional config read modes should now be set using function
    set_parsing_settings.
enabledc                 C   s.   ddl m}m} || d| v rdndd dS )z2Enables/disables URL support for config read mode.r   )_get_config_read_mode_set_config_read_modesTFurls_enabledfsspec_enabledN)
_optionalsr   r   )r   r   r   r.   r.   r/   r$   c  s
   
r$   z
    set_config_read_mode was deprecated in v4.39.0 and will be removed in
    v5.0.0. Optional config read modes should now be set using function
    set_parsing_settings.
Fr   r   c                 C      ddl m} || |d dS )z,Enables/disables optional config read modes.r   )r   r   N)r   r   )r   r   r   r.   r.   r/   r#   r  s
   

r#   z
    get_config_read_mode was deprecated in v4.39.0 and will be removed in
    v5.0.0. The config read mode is internal and thus shouldn't be used.
ra   c                  C   s   ddl m}  |  S )z(Returns the current config reading mode.r   r   )r   r   r   r.   r.   r/   r     s   r   z
    set_docstring_parse_options was deprecated in v4.39.0 and will be removed in
    v5.0.0. Docstring parse options should now be set using function
    set_parsing_settings.
attribute_docstringsc                 C   r   )z#Sets options for docstring parsing.r   )_set_docstring_parse_options)styler   N)r   r   )r   r   r   r.   r.   r/   r"     s
   
r"   z
    The return_parser parameter was deprecated in v4.5.0 and will be removed in
    v5.0.0. Instead of this use function capture_parser.
c                 C      t dt| d d S )NzCLI.__init__.return_parserr7   )rE   cli_return_parser_messager7   r.   r.   r/   %deprecation_warning_cli_return_parser     r   z
    Setting the logger property to None was deprecated in v4.10.0 and will raise
    an exception in v5.0.0. Use False instead.
z
    Setting the env_prefix property to None was deprecated in v4.11.0 and will raise
    an exception in v5.0.0. Use True instead.
z
    The skip_check parameter of Path was deprecated in v4.20.0 and will be
    removed in v5.0.0. There is no reason to use a Path type if its checks are
    disabled. Instead use a type such as str or os.PathLike.
r6   c                 C   r   )NzPath.__init__r7   )rE   path_skip_check_messager7   r.   r.   r/   path_skip_check_deprecation  r   r   a  
    Path objects are not meant to be mutable. To make this more explicit,
    attributes have been renamed and changed into properties without setters.
    Please update your code to use the new property names and don't modify path
    attributes. The changes are: ``rel_path`` -> ``relative`` and ``abs_path``
    -> ``absolute``, ``cwd`` no name change, ``skip_check`` will be removed.
z
    Calling Path objects is deprecated and will be removed in v5.0.0. Use the
    ``absolute`` or ``relative`` properties instead.
c                   @   s   e Zd ZdZedd Zejdd Zedd Zejdd Zedd	 Zejd
d	 Zdd Z	dd Z
edd Zejdd ZeeddedefddZdS )r   zDeprecated methods for Path.c                 C      t dt | jS NzPath attr getrE   path_immutable_attrs_message	_relativer   r.   r.   r/   rel_path     
zPathDeprecations.rel_pathc                 C      t dt || _d S NzPath attr setr   )rJ   r   r.   r.   r/   r        

c                 C   r   r   rE   r   	_absoluter   r.   r.   r/   abs_path  r   zPathDeprecations.abs_pathc                 C   r   r   r   )rJ   r   r.   r.   r/   r     r   c                 C      | j S rG   )_cwdr   r.   r.   r/   r        zPathDeprecations.cwdc                 C   r   r   )rE   r   r   )rJ   r   r.   r.   r/   r     r   c                 C   s.   ddl m} ||dd| _| jrt  d S d S )Nr   )get_private_kwargsFr   )r=   r   _skip_checkr   )rJ   rL   r   r.   r.   r/   _deprecated_kwargs  s
   
z#PathDeprecations._deprecated_kwargsc                 C   s   | j r|d7 }|S )Nr   r   )rJ   namer.   r.   r/   _repr_skip_check  s   z!PathDeprecations._repr_skip_checkc                 C   r   rG   r   r   r.   r.   r/   r     r   zPathDeprecations.skip_checkc                 C   r   r   )rE   r   r   )rJ   r   r.   r.   r/   r     r   Tabsolutera   c                 C   s   |r| j S | jS rG   )r   r   )rJ   r   r.   r.   r/   r     s   zPathDeprecations.__call__N)T)r+   r,   r-   rP   propertyr   setterr   r   r   r   r   rX   path_call_messagerd   rm   r   r.   r.   r.   r/   r     s,    







r   c                   @   r(   )DebugExceptionNr*   r.   r.   r.   r/   r    r0   r  z
    usage_and_exit_error_handler was deprecated in v4.20.0 and will be removed
    in v5.0.0. With the removal of error_handler, there is no longer a need for
    this function.
parserrA   c                 C   s6   |  tj | j|d}tjd|  | d dS )zPrints the usage and exits with error code 2 (same behavior as argparse).

    Args:
        parser: The parser object.
        message: The message describing the error being handled.
    )progrA   z%(prog)s: error: %(message)s
r6   N)print_usager   stderrr  writeexit)r  rA   rK   r.   r.   r/   r&   
  s   r&   z
    ArgumentParser's error_handler was deprecated in v4.20.0 and will be removed
    in v5.0.0. Instead use the new exit_on_error parameter from argparse.
c                 C   r   )NzArgumentParser.error_handlerr7   )rE   error_handler_messager7   r.   r.   r/   !deprecation_warning_error_handler"  r   r	  z
    ``default_meta`` property was deprecated in v4.44.0 and will be removed in
    v5.0.0. After removal, config objects will always include metadata. To
    remove metadata from a config object, do ``.clone(with_meta=False)``.
c                       s   e Zd ZdZddd fdd
Zeeddeee	e
gdf  fd	d
Zejdd
 ZeeedefddZejdefddZeddedefddZeddd Zeddd Z  ZS )r   zHHelper class for ArgumentParser deprecations. Will be removed in v5.0.0.FN)error_handlerdefault_metac                   s4   t  j|i | || _|d u rd| _d S || _d S )NT)r   rU   r
  re   r  )rJ   r
  r  rK   rL   r   r.   r/   rU   0  s
   

zParserDeprecations.__init__zCerror_handler property is deprecated and will be removed in v5.0.0.ra   c                 C   r   )a=  Property for the error_handler function that is called when there are parsing errors.

        :getter: Returns the current error_handler function.
        :setter: Sets a new error_handler function (Callable[self, message:str] or None).

        Raises:
            ValueError: If an invalid value is given.
        )_error_handlerr   r.   r.   r/   r
  8     z ParserDeprecations.error_handlerc                 C   s^   |durd}t  d }|jttddrd}t| t|s&|dv r+|| _	d S t
d)	NFr6   r   jsonargparsez_deprecated.py   >   FNz/error_handler can be either a Callable or None.)rQ   stackfilenameendswithr9   fspathr   r	  callabler  r   )rJ   r
  r8   r  r.   r.   r/   r
  E  s   
c                 C   r   )zWhether by default metadata is included in config objects.

        :getter: Returns the current default metadata setting.
        :setter: Sets the default metadata setting.

        Raises:
            ValueError: If an invalid value is given.
        )re   r   r.   r.   r/   r  R  r  zParserDeprecations.default_metar  c                 C   s&   t |trtdt || _d S td)NzArgumentParser.default_metazdefault_meta expects a boolean.)rc   rd   rE   default_meta_messagere   r   )rJ   r  r.   r.   r/   r  _  s   


z
        instantiate_subclasses was deprecated in v4.0.0 and will be removed in v5.0.0.
        Instead use instantiate_classes.
    ri   c                 C   s   | j |ddS )NF)instantiate_groups)r   rJ   ri   r.   r.   r/   instantiate_subclassesg  s   z)ParserDeprecations.instantiate_subclassesz
        add_dataclass_arguments was deprecated in v4.35.0 and will be removed in
        v5.0.0. Instead use add_class_arguments.
    c                 O   s&   d|v r| d|d< | j|i |S )Ntitlehelp)r   add_class_argumentsrI   r.   r.   r/   add_dataclass_argumentsn  s   z*ParserDeprecations.add_dataclass_argumentsz
        ArgumentParser.check_config was deprecated in v4.35.0 and will be removed in
        v5.0.0. Instead use validate.
    c                 O   s   | j |i |S rG   )validaterI   r.   r.   r/   check_configw  s   zParserDeprecations.check_config)r+   r,   r-   rP   rU   r   rX   r
   r   r   rm   r
  r   r  rd   r  r   r  r  r  r   r.   r.   r   r/   r   -  s&    "

r   rL   skip_validationc                 C   s@   | dd }|rtdt| |d ur|}t| ddd |S )Nr   zUnexpected keyword parameters: zjskip_check parameter was deprecated in v4.35.0 and will be removed in v5.0.0. Instead use skip_validation.   r7   )r   r   setrE   )r@   rL   r  r   r.   r.   r/   deprecated_skip_check  s   r"  with_commentsc                 C   s*   |  dd }|d urttddd |S |S )Nyaml_commentszkyaml_comments parameter was deprecated in v4.44.0 and will be removed in v5.0.0. Instead use with_comments.r   r7   )r   rE   deprecated_yaml_comments)rL   r#  r$  r.   r.   r/   r%    s   r%  c                    st   d }t |d| }|tj|< td| d fdd}||_tttj d |j	d< ||j	d	< d S )
Njsonargparse.zdeprecated z
        Only use the public API as described in
        https://jsonargparse.readthedocs.io/en/stable/#api-reference. Importing
        from z is kept only to avoid breaking code that does not
        correctly use the public API. It will no longer be available from v5.0.0.
    c                    s6   d } r|  v r |  \}} t td| | S )N_r&  )rb   r   )r   
new_modulemappingsmodule_namer.   r/   __getattr__  s   
z&deprecated_module.<locals>.__getattr__z.py__file____path__)
r   r   modulesrX   r,  rm   r   r-  parent__dict__)r+  r*  module_pathmoduler,  r.   r)  r/   deprecated_module  s   

r4  actionsclicore
formattersjsonnet
jsonschemalink_argumentsloaders_dumpers	namespaceparameter_resolvers
signatures	typehintsutil	optionalsimport_docstring_parse)r   import_docstring_parserzr
    ActionJsonnetExtVars was deprecated in v4.24.0 and will be removed in
    v5.0.0. Instead use ``type=dict``.
c                   @   s   e Zd ZdZdd ZdS )r   z?Action to add argument to provide ext_vars for jsonnet parsing.c                 O   s*   ddl m} |tddi |}d|_|S )Nr   r   r   Tr.   )r   r   ru   jsonnet_ext_vars)rJ   rK   rL   r   actionr.   r.   r/   r     s   zActionJsonnetExtVars.__call__N)r+   r,   r-   rP   r   r.   r.   r.   r/   r     s    r   z
    LoggerProperty was deprecated in v4.40.0 and will be removed from the public
    API in v5.0.0. There is no replacement since jsonargparse is not a logging
    library. A similar class can be found in reconplogger package.
c                   @   s   e Zd ZdZdS )r   z2Adds a logger property, intended for internal use.N)r+   r,   r-   rP   r.   r.   r.   r/   r     s    r   z
    namespace_to_dict was deprecated in v4.40.0 and will be removed in v5.0.0.
    Instead you can use ``.clone().as_dict()`` or ``.as_dict()``.
c                 C   s   |    S )zHReturns a copy of a nested namespace converted into a nested dictionary.)rf   rg   )r=  r.   r.   r/   r!     s   r!   z
    dict_to_namespace was deprecated in v4.43.0 and will be removed in v5.0.0.
    No replacement is provided because blindly converting a dictionary to a
    namespace may not yield the same results as using a parser, which could lead
    to confusion.
cfg_dictc                 C      ddl m} || S )z5Converts a nested dictionary into a nested namespace.r   )r    )
_namespacer    )rG  _dict_to_namespacer.   r.   r/   r      s   r    ri   r   c                 C      d S rG   r.   ri   r.   r.   r/   r%        r%   c                 C   rK  rG   r.   rL  r.   r.   r/   r%      rM  zv
    strip_meta was deprecated in v4.43.0 and will be removed in v5.0.0.
    Instead use ``.clone(with_meta=False)``.
c                 C   rH  )z6Removes all metadata keys from a configuration object.r   )remove_meta)rI  rN  )ri   rN  r.   r.   r/   r%     s   c                	       s   e Zd ZdZ fddZeddedefddZed	d
edefddZ	edd
ededede
fddZedd
ededede
fddZ  ZS )r   zNHelper class for DefaultHelpFormatter deprecations. Will be removed in v5.0.0.c                    s,   ddl m} t j|i | || | _d S )Nr   )YAMLCommentFormatter)jsonargparse._formattersrO  r   rU   _yaml_formatter)rJ   rK   rL   rO  r   r.   r/   rU     s   z"HelpFormatterDeprecations.__init__zIThe add_yaml_comments method is deprecated and will be removed in v5.0.0.ri   ra   c                 C   s   | j |S )z Adds help text as yaml comments.)rQ  add_yaml_commentsr  r.   r.   r/   rR    s   z+HelpFormatterDeprecations.add_yaml_commentszNThe set_yaml_start_comment method is deprecated and will be removed in v5.0.0.textc                 C   s   | j || dS )zSets the start comment to a ruamel.yaml object.

        Args:
            text: The content to use for the comment.
            cfg: The ruamel.yaml object.
        N)rQ  set_yaml_start_comment)rJ   rS  ri   r.   r.   r/   rT    s   z0HelpFormatterDeprecations.set_yaml_start_commentzNThe set_yaml_group_comment method is deprecated and will be removed in v5.0.0.keydepthc                 C      | j |||| dS )a  Sets the comment for a group to a ruamel.yaml object.

        Args:
            text: The content to use for the comment.
            cfg: The parent ruamel.yaml object.
            key: The key of the group.
            depth: The nested level of the group.
        N)rQ  set_yaml_group_commentrJ   rS  ri   rU  rV  r.   r.   r/   rX  '     
z0HelpFormatterDeprecations.set_yaml_group_commentzQThe set_yaml_argument_comment method is deprecated and will be removed in v5.0.0.c                 C   rW  )a  Sets the comment for an argument to a ruamel.yaml object.

        Args:
            text: The content to use for the comment.
            cfg: The parent ruamel.yaml object.
            key: The key of the argument.
            depth: The nested level of the argument.
        N)rQ  set_yaml_argument_commentrY  r.   r.   r/   r[  3  rZ  z3HelpFormatterDeprecations.set_yaml_argument_comment)r+   r,   r-   rP   rU   rX   rm   rR  r   rT  r   rX  r[  r   r.   r.   r   r/   r     s    	$r   z
    compose_dataclasses is deprecated and will be removed in v5.0.0. There is
    no direct replacement, whoever is interested can copy the code from an old
    release.
c                     s,   ddl }|jG  fdddg R  }|S )zYReturns a dataclass inheriting all given dataclasses and properly handling __post_init__.r   Nc                       s   e Zd Z fddZdS )z.compose_dataclasses.<locals>.ComposedDataclassc                    s"    D ]}t |dr||  qd S )N__post_init__)r   r\  )rJ   argrK   r.   r/   r\  L  s
   

z<compose_dataclasses.<locals>.ComposedDataclass.__post_init__N)r+   r,   r-   r\  r.   r^  r.   r/   ComposedDataclassJ  s    r_  )dataclasses	dataclass)rK   r`  r_  r.   r^  r/   r   @  s   r   )r   )FF)NN)r6   rG   )ri   r   ra   r   )OrP   rS   rQ   r9   r   argparser   r   r   	importlibr   pathlibr   typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   InternalLoggerPropertyrI  r   _type_checkingr   r   __all__r!  r'   __annotations__DeprecationWarningr)   rE   rX   r   r   r   r   r   rd   r$   r#   rm   r   r"   r   r   logger_property_none_message env_prefix_property_none_messager   r   r   r   r   	Exceptionr  r&   r  r	  r  r   ru   r"  r%  r   r4  r   r!   r    r%   r   r   r.   r.   r.   r/   <module>   s    $
^L


:R
$
1