
    k7i                     p    S SK Jr  \(       a  S SKJr   " S S5      r " S S\5      r\" 5       r\" SSS	9rg
)    )TYPE_CHECKING)ArgumentCollectionc                   D    \ rS rSr   S	S\S\S-  S\4S jjrS
S jrSrg)LimitedChoice   Nminmax
allow_nonec                     Xl         Uc  U R                   =(       d    SOUU l        U R                  U R                   :  a  [        S5      eX0l        g)aL  Group validator that limits the number of selections per group.

Commonly used for enforcing mutually-exclusive parameters (default behavior).

Parameters
----------
min: int
    The minimum (inclusive) number of CLI parameters allowed.
    If negative, then **all** parameters in the group must have CLI values provided.
max: int | None
    The maximum (inclusive) number of CLI parameters allowed.
    Defaults to ``1`` if ``min==0``, ``min`` otherwise.
allow_none: bool
    If :obj:`True`, also allow 0 CLI parameters (even if ``min`` is greater than 0).
    Defaults to :obj:`False`.
N   zmax must be >=min.)r   r	   
ValueErrorr
   )selfr   r	   r
   s       T/home/james-whalen/.local/lib/python3.13/site-packages/cyclopts/validators/_group.py__init__LimitedChoice.__init__   s@    , &)kDHHMs88dhh122$    c                    [        U5      nUR                  SS9n[        U5      nU R                  (       a  US:X  a  g U R                  S:  aw  X$:X  a  g U Vs1 s H  oUR                  iM     nnU Vs1 s H  oUR                  iM     nn[        Xg-
  5      n[        U5      S:X  a  [        SUS    35      e[        SU 35      eU R                  Us=::  a  U R                  ::  a   g   SSR                  S	 U 5       5      -   S
-   n	U R                  S:X  a  U R                  S:X  a  [        SU	 35      e[        SU SU	 SU R                   SU R                   S3	5      es  snf s  snf )NT)	value_setr   r   zMissing argument: zMissing arguments: {z, c              3      #    U  HY  nUR                   (       a7  UR                   S    R                  (       a  UR                   S    R                  OUR                  v   M[     g7f)r   N)tokenskeywordname).0as     r   	<genexpr>)LimitedChoice.__call__.<locals>.<genexpr>;   sG      : -.HH!9L9LAHHQK''STSYSYY:s   A!A#}zMutually exclusive arguments: z	Received z arguments: z. Only [z] choices may be specified.)	len	filter_byr
   r   r   sortedr   r	   join)
r   argument_collection
group_sizepopulated_argument_collectionn_argumentsr   	all_namessupplied_namesmissing_names	offenderss
             r   __call__LimitedChoice.__call__$   s   ,-
(;(E(EPT(E(U%78??{a/XX\()<=)<A)<I=.KL.Kff.KNL"9#=>M=!Q& #5mA6F5G!HII #6}o!FGGXX00 1 )) : 
   xx1}Q #A)!MNN }L8DHH:UWX\X`X`Waa|} + >Ls   E!3E&)r
   r	   r   )r   NF)r#   r   )	__name__
__module____qualname____firstlineno__intboolr   r+   __static_attributes__ r   r   r   r      s7      	%% 4Z% 	%8"r   r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )MutuallyExclusiveI   c                 "   > [         TU ]  5         g)zyAlias for :class:`LimitedChoice` to make intentions more obvious.

Only 1 argument in the group can be supplied a value.
N)superr   )r   	__class__s    r   r   MutuallyExclusive.__init__J   s    
 	r   r4   )r-   r.   r/   r0   r   r3   __classcell__)r:   s   @r   r6   r6   I   s     r   r6   T)r
   N)typingr   cyclopts.argumentr   r   r6   mutually_exclusiveall_or_noner4   r   r   <module>rB      s<     4? ?D  '( B40r   