
    !<ir              	          d dl Z d dlZd dlZd dlmZmZ d dlmZmZm	Z	m
Z
mZmZ d dlmZ ej        dk    rd dlmZ nd dlmZ d dlmZmZmZmZmZmZmZmZmZ erd dlmZ d d	lmZ d d
l m!Z! de
d         fdZ" ej#                    Z$ G d de          Z% G d de          Z& G d de          Z'de(fdZ)e G d d                      Z*de+e*         de+e         de,e+e*         e+e         f         fdZ-dS )    N)CallableIterable)TYPE_CHECKINGAnyLiteralOptionalUnioncast)field)      )Self)	UNSETSentinel
SortHelperfrozenhelp_formatter_converteris_iterableresolve_callablessort_key_converterto_tuple_converter)ArgumentCollection)HelpFormatter)	Parametervaluer   c                 :    |d S |j         rt          d          d S )Nz,Group default_parameter cannot have a group.)group
ValueError)instance	attributer   s      /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/cyclopts/group.py%_group_default_parameter_must_be_noner"   '   s2    }{ IGHHHI I    c                       e Zd ZdS )"DEFAULT_COMMANDS_GROUP_SORT_MARKERN__name__
__module____qualname__ r#   r!   r%   r%   4           Dr#   r%   c                       e Zd ZdS )#DEFAULT_ARGUMENTS_GROUP_SORT_MARKERNr&   r*   r#   r!   r-   r-   8   r+   r#   r-   c                       e Zd ZdS )$DEFAULT_PARAMETERS_GROUP_SORT_MARKERNr&   r*   r#   r!   r/   r/   <   r+   r#   r/   valc                 &    | r| nt                      S N)object)r0   s    r!   _group_name_converterr4   @   s    #33688#r#   c                   F   e Zd ZU  edde          Zeed<   	 dZeed<    eddd	          Z	e
dz  ed
<    edded          Zeed<    edd d          Zdedgef         z  eedgef                  z  ed<    eded          Zed         ed<    eded          Zeded         df         ed<   edefd            Zed             Zed             Zed$defd            Zed%defd            Zed&defd!            Z e	 	 d'dddddd"defd#            Z!dS )(Group name)defaultalias	converter_namehelpNshowT)r9   r:   kw_only_showsort_key)r9   r:   r;   r?   	_sort_keyc                 `    t          t          t          df         t          |                     S )N.)r
   tupler   r   )xs    r!   <lambda>zGroup.<lambda>`   s"    Dx}!57I!7L7LMM r#   )r9   r;   r?   r   	validator)r9   rG   r?   r   default_parameter)r9   plainr   help_formatterreturnc                 J    t          | j                  t          u rdn| j        S )Nr7   )typer<   r3   selfs    r!   r8   z
Group.namen   s"    $*%%//rrTZ?r#   c                 F    | j         t          | j                  n| j         S r2   )r@   boolr8   rN   s    r!   r>   z
Group.showr   s    "&*"4tDI$*Dr#   c                 0    | j         t          u rd n| j         S r2   )rB   r   rN   s    r!   rA   zGroup.sort_keyv   s    ~..ttDNBr#   	Argumentsc                 &     | |t                     S N)rA   )r-   clsr8   s     r!   create_default_argumentszGroup.create_default_argumentsz   s    s4"EFFFFr#   
Parametersc                 &     | |t                     S rU   )r/   rV   s     r!   create_default_parameterszGroup.create_default_parameters~   s    s4"FGGGGr#   Commandsc                 &     | |t                     S rU   )r%   rV   s     r!   create_default_commandszGroup.create_default_commands   s    s4"DEEEEr#   r>   rA   rG   rH   rJ   c          	          t          t                    }t          j        |          rt          |          }|
t          |f}n%t          |          rt          |          |f}n||f} | |||||||          S )ay  Create a group with a globally incrementing :attr:`~Group.sort_key`.

        Used to create a group that will be displayed **after** a previously instantiated :meth:`Group.create_ordered` group on the help-page.

        Parameters
        ----------
        name: str
            Group name used for the help-page and for group-referenced-by-string.
            This is a title, so the first character should be capitalized.
            If a name is not specified, it will not be shown on the help-page.
        help: str
            Additional documentation shown on the help-page.
            This will be displayed inside the group's panel, above the parameters/commands.
        show: bool | None
            Show this group on the help-page.
            Defaults to :obj:`None`, which will only show the group if a ``name`` is provided.
        sort_key: Any
            If provided, **prepended** to the globally incremented counter value (i.e. has priority during sorting).

        validator: None | Callable[[ArgumentCollection], Any] | Iterable[Callable[[ArgumentCollection], Any]]
            Group validator to collectively apply.
        default_parameter: cyclopts.Parameter | None
            Default parameter for elements within the group.
        help_formatter: cyclopts.help.protocols.HelpFormatter | None
            Custom help formatter for this group's help display.
        Nr_   )next_sort_key_counterinspectisgeneratorr   r   rD   )	rW   r8   r=   r>   rA   rG   rH   rJ   counts	            r!   create_orderedzGroup.create_ordered   s    L &''x(( 	&H~~Hu~HH"" 	)h/HH %(Hs/)
 
 
 	
r#   )rS   )rY   )r\   )r7   r7   )"r'   r(   r)   r   r4   r<   str__annotations__r=   r@   rQ   r   rB   r   rG   r   r   r"   rH   r   r   rJ   r	   r   propertyr8   r>   rA   classmethodr   rX   r[   r^   rf   r*   r#   r!   r6   r6   D   s        r;PQQQE3QQQ D#NNN t64HHHE4$;HHHU$	  Is    qvpuMMq q qIth 45s:;;hxQePfhkPkGl>mm    05u70 0 0x,    QVPU 8$Q Q QNE$(: ;_LM    @c @ @ @ X@ E E XE C C XC G G4 G G G [G H HT H H H [H F F F F F [F  6

 6
 6
 6
 
6
 6
 6
 [6
 6
 6
r#   r6   groups
attributesrK   c                    t          |           t          |          k    sJ | s| |fS t          j        d t          | |d          D                       }t          d |D             ddi\  }}t	          |          t	          |          fS )a  Sort groups for the help-page.

    Note, much logic is similar to here and ``HelpPanel.sort``, so any changes here should probably be reflected over there as well.

    Parameters
    ----------
    groups: list[Group]
        List of groups to sort by their ``sort_key``.
    attributes: list[Any]
        A list of equal length to ``groups``.
        Remains consistent with ``groups`` via argsort.
    c                 j    g | ]0\  }}t          t          |j        |          |j        ||f          1S r*   )r   r   rB   r8   ).0r   r    s      r!   
<listcomp>zsort_groups.<locals>.<listcomp>   sM     	
 	
 	
 y (%@@%*uV_N`aa	
 	
 	
r#   F)strictc                     g | ]	}|j         
S r*   )r   )ro   rE   s     r!   rp   zsort_groups.<locals>.<listcomp>   s    &G&G&G1qw&G&G&Gr#   rq   )lenr   sortziplist)rk   rl   sorted_entries
out_groupsout_attributess        r!   sort_groupsrz      s     v;;#j//)))) "z!!_	
 	
$'
5$I$I$I	
 	
 	
 N "%&G&G&G&G&G!VPU!V!VJ
T.1111r#   ).rc   	itertoolssyscollections.abcr   r   typingr   r   r   r   r	   r
   attrsr   version_infor   typing_extensionscyclopts.utilsr   r   r   r   r   r   r   r   r   cyclopts.argumentr   cyclopts.help.protocolsr   cyclopts.parameterr   r"   re   rb   r%   r-   r/   rg   r4   r6   rv   rD   rz   r*   r#   r!   <module>r      s        



 . . . . . . . .                     w&&&&&&
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  -444444555555,,,,,,Ih{F[ I I I I $IO%% 	 	 	 	 	 	 	 		 	 	 	 	( 	 	 		 	 	 	 	8 	 	 	$s $ $ $ $ x
 x
 x
 x
 x
 x
 x
 x
v2U 2c 2uT%[RVWZR[E[?\ 2 2 2 2 2 2r#   