
    h                    `   S SK Jr  S SKJr  S SKrS SKrS SKrS SKrS SK	r
S SKJr  S SKJr  S SKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  \
R0                  (       a  S SKrSSKJr  SSKJr  SSKJr  \
R@                  " S5      r! " S S5      r" " S S\"5      r# " S S\"5      r$ " S S\"5      r% " S S\"5      r& " S S\"\
RN                  \!   5      r( " S S\"5      r) " S S \"5      r* " S! S"\*5      r+ " S# S$\*5      r, " S% S&\+\,5      r- " S' S(\*5      r. " S) S*\+\.5      r/ " S+ S,\"5      r0 " S- S.\"5      r1 " S/ S0\"5      r2S;S1 jr3 " S2 S3\"5      r4 " S4 S5\#5      r5S<S=S6 jjr6\%" 5       r7\&" 5       r8\," 5       r9\." 5       r:\0" 5       r;\1" 5       r< " S7 S8\
Rz                  S9S:9r>g)>    )annotationsN)datetime)gettext)ngettext   )_get_argv_encoding)open_streamBadParameter)format_filename)LazyFile)safecall)Context)	ParameterCompletionItemParamTypeValuec                      \ rS rSr% SrSrS\S'   SrS\S'   S	\S
'   SrS\S'   SS jr	  S       SS jjr
SS jrSS jr        SS jrSS jr  S       SS jjr        SS jrSrg)	ParamType   a  Represents the type of a parameter. Validates and converts values
from the command line or Python into the correct type.

To implement a custom type, subclass and implement at least the
following:

-   The :attr:`name` class attribute must be set.
-   Calling an instance of the type with ``None`` must return
    ``None``. This is already implemented by default.
-   :meth:`convert` must convert string values to the correct type.
-   :meth:`convert` must accept values that are already the correct
    type.
-   It must be able to convert a value if the ``ctx`` and ``param``
    arguments are ``None``. This can occur when converting prompt
    input.
Fzt.ClassVar[bool]is_compositer   zt.ClassVar[int]aritystrnameNzt.ClassVar[str | None]envvar_list_splitterc                    [        U 5      R                  R                  S5      S   nUR                  S5      S   n[        U S5      (       a  U R                  nOUnXS.$ )zGather information that could be useful for a tool generating
user-facing documentation.

Use :meth:`click.Context.to_info_dict` to traverse the entire
CLI structure.

.. versionadded:: 8.0
r   r   ParameterTyper   )
param_typer   )type__name__	partitionhasattrr   )selfr   r   s      `C:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\click/types.pyto_info_dictParamType.to_info_dict>   s^     $Z((22;?B
))/:1=
 4  99DD(77    c                .    Ub  U R                  XU5      $ g N)convertr#   valueparamctxs       r$   __call__ParamType.__call__S   s      <<c22 r'   c                    g)z>Returns the metavar default for this param if it provides one.N r#   r-   r.   s      r$   get_metavarParamType.get_metavar\       r'   c                    g)z\Optionally might return extra information about a missing
parameter.

.. versionadded:: 2.0
Nr2   r3   s      r$   get_missing_messageParamType.get_missing_message_   r6   r'   c                    U$ )a  Convert the value to the correct type. This is not called if
the value is ``None`` (the missing value).

This must accept string values from the command line, as well as
values that are already the correct type. It may also convert
other compatible types.

The ``param`` and ``ctx`` arguments may be ``None`` in certain
situations, such as when converting prompt input.

If the value cannot be converted, call :meth:`fail` with a
descriptive message.

:param value: The value to convert.
:param param: The parameter that is using this type to convert
    its value. May be ``None``.
:param ctx: The current context that arrived at this value. May
    be ``None``.
r2   r+   s       r$   r*   ParamType.convertf   s	    , r'   c                J    U=(       d    SR                  U R                  5      $ )aM  Given a value from an environment variable this splits it up
into small chunks depending on the defined envvar list splitter.

If the splitter is set to `None`, which means that whitespace splits,
then leading and trailing whitespace is ignored.  Otherwise, leading
and trailing splitters usually lead to empty items being included.
 )splitr   )r#   rvs     r$   split_envvar_valueParamType.split_envvar_value~   s     b 9 9::r'   c                    [        XUS9e)z4Helper method to fail with an invalid value message.)r.   r-   r
   )r#   messager-   r.   s       r$   failParamType.fail   s     7599r'   c                    / $ )a  Return a list of
:class:`~click.shell_completion.CompletionItem` objects for the
incomplete value. Most types do not provide completions, but
some do, and this allows custom types to provide custom
completions as well.

:param ctx: Invocation context for this command.
:param param: The parameter that is requesting completion.
:param incomplete: Value being completed. May be empty.

.. versionadded:: 8.0
r2   )r#   r.   r-   
incompletes       r$   shell_completeParamType.shell_complete   s	     	r'   r2   returnzdict[str, t.Any])NNr,   t.Anyr-   Parameter | Noner.   Context | NonerK   rM   r-   r   r.   r   rK   
str | None)r-   r   r.   rO   rK   rQ   )r?   r   rK   zcabc.Sequence[str])rC   r   r-   rN   r.   rO   rK   z
t.NoReturnr.   r   r-   r   rG   r   rK   zlist[CompletionItem])r    
__module____qualname____firstlineno____doc__r   __annotations__r   r   r%   r/   r4   r8   r*   r@   rD   rH   __static_attributes__r2   r'   r$   r   r      s    " &+L"*E? I 480780 #'"	33  3 	3
 
3M#3:H	0; #'"	::  : 	:
 
:#,:=	r'   r   c                  ,    \ rS rSrSr\SS j5       rSrg)CompositeParamType   Tc                    [        5       er)   NotImplementedErrorr#   s    r$   r   CompositeParamType.arity   s    !##r'   r2   NrK   int)r    rS   rT   rU   r   propertyr   rX   r2   r'   r$   rZ   rZ      s    L$ $r'   rZ   c                  P   ^  \ rS rSrSS jrSU 4S jjr        SS jrSrU =r$ )	FuncParamType   c                2    UR                   U l        Xl        g r)   )r    r   func)r#   rh   s     r$   __init__FuncParamType.__init__   s    		r'   c                B   > [         TU ]  5       nU R                  US'   U$ )Nrh   )superr%   rh   r#   	info_dict	__class__s     r$   r%   FuncParamType.to_info_dict   s$    G(*	 II	&r'   c                     U R                  U5      $ ! [         aD     [        U5      nO"! [         a    UR	                  SS5      n Of = fU R                  XU5         g f = fNzutf-8replace)rh   
ValueErrorr   UnicodeErrordecoderD   r+   s       r$   r*   FuncParamType.convert   sb    	)99U## 	)9E
 9Wi89 IIeC(	)s/    
A!*A!A	A!A		A! A!)rh   r   )rh   zt.Callable[[t.Any], t.Any]rK   NonerJ   rL   )	r    rS   rT   rU   ri   r%   r*   rX   __classcell__ro   s   @r$   re   re      s7    
))#3):H)	) )r'   re   c                  <    \ rS rSrSr        SS jrSS jrSrg)	UnprocessedParamType   textc                    U$ r)   r2   r+   s       r$   r*   UnprocessedParamType.convert   s	     r'   c                    g)NUNPROCESSEDr2   r_   s    r$   __repr__UnprocessedParamType.__repr__   s    r'   r2   NrL   rK   r   r    rS   rT   rU   r   r*   r   rX   r2   r'   r$   r|   r|      s1    D#3:H	
r'   r|   c                  <    \ rS rSrSr        SS jrSS jrSrg)	StringParamType   r~   c                b   [        U[        5      (       a  [        5       n UR                  U5      nU$ [        U5      $ ! [         ae    [
        R                  " 5       nXT:w  a5   UR                  U5      nO4! [         a    UR                  SS5      n Of = fUR                  SS5      n U$ f = frr   )
isinstancebytesr   rv   ru   sysgetfilesystemencodingr   )r#   r,   r-   r.   encfs_encs         r$   r*   StringParamType.convert   s     eU##$&C
=S) L5z   =224=A %V 4' A %Wi @A "LL)<EL=s3   ? $B.$A65B.6BB.BB.-B.c                    g)NSTRINGr2   r_   s    r$   r   StringParamType.__repr__   s    r'   r2   NrL   r   r   r2   r'   r$   r   r      s1    D#3:H	&r'   r   c                     ^  \ rS rSrSrSr S     SS jjrSU 4S jjr S   SS jjrSS jr	SS jr
SS	 jr        SS
 jrSS jrSS jr        SS jrSrU =r$ )Choice   a  The choice type allows a value to be checked against a fixed set
of supported values.

You may pass any iterable value which will be converted to a tuple
and thus will only be iterated once.

The resulting value will always be one of the originally passed choices.
See :meth:`normalize_choice` for more info on the mapping of strings
to choices. See :ref:`choice-opts` for an example.

:param case_sensitive: Set to false to make choices case
    insensitive. Defaults to true.

.. versionchanged:: 8.2.0
    Non-``str`` ``choices`` are now supported. It can additionally be any
    iterable. Before you were not recommended to pass anything but a list or
    tuple.

.. versionadded:: 8.2.0
    Choice normalization can be overridden via :meth:`normalize_choice`.
choicec                0    [        U5      U l        X l        g r)   )tuplechoicescase_sensitive)r#   r   r   s      r$   ri   Choice.__init__  s     7<Gn,r'   c                `   > [         TU ]  5       nU R                  US'   U R                  US'   U$ )Nr   r   )rl   r%   r   r   rm   s     r$   r%   Choice.to_info_dict  s5    G(*	#||	)&*&9&9	"#r'   c           	     b    U R                    Vs0 s H  nX R                  UUS9_M     sn$ s  snf )z
Returns mapping where keys are the original choices and the values are
the normalized values that are accepted via the command line.

This is a simple wrapper around :meth:`normalize_choice`, use that
instead which is supported.
r   r.   )r   normalize_choice)r#   r.   r   s      r$   _normalized_mappingChoice._normalized_mapping  sL     ,,

 '	 )) *   '
 	
 
s   ,c                    [        U[        R                  5      (       a  UR                  O
[	        U5      nUb  UR
                  b  UR                  U5      nU R                  (       d  UR                  5       nU$ )a  
Normalize a choice value, used to map a passed string to a choice.
Each choice must have a unique normalized value.

By default uses :meth:`Context.token_normalize_func` and if not case
sensitive, convert it to a casefolded value.

.. versionadded:: 8.2.0
)r   enumEnumr   r   token_normalize_funcr   casefold)r#   r   r.   normed_values       r$   r   Choice.normalize_choice   s`     '1&C&Cv{{V?s77C33LAL""'002Lr'   c                   UR                   S:X  a~  UR                  (       dm  U R                   Vs/ s H/  n[        [	        U5      5      R
                  R                  5       PM1     nnSR                  / [        R                  U5      Q5      nOFSR                  U R                  US9R                  5        Vs/ s H  n[        U5      PM     sn5      nUR                  (       a  UR                   S:X  a  SU S3$ SU S3$ s  snf s  snf )	Noption|r.   argument{}[])param_type_nameshow_choicesr   convert_typer   r   upperjoindictfromkeysr   valuesr   required)r#   r-   r.   r   choice_metavarschoices_stris          r$   r4   Choice.get_metavar4  s      H,U5G5GFJllFRFT&\*//557l   ((#DT]]?%C#DEK((!%!9!9c!9!B!I!I!KL!KAQ!KLK
 >>e33zA}B'' ;-q!! Ms   6D9Dc                    [        S5      R                  SR                  U R                  US9R	                  5       5      S9$ )z\
Message shown when no choice is passed.

.. versionchanged:: 8.2.0 Added ``ctx`` argument.
zChoose from:
	{choices}z,
	r   )r   )_formatr   r   r   r3   s      r$   r8   Choice.get_missing_messageF  sE     ,-44LL!9!9c!9!B!I!I!KL 5 
 	
r'   c                   ^ U R                  XS9mU R                  US9n [        U4S jUR                  5        5       5      $ ! [         a!    U R                  U R                  XS9UUS9   gf = f)z
For a given value from the parser, normalize it and find its
matching normalized value in the list of choices. Then return the
matched "original" choice.
r   r   c              3  <   >#    U  H  u  pUT:X  d  M  Uv   M     g 7fr)   r2   ).0original
normalizedr   s      r$   	<genexpr>!Choice.convert.<locals>.<genexpr>\  s%      ,F(H- ,Fs   	)r,   r.   r-   r.   N)r   r   nextitemsStopIterationrD   get_invalid_choice_message)r#   r,   r-   r.   normalized_mappingr   s        @r$   r*   Choice.convertP  s     ,,E,C!55#5>	 ,>,D,D,F  
  	II//e/E  	s   "A (A/.A/c           	         SR                  [        [        U R                  US9R	                  5       5      5      n[        SS[        U R                  5      5      R                  XUS9$ )zqGet the error message when the given choice is invalid.

:param value: The invalid value.

.. versionadded:: 8.2
, r   z{value!r} is not {choice}.z"{value!r} is not one of {choices}.)r,   r   r   )	r   mapreprr   r   r   lenr   r   )r#   r,   r.   r   s       r$   r   !Choice.get_invalid_choice_messageh  s`     iiD$*B*Bs*B*K*R*R*T UV(0
 &u+&
F		Gr'   c                4    S[        U R                  5       S3$ )NzChoice())listr   r_   s    r$   r   Choice.__repr__v  s    dll+,A..r'   c                   ^ SSK Jn  [        [        U R                  5      nU R
                  (       a  U4S jU 5       nOTR                  5       mU4S jU 5       nU Vs/ s H
  ot" U5      PM     sn$ s  snf )zComplete choices that start with the incomplete value.

:param ctx: Invocation context for this command.
:param param: The parameter that is requesting completion.
:param incomplete: Value being completed. May be empty.

.. versionadded:: 8.0
r   r   c              3  V   >#    U  H  oR                  T5      (       d  M  Uv   M      g 7fr)   )
startswithr   crG   s     r$   r   (Choice.shell_complete.<locals>.<genexpr>  s     J+Qj1Iqq+s   )	)c              3  r   >#    U  H,  oR                  5       R                  T5      (       d  M(  Uv   M.     g 7fr)   )lowerr   r   s     r$   r   r     s$     R+Q1E1Ej1Qqq+s   '7	7)click.shell_completionr   r   r   r   r   r   )r#   r.   r-   rG   r   str_choicesmatchedr   s      `    r$   rH   Choice.shell_completey  s`     	:#t||,J+JG#))+JR+RG+237aq!7333s    A4)r   r   )T)r   zcabc.Iterable[ParamTypeValue]r   boolrK   rx   rJ   r)   )r.   rO   rK   z!cabc.Mapping[ParamTypeValue, str])r   r   r.   rO   rK   r   rP   )r-   r   r.   rO   rK   r   )r,   rM   r-   rN   r.   rO   rK   r   )r,   rM   r.   rO   rK   r   r   rR   )r    rS   rT   rU   rV   r   ri   r%   r   r   r4   r8   r*   r   r   rH   rX   ry   rz   s   @r$   r   r      s    , D NR-4-FJ-	- %)
!
	*
$("$
#3:H	0G/44#,4:=4	4 4r'   r   c                  z   ^  \ rS rSrSrSrSSS jjrSU 4S jjrSS jrSS jr	        SS jr
SS	 jrS
rU =r$ )DateTimei  a  The DateTime type converts date strings into `datetime` objects.

The format strings which are checked are configurable, but default to some
common (non-timezone aware) ISO 8601 formats.

When specifying *DateTime* formats, you should only pass a list or a tuple.
Other iterables, like generators, may lead to surprising results.

The format strings are processed using ``datetime.strptime``, and this
consequently defines the format strings which are allowed.

Parsing is tried using each format, in order, and the first format which
parses successfully is used.

:param formats: A list or tuple of date format strings, in the order in
                which they should be tried. Defaults to
                ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``,
                ``'%Y-%m-%d %H:%M:%S'``.
r   c                (    U=(       d    / SQU l         g )N)z%Y-%m-%dz%Y-%m-%dT%H:%M:%Sz%Y-%m-%d %H:%M:%Sformats)r#   r   s     r$   ri   DateTime.__init__  s    +2 ,
 7
r'   c                B   > [         TU ]  5       nU R                  US'   U$ )Nr   )rl   r%   r   rm   s     r$   r%   DateTime.to_info_dict  s$    G(*	#||	)r'   c                @    SSR                  U R                  5       S3$ )Nr   r   r   )r   r   r3   s      r$   r4   DateTime.get_metavar  s    388DLL)*!,,r'   c                P     [         R                  " X5      $ ! [         a     g f = fr)   )r   strptimert   )r#   r,   r   s      r$   _try_to_convert_dateDateTime._try_to_convert_date  s*    	$$U33 		s    
%%c           	     X   [        U[        5      (       a  U$ U R                   H  nU R                  X5      nUc  M  Us  $    SR	                  [        [        U R                  5      5      nU R                  [        SS[        U R                  5      5      R                  XUS9UU5        g )Nr   z-{value!r} does not match the format {format}.z/{value!r} does not match the formats {formats}.)r,   r   r   )r   r   r   r   r   r   r   rD   r   r   r   )r#   r,   r-   r.   r   	convertedformats_strs          r$   r*   DateTime.convert  s     eX&&LllF11%@I$  	 # iiD$,, 78		?ADLL! f5kfJ	
r'   c                    g)Nr   r2   r_   s    r$   r   DateTime.__repr__  s    r'   r   r)   )r   zcabc.Sequence[str] | NonerJ   rP   )r,   rM   r   r   rK   zdatetime | NonerL   r   )r    rS   rT   rU   rV   r   ri   r%   r4   r   r*   r   rX   ry   rz   s   @r$   r   r     sR    ( D

-

#3
:H
	
. r'   r   c                  :    \ rS rSr% S\S'           SS jrSrg)_NumberParamTypeBasei  zt.ClassVar[type[t.Any]]_number_classc                     U R                  U5      $ ! [         a6    U R                  [        S5      R	                  XR
                  S9UU5         g f = f)Nz'{value!r} is not a valid {number_type}.)r,   number_type)r  rt   rD   r   r   r   r+   s       r$   r*   _NumberParamTypeBase.convert  s\    		%%e,, 	II;<CCYY D  	s    =AAr2   NrL   )r    rS   rT   rU   rW   r*   rX   r2   r'   r$   r   r     s-    **#3:H	r'   r   c                     ^  \ rS rSr     S	           S
S jjrSU 4S jjr        SU 4S jjrSS jrSS jrSS jr	Sr
U =r$ )_NumberRangeBasei  c                @    Xl         X l        X0l        X@l        XPl        g r)   minmaxmin_openmax_openclamp)r#   r	  r
  r  r  r  s         r$   ri   _NumberRangeBase.__init__  s       
r'   c                   > [         TU ]  5       nUR                  U R                  U R                  U R
                  U R                  U R                  S9  U$ )Nr  )rl   r%   updater	  r
  r  r  r  rm   s     r$   r%   _NumberRangeBase.to_info_dict  sN    G(*	]]]]** 	 	
 r'   c                  > SS K n[        TU ]	  XU5      nU R                  S L=(       a9    U R                  (       a  UR
                  OUR                  " XPR                  5      nU R                  S L=(       a9    U R                  (       a  UR                  OUR                  " XPR                  5      nU R                  (       a\  U(       a'  U R                  U R                  SU R                  5      $ U(       a'  U R                  U R                  SU R                  5      $ U(       d  U(       a7  U R                  [        S5      R                  XPR!                  5       S9UU5        U$ )Nr   r   z${value} is not in the range {range}.)r,   range)operatorrl   r*   r	  r  leltr
  r  gegtr  _clamprD   r   r   _describe_range)	r#   r,   r-   r.   r  r?   lt_mingt_maxro   s	           r$   r*   _NumberRangeBase.convert  s    	W_U3/xxt+ ==HKKhkk9
hh1 xxt+ ==HKKhkk9
hh1 ::{{488Q>>{{488R??VII89@@$8$8$: A   	r'   c                    [         e)zFind the valid value to clamp to bound in the given
direction.

:param bound: The boundary value.
:param dir: 1 or -1 indicating the direction to move.
:param open: If true, the range does not include the bound.
r]   r#   bounddiropens       r$   r  _NumberRangeBase._clamp#  s
     "!r'   c                `   U R                   c&  U R                  (       a  SOSnSU U R                   3$ U R                  c&  U R                  (       a  SOSnSU U R                    3$ U R                  (       a  SOSnU R                  (       a  SOSnU R                    U SU U R                   3$ )z(Describe the range for use in help text.<z<=x>z>=)r	  r  r
  r  )r#   oploprops       r$   r   _NumberRangeBase._describe_range-  s    884Brd488*%%884Brd488*%%]]c]]c((C5#txxj11r'   c                    U R                   (       a  SOSnS[        U 5      R                   SU R                  5        U S3$ )Nz clampedr=   r&   r(  )r  r   r    r  )r#   r  s     r$   r   _NumberRangeBase.__repr__;  s=    "jj
b4:&&'q)=)=)?(@qIIr'   )r  r
  r  r	  r  NNFFFr	  float | Noner
  r2  r  r   r  r   r  r   rK   rx   rJ   rL   r!  floatr"  t.Literal[1, -1]r#  r   rK   r4  r   )r    rS   rT   rU   ri   r%   r*   r  r  r   rX   ry   rz   s   @r$   r  r    s     !   	
   
	#3:H	>"2J Jr'   r  c                  &    \ rS rSrSr\rSS jrSrg)IntParamTypei@  integerc                    g)NINTr2   r_   s    r$   r   IntParamType.__repr__D  s    r'   r2   Nr   )	r    rS   rT   rU   r   rb   r  r   rX   r2   r'   r$   r7  r7  @  s    DMr'   r7  c                  6    \ rS rSrSrSr        SS jrSrg)IntRangeiH  a  Restrict an :data:`click.INT` value to a range of accepted
values. See :ref:`ranges`.

If ``min`` or ``max`` are not passed, any value is accepted in that
direction. If ``min_open`` or ``max_open`` are enabled, the
corresponding boundary is not included in the range.

If ``clamp`` is enabled, a value outside the range is clamped to the
boundary instead of failing.

.. versionchanged:: 8.0
    Added the ``min_open`` and ``max_open`` parameters.
zinteger rangec                    U(       d  U$ X-   $ r)   r2   r   s       r$   r  IntRange._clampY  s     L{r'   r2   N)r!  rb   r"  r5  r#  r   rK   rb   )r    rS   rT   rU   rV   r   r  rX   r2   r'   r$   r=  r=  H  s3     D/7;	r'   r=  c                  &    \ rS rSrSr\rSS jrSrg)FloatParamTypeib  r4  c                    g)NFLOATr2   r_   s    r$   r   FloatParamType.__repr__f  s    r'   r2   Nr   )	r    rS   rT   rU   r   r4  r  r   rX   r2   r'   r$   rA  rA  b  s    DMr'   rA  c                  b   ^  \ rS rSrSrSr     S           SU 4S jjjrS	S jrSrU =r	$ )

FloatRangeij  a  Restrict a :data:`click.FLOAT` value to a range of accepted
values. See :ref:`ranges`.

If ``min`` or ``max`` are not passed, any value is accepted in that
direction. If ``min_open`` or ``max_open`` are enabled, the
corresponding boundary is not included in the range.

If ``clamp`` is enabled, a value outside the range is clamped to the
boundary instead of failing. This is not supported if either
boundary is marked ``open``.

.. versionchanged:: 8.0
    Added the ``min_open`` and ``max_open`` parameters.
zfloat rangec                f   > [         TU ]  XX4US9  U(       d  U(       a  U(       a  [        S5      eg g )Nr  *Clamping is not supported for open bounds.)rl   ri   	TypeError)r#   r	  r
  r  r  r  ro   s         r$   ri   FloatRange.__init__|  s:     	x% 	 	
 eHII ',r'   c                *    U(       d  U$ [        S5      e)NrH  )RuntimeErrorr   s       r$   r  FloatRange._clamp  s    L
 GHHr'   r2   r0  r1  r3  )
r    rS   rT   rU   rV   r   ri   r  rX   ry   rz   s   @r$   rF  rF  j  sx     D ! JJ J 	J
 J J 
J JI Ir'   rF  c                  ~    \ rS rSr% SrSSSSSSSSSSSSSS.rS\S'    \SS j5       r        SS	 jr	SS
 jr
Srg)BoolParamTypei  booleanTF)10yesnotruefalseonofftfynr=   zdict[str, bool]bool_statesc                    [        U [        5      (       a  U $ [        R                  R	                  U R                  5       R                  5       5      $ )aY  Convert a string to a boolean value.

If the value is already a boolean, it is returned as-is. If the value is a
string, it is stripped of whitespaces and lower-cased, then checked against
the known boolean states pre-defined in the `BoolParamType.bool_states` mapping
above.

Returns `None` if the value does not match any known boolean state.
)r   r   rO  r]  getstripr   r,   s    r$   str_to_boolBoolParamType.str_to_bool  s<     eT""L((,,U[[]-@-@-BCCr'   c           
         U R                  U5      nUcL  U R                  [        S5      R                  USR	                  [        U R                  5      5      S9UU5        U$ )Nz={value!r} is not a valid boolean. Recognized values: {states}r   )r,   states)rb  rD   r   r   r   sortedr]  )r#   r,   r-   r.   r   s        r$   r*   BoolParamType.convert  sa     %%e,
IIS&uTYYvd>N>N7O-P&Q r'   c                    g)NBOOLr2   r_   s    r$   r   BoolParamType.__repr__      r'   r2   N)r,   z
str | boolrK   bool | None)r,   rM   r-   rN   r.   rO   rK   r   r   )r    rS   rT   rU   r   r]  rW   staticmethodrb  r*   r   rX   r2   r'   r$   rO  rO    s    D $K  " D D#3:H	r'   rO  c                  <    \ rS rSrSr        SS jrSS jrSrg)	UUIDParameterTypei  uuidc                    SS K n[        XR                  5      (       a  U$ UR                  5       n UR                  U5      $ ! [         a+    U R                  [        S5      R                  US9X#5         g f = f)Nr   z{value!r} is not a valid UUID.ra  )rp  r   UUIDr`  rt   rD   r   r   )r#   r,   r-   r.   rp  s        r$   r*   UUIDParameterType.convert  sn     	eYY''L	99U## 	II23:::G	s   A 2A87A8c                    g)Nrr  r2   r_   s    r$   r   UUIDParameterType.__repr__  rk  r'   r2   NrL   r   r   r2   r'   r$   ro  ro    s1    D#3:H	"r'   ro  c                     ^  \ rS rSr% SrSr\R                  R                  r	S\
S'        S           SS jjrSU 4S jjrSS jr        SS	 jr        SS
 jrSrU =r$ )Filei  a  Declares a parameter to be a file for reading or writing.  The file
is automatically closed once the context tears down (after the command
finished working).

Files can be opened for reading or writing.  The special value ``-``
indicates stdin or stdout depending on the mode.

By default, the file is opened for reading text data, but it can also be
opened in binary mode or for writing.  The encoding parameter can be used
to force a specific encoding.

The `lazy` flag controls if the file should be opened immediately or upon
first IO. The default is to be non-lazy for standard input and output
streams as well as files opened for reading, `lazy` otherwise. When opening a
file lazily for reading, it is still opened temporarily for validation, but
will not be held open until first IO. lazy is mainly useful when opening
for writing to avoid creating the file until it is needed.

Files can also be opened atomically in which case all writes go into a
separate file in the same folder and upon completion the file will
be moved over to the original location.  This is useful if a file
regularly read by other users is modified.

See :ref:`file-args` for more information.

.. versionchanged:: 2.0
    Added the ``atomic`` parameter.
filenamet.ClassVar[str]r   c                @    Xl         X l        X0l        X@l        XPl        g r)   )modeencodingerrorslazyatomic)r#   r{  r|  r}  r~  r  s         r$   ri   File.__init__  s     	 	r'   c                l   > [         TU ]  5       nUR                  U R                  U R                  S9  U$ )N)r{  r|  )rl   r%   r  r{  r|  rm   s     r$   r%   File.to_info_dict!  s1    G(*	dii$--@r'   c                    U R                   b  U R                   $ [        R                  " U5      S:X  a  gSU R                  ;   a  gg)N-FwT)r~  osfspathr{  r#   r,   s     r$   resolve_lazy_flagFile.resolve_lazy_flag&  s<    99 9999Us"DIIr'   c                   [        U5      (       a  U$ [        R                  " SU5      n U R                  U5      nU(       ai  [	        XR
                  U R                  U R                  U R                  S9nUb  UR                  UR                  5        [        R                  " SU5      $ [        XR
                  U R                  U R                  U R                  S9u  pgUbQ  U(       a&  UR                  [        UR                  5      5        U$ UR                  [        UR                  5      5        U$ ! [         a5  nU R!                  S[#        U5       SUR$                   3X#5         S nAg S nAff = f)Nstr | os.PathLike[str])r  t.IO[t.Any]'z': )_is_file_likerY  castr  r   r{  r|  r}  r  call_on_closeclose_intelligentlyr	   r   closeflushOSErrorrD   r   strerror)	r#   r,   r-   r.   r~  lfrZ  should_closees	            r$   r*   File.convert/  s2    L/7	O))%0D99dmmT[[ ?%%b&<&<=vvmR00)yy$--T[[OA %%hqww&78 H %%hqww&78H 	OII/%01QZZLA5NN	Os%   B D8 ,A%D8 %D8 8
E7+E22E7c                    SSK Jn  U" USS9/$ )a3  Return a special completion marker that tells the completion
system to use the shell to provide file path completions.

:param ctx: Invocation context for this command.
:param param: The parameter that is requesting completion.
:param incomplete: Value being completed. May be empty.

.. versionadded:: 8.0
r   r   filer   )r   r   )r#   r.   r-   rG   r   s        r$   rH   File.shell_completeZ  s     	:z788r'   )r  r|  r}  r~  r{  )rNstrictNF)r{  r   r|  rQ   r}  rQ   r~  rl  r  r   rK   rx   rJ   )r,   r  rK   r   )r,   z$str | os.PathLike[str] | t.IO[t.Any]r-   rN   r.   rO   rK   r  rR   )r    rS   rT   rU   rV   r   r  pathpathsepr   rW   ri   r%   r  r*   rH   rX   ry   rz   s   @r$   rw  rw    s    : D,.GGOO/; #%   	
   

)O3)O  )O 	)O
 
)OV99#,9:=9	9 9r'   rw  c                @    [        U S5      =(       d    [        U S5      $ )Nreadwrite)r"   ra  s    r$   r  r  k  s    5&!<WUG%<<r'   c                     ^  \ rS rSr% Sr\R                  R                  rS\	S'            S                 SS jjr
SU 4S jjr    SS jr        SS jr        SS	 jrS
rU =r$ )Pathio  a@  The ``Path`` type is similar to the :class:`File` type, but
returns the filename instead of an open file. Various checks can be
enabled to validate the type of file and permissions.

:param exists: The file or directory needs to exist for the value to
    be valid. If this is not set to ``True``, and the file does not
    exist, then all further checks are silently skipped.
:param file_okay: Allow a file as a value.
:param dir_okay: Allow a directory as a value.
:param readable: if true, a readable check is performed.
:param writable: if true, a writable check is performed.
:param executable: if true, an executable check is performed.
:param resolve_path: Make the value absolute and resolve any
    symlinks. A ``~`` is not expanded, as this is supposed to be
    done by the shell only.
:param allow_dash: Allow a single dash as a value, which indicates
    a standard stream (but does not open it). Use
    :func:`~click.open_file` to handle opening this value.
:param path_type: Convert the incoming path value to this type. If
    ``None``, keep Python's default, which is ``str``. Useful to
    convert to :class:`pathlib.Path`.

.. versionchanged:: 8.1
    Added the ``executable`` parameter.

.. versionchanged:: 8.0
    Allow passing ``path_type=pathlib.Path``.

.. versionchanged:: 6.0
    Added the ``allow_dash`` parameter.
ry  r   c
                \   Xl         X l        X0l        XPl        X@l        Xl        X`l        Xpl        Xl        U R                  (       a"  U R                  (       d  [        S5      U l
        g U R                  (       a"  U R                  (       d  [        S5      U l
        g [        S5      U l
        g )Nr  	directoryr  )exists	file_okaydir_okayreadablewritable
executableresolve_path
allow_dashr   r   r   )
r#   r  r  r  r  r  r  r  	path_typer  s
             r$   ri   Path.__init__  sm     "   $($	>>$--vYDI]]4>>+DI&	DIr'   c           	        > [         TU ]  5       nUR                  U R                  U R                  U R
                  U R                  U R                  U R                  S9  U$ )N)r  r  r  r  r  r  )	rl   r%   r  r  r  r  r  r  r  rm   s     r$   r%   Path.to_info_dict  sU    G(*	;;nn]]]]]] 	 	
 r'   c                D   U R                   b  [        XR                   5      (       dx  U R                   [        L a  [        R                  " U5      $ U R                   [
        L a  [        R                  " U5      $ [        R                  " SU R                  U5      5      $ U$ )Nzos.PathLike[str])	r   r   r   r  fsdecoder   fsencoderY  r  r  s     r$   coerce_path_resultPath.coerce_path_result  sr     99 E99)E)EyyC{{5))e#{{5))vv0$))E2BCCr'   c           	     D   UnU R                   =(       a    U R                  =(       a    US;   nU(       Gd  U R                  (       a  [        R                  R                  U5      n [        R                  " U5      nU R                   (       dp  [        R                   " WR"                  5      (       aK  U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5        U R$                  (       dp  [        R&                  " WR"                  5      (       aK  U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5        U R(                  (       au  [        R*                  " U[        R,                  5      (       dK  U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5        U R.                  (       au  [        R*                  " U[        R0                  5      (       dK  U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5        U R2                  (       au  [        R*                  " U[        R4                  5      (       dK  U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5        U R                  U5      $ ! [         as    U R                  (       d  U R                  U5      s $ U R                  [        S5      R                  U R                  R                  5       [        U5      S9UU5         GN!f = f)	N)   -r  z#{name} {filename!r} does not exist.)r   rx  z{name} {filename!r} is a file.z#{name} {filename!r} is a directory.z${name} {filename!r} is not readable.z${name} {filename!r} is not writable.z&{name} {filename!r} is not executable.)r  r  r  r  r  realpathstatr  r  r  rD   r   r   r   titler   S_ISREGst_moder  S_ISDIRr  accessR_OKr  W_OKr  X_OK)r#   r,   r-   r.   r?   is_dashsts          r$   r*   Path.convert  s    ..JT__J{9J  WW%%b)WWR[ >>dll2::&>&>		67>>!YY__.9O ?   ==T\\"**%=%=		;<CC!YY__.9O D   }}RYYr277%;%;		<=DD!YY__.9O E   }}RYYr277%;%;		<=DD!YY__.9O E   ryy'@'@		>?FF!YY__.9O G   &&r**o  	{{22266		;<CC!YY__.9O D  	s   'L" ",NANNc                h    SSK Jn  U R                  (       a  U R                  (       d  SOSnU" X5S9/$ )aP  Return a special completion marker that tells the completion
system to use the shell to provide path completions for only
directories or any paths.

:param ctx: Invocation context for this command.
:param param: The parameter that is requesting completion.
:param incomplete: Value being completed. May be empty.

.. versionadded:: 8.0
r   r   r"  r  r  )r   r   r  r  )r#   r.   r-   rG   r   r   s         r$   rH   Path.shell_complete  s(     	:dnnu&z566r'   )
r  r  r  r  r  r   r  r  r   r  )	FTTFTFFNF)r  r   r  r   r  r   r  r   r  r   r  r   r  r   r  ztype[t.Any] | Noner  r   rJ   )r,   r  rK   str | bytes | os.PathLike[str])r,   r  r-   rN   r.   rO   rK   r  rR   )r    rS   rT   rU   rV   r  r  r  r   rW   ri   r%   r  r*   rH   rX   ry   rz   s   @r$   r  r  o  s   @ -/GGOO/; " (, "" " 	"
 " " " " &" ":
+	'G+%G+  G+ 	G+
 
(G+R77#,7:=7	7 7r'   r  c                  |   ^  \ rS rSrSrS	S jrS
U 4S jjr\SS j5       r\SS j5       r	        SS jr
SrU =r$ )Tuplei$  a  The default behavior of Click is to apply a type on a value directly.
This works well in most cases, except for when `nargs` is set to a fixed
count and different types should be used for different items.  In this
case the :class:`Tuple` type can be used.  This type can only be used
if `nargs` is set to a fixed number.

For more information see :ref:`tuple-type`.

This can be selected by using a Python tuple literal as a type.

:param types: a list of types that should be used for the tuple items.
c                P    U Vs/ s H  n[        U5      PM     snU l        g s  snf r)   )r   types)r#   r  tys      r$   ri   Tuple.__init__2  s     KP/Q5RR0@5/Q
/Qs   #c                   > [         TU ]  5       nU R                   Vs/ s H  o"R                  " 5       PM     snUS'   U$ s  snf )Nr  )rl   r%   r  )r#   rn   rY  ro   s      r$   r%   Tuple.to_info_dict5  s>    G(*	8<

C
1nn.
C	' Ds   A c                N    SSR                  S U R                   5       5       S3$ )Nr&  r.  c              3  8   #    U  H  oR                   v   M     g 7fr)   )r   )r   r  s     r$   r   Tuple.name.<locals>.<genexpr><  s     9jGGjs   r(  )r   r  r_   s    r$   r   
Tuple.name:  s%    3889djj99:!<<r'   c                ,    [        U R                  5      $ r)   )r   r  r_   s    r$   r   Tuple.arity>  s    4::r'   c           	        ^^ [        U R                  5      n[        U5      nXT:w  a)  U R                  [        SSU5      R	                  XES9TTS9  [        UU4S j[        U R                  USS9 5       5      $ )Nz:{len_type} values are required, but {len_value} was given.z;{len_type} values are required, but {len_value} were given.)len_type	len_valuer   c              3  <   >#    U  H  u  pU" UTT5      v   M     g 7fr)   r2   )r   r  r'  r.   r-   s      r$   r    Tuple.convert.<locals>.<genexpr>S  s#      
+O%"Bq%+Os   F)r  )r   r  rD   r   r   r   zip)r#   r,   r-   r.   r  r  s     ``  r$   r*   Tuple.convertB  s     tzz?J	 IIPQ &(&@    
+.tzz5+O
 
 	
r'   )r  )r  z&cabc.Sequence[type[t.Any] | ParamType]rK   rx   rJ   r   ra   rL   )r    rS   rT   rU   rV   ri   r%   rc   r   r   r*   rX   ry   rz   s   @r$   r  r  $  se    R
 = =  

#3
:H
	
 
r'   r  c                   SnU cx  Ubu  [        U[        [        45      (       aM  U(       aE  US   n[        U[        [        45      (       a  [        [        [        U5      5      n O[	        U5      n O[	        U5      n Sn[        U [        5      (       a  [        U 5      $ [        U [        5      (       a  U $ U [        L d  U c  [        $ U [        L a  [        $ U [        L a  [        $ U [        L a  [        $ U(       a  [        $   [        U [        5      (       a  [!        SU  S35      e [%        U 5      $ ! ["         a     Nf = f)zFind the most appropriate :class:`ParamType` for the given Python
type. If the type isn't provided, it can be inferred from a default
value.
Fr   Tz3Attempted to use an uninstantiated parameter type (z).)r   r   r   r   r   r  r   r   r   rb   r:  r4  rC  r   ri  
issubclassAssertionErrorrI  re   )r  defaultguessed_typeitems       r$   r   r   X  s&   
 L	zg)gt}-- qz
 dUDM22s4/BdBgB"eRy"i  		SyBJ	Sy
	U{	Tz	"i(($I"RP  ) 	  		s   $D3 3
E ?E c                  >    \ rS rSr% S\S'   S\S'   S\S'   S\S'   Srg	)
OptionHelpExtrai  ztuple[str, ...]envvarsr   r  r  r   r2   N)r    rS   rT   rU   rW   rX   r2   r'   r$   r  r    s    LJMr'   r  F)total)r,   rM   rK   zte.TypeGuard[t.IO[t.Any]]r)   )r  t.Any | Noner  r  rK   r   )?
__future__r   collections.abcabccabcr   r  r  r   typingrY  r   r   r   r   _compatr   r	   
exceptionsr   utilsr   r   r   TYPE_CHECKINGtyping_extensionstecorer   r   shell_completionr   TypeVarr   r   rZ   re   r|   r   Genericr   r   r   r  r7  r=  rA  rF  rO  ro  rw  r  r  r  r   r   r   r:  rC  ri  rr  	TypedDictr  r2   r'   r$   <module>r     s   "   	  
      '   $ "  ??"0+,B BJ$ $)I )0	9 	i 4e4Y		.1 e4PDy DN9 $SJ+ SJl'  4) (I!> (IVBI BJ	 0v99 v9r=r79 r7j1
 1
h9N #$ 
	 n 	  akk r'   