
    hm!                    n   S SK Jr  S SKrS SKJrJrJrJr  SSKJ	r	  \" S5      r
\R                  " SS9 " S	 S
5      5       r\ S\	SSSSS.             SS jjj5       r\ S\	SSSSS.             SS jjj5       r S\	SSSSS.             SS jjjr\R                  " SS9 " S S5      5       r\SSSSSSSS\	S.	                   SS jj5       r\SSSSSSSS\	S.	                   SS jj5       rSSSSSSSS\	S.	                   SS jjrg)    )annotationsN)AnyCallableTypeVaroverload   )MISSING_NONPROPTT)frozenc                  R    \ rS rSr% S\S'   S\S'   S\S'   S\S'   S	\S
'   SS jrSrg)_SubcommandConfig   
str | Nonenamer   defaultdescriptionboolprefix_name.Callable[[], type | Callable[..., Any]] | Noneconstructor_factoryc                ,    [         R                  U 5      $ N)object__hash__)selfs    O/home/james-whalen/.local/lib/python3.13/site-packages/tyro/conf/_confstruct.pyr   _SubcommandConfig.__hash__   s    t$$     N)returnint)__name__
__module____qualname____firstlineno____annotations__r   __static_attributes__r   r   r   r   r      s$    
LGG%r   r   )r   r   r   constructorr   c                   g r   r   r   r   r   r   r(   r   s         r   
subcommandr+           r   c                   g r   r   r*   s         r   r+   r+   #   r,   r   c               N   ^ Tb
  Ub   S5       e[        U UUUTc  US9$ U4S jS9$ )a  Configure subcommand behavior for Union types in the CLI.

When tyro encounters a Union type over structures, it creates subcommands in the
CLI. The `subcommand()` function allows you to customize the appearance and behavior
of these subcommands.

Example::

    from dataclasses import dataclass
    from typing import Annotated, Union
    import tyro

    @dataclass
    class TrainConfig:
        learning_rate: float = 0.01

    @dataclass
    class EvalConfig:
        checkpoint_path: str

    @dataclass
    class MainConfig:
        # Customized subcommands:
        mode: Union[
            Annotated[TrainConfig, tyro.conf.subcommand("train")],
            Annotated[EvalConfig, tyro.conf.subcommand("evaluate")]
        ]

    # CLI usage: python script.py mode:train --mode.learning-rate 0.02

If a default value is provided both via `subcommand(default=...)` and in the field
definition itself (`field = default`), the field default will take precedence.

Args:
    name: Custom name for the subcommand in the CLI.
    default: Default instance to use for this subcommand.
    description: Custom helptext for this subcommand.
    prefix_name: Whether to include the parent field name as a prefix in the subcommand
        name (default: True).
    constructor: Custom constructor type or function for parsing arguments.
    constructor_factory: Function that returns a constructor type for parsing arguments
        (cannot be used with constructor).

Returns:
    A configuration object that should be attached to a type using `Annotated[]`.
;`constructor` and `constructor_factory` cannot both be set.c                    > T $ r   r   r(   s   r   <lambda>subcommand.<locals>.<lambda>o       Kr   )r   )r   r*   s       ` r   r+   r+   /   sV    n ',?,K EL #.#6  =P r   c                  j    \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
\S'   S\S'   \rS\S'   Srg)
_ArgConfigt   r   r   metavarhelp!str | Callable[[str], str] | Nonehelp_behavior_hintztuple[str, ...] | Nonealiasesbool | Noner   r   r   r   r   r   N)r"   r#   r$   r%   r&   r	   r   r'   r   r   r   r6   r6   t   s6    

99##GG"GS"r   r6   	r   r8   r9   r;   r<   r   r(   r   r   c        	            g r   r   r>   s	            r   argr@           r   c        	            g r   r   r>   s	            r   r@   r@      rA   r   c        	           ^ Tb
  Ub   S5       eUb&  U H   n	U	R                  S5      (       a  M   S5       e   [        U UUUUb  [        U5      OSUTc  UUS9$ U4S jUS9$ )a
  Provides fine-grained control over individual CLI argument properties.

The `arg()` function allows you to customize how individual arguments appear and
behave in the command-line interface. This provides more control than relying on
the automatic argument generation.

Example::

    from dataclasses import dataclass
    from typing import Annotated
    import tyro

    @dataclass
    class Config:
        # Default argument appearance
        regular_option: int = 1

        # Customized argument
        custom_option: Annotated[
            str,
            tyro.conf.arg(
                name="opt",                     # Shorter name
                help="Custom help message",     # Override docstring
                aliases=("-o", "--short-opt"),  # Alternative flags
                metavar="VALUE"                 # Display in help
            )
        ] = "default"

    # Usage:
    # python script.py --regular-option 5 --opt custom_value
    # python script.py --regular-option 5 -o custom_value

The `arg()` function should be used at the root level of annotations and not
nested within container types like lists.

Args:
    name: A custom name for the argument in the CLI.
    metavar: Argument placeholder shown in usage messages. The type is used by default.
    help: Custom helptext for this argument. The docstring is used by default.
    help_behavior_hint: Override the highlighted hint text that follows the helptext.
        This is typically used for hints like "(default: XXX)" or "(optional)".
        You can provide either a string or a lambda function that takes a formatted
        default value as input.
    aliases: Alternative flag names for this argument. All strings must start
        with a hyphen (-). Aliases are not prefixed in nested structures and are
        not supported for positional arguments.
    prefix_name: Controls whether to prefix the argument name based on its position
        in a nested structure. Arguments are prefixed by default.
    constructor: A custom constructor type or function to use in place of the
        argument's type for parsing. See :mod:`tyro.constructors` for more details.
    constructor_factory: A function that returns a constructor type for parsing.
        This cannot be used together with the constructor parameter.
    default: Default value for the argument. This will be used only if the field
        does not have a default value. The field default takes precedence.

Returns:
    A configuration object that should be attached to a type using `Annotated[]`.
Nr/   -z,Argument alias needs to start with a hyphen!c                    > T $ r   r   r1   s   r   r2   arg.<locals>.<lambda>   r4   r   )r   r8   r9   r;   r<   r   r   r   )
startswithr6   tuple)
r   r8   r9   r;   r<   r   r(   r   r   aliass
         `   r   r@   r@      s    L ',?,K EL E##C((X*XX(  -")"5g4#.#6  =P r   r   )r   r   r   r   r   r   r   r   r(   Noner   r   r    r   )r   r   r   r   r   r   r   r   r(    type | Callable[..., Any] | Noner   rJ   r    r   )r   r   r   r   r   r   r   r   r(   rK   r   r   r    r   )r   r   r8   r   r9   r   r;   r:   r<   "tuple[str, ...] | list[str] | Noner   r=   r(   rJ   r   r   r   r   r    r   )r   r   r8   r   r9   r   r;   r:   r<   rL   r   r=   r(   rK   r   rJ   r   r   r    r   )r   r   r8   r   r9   r   r;   r:   r<   rL   r   r=   r(   rK   r   r   r   r   r    r   )
__future__r   dataclassestypingr   r   r   r   
_singletonr	   r
   	dataclassr   r+   r6   r@   r   r   r   <module>rR      sn   "  3 3 (CL d#% % $% 
 #"JN
  	
   H  
 
 #"48 $
  	
  2   
 B #"48JNB
B B 	B
 B 2B HB BJ d## # $# 
 <@26#JN"
  	
 : 0   H   
 
 <@26#48 $"
  	
 : 0  2    
  <@26#48JN"Y
Y Y 	Y
 :Y 0Y Y 2Y HY Y Yr   