
    ~/jE                    ~   S SK Jr  S SKr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	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rS SKJr  S SKJr  Sr\ " S S5      5       r    SS jr " S S5      r " S S5      r " S S\R6                  5      r " S S\R:                  5      r " S S\R>                  5      r g)    )annotationsN)Callable)Sequence)Any)final)Literal)NoReturn   )
UsageError)NOTSET)check_ispytestfile_or_dirc                  2   \ rS rSrSr  SSSS.         SS jjjr\SS j5       r\R                  SS j5       rSS	 jr	 S       SS
 jjr
SS jr S     SS jjr S     SS jjr S     SS jjrS\4SS.           SS jjjrSrg)Parser   zParser for command line arguments and config-file values.

:ivar extra_info: Dict of generic param -> value to display in case
    there's an error processing the command line arguments.
NF)prog	_ispytestc               `   [        U5        SSKJn  X l        0 U l        [        XR                  US9U l        U R                  R                  S5      n[        USU SS9U l	        U R                  /U l
        0 U l        U R                  R                  [        SS	9nXWl        0 U l        0 U l        g )
Nr   )filescompleterr   zCustom options
_anonymousTr   *)nargs)r   _pytest._argcompleter   _processopt
extra_infoPytestArgumentParser	optparseradd_argument_groupOptionGroupr   _groups	_opt2destadd_argumentFILE_OR_DIR	completer_inidict_ini_aliases)selfusage
processoptr   r   r   anonymous_arggroupfile_or_dir_args           X/root/lseg-credit/backend/venv/lib/python3.13/site-packages/_pytest/config/argparsing.py__init__Parser.__init__    s     	y!7%*,-e__4P!^^>>?OP%dd
 ()+..55k5M$2!9;,.    c                .    U R                   R                  $ Nr   r   r)   s    r.   r   Parser.prog=   s    ~~"""r1   c                $    XR                   l        g r3   r4   )r)   values     r.   r   r6   A   s    #r1   c                n    U R                   (       a$  UR                  (       a  U R                  U5        g g g r3   )r   dest)r)   options     r.   processoptionParser.processoptionE   s*    {{  (  r1   c                   U R                    H  nUR                  U:X  d  M  Us  $    U R                  R                  U=(       d    U5      n[	        XQU SS9nSn[        U R                   5       H  u  pgUR                  U:X  d  M    O   U R                   R                  US-   U5        U R                  R                  R                  US-   U R                  R                  R                  5       5        U$ )a  Get (or create) a named option Group.

:param name: Name of the option group.
:param description: Long description for --help output.
:param after: Name of another group, used for ordering --help output.
:returns: The option group.

The returned group object has an ``addoption`` method with the same
signature as :func:`parser.addoption <pytest.Parser.addoption>` but
will be shown in the respective group in the output of
``pytest --help``.
Tr   r   r
   )	r"   namer   r    r!   	enumerateinsert_action_groupspop)r)   r?   descriptionaftergrouparggroupigrps           r.   getgroupParser.getgroupJ   s     \\EzzT! " >>44[5HDIHDDA-FAxx5  . 	AE5) 	%%,,QUDNN4Q4Q4U4U4WXr1   c                <    U R                   R                  " U0 UD6  g)a  Register a command line option.

:param opts:
    Option names, can be short or long options.
:param attrs:
    Same attributes as the argparse library's :meth:`add_argument()
    <argparse.ArgumentParser.add_argument>` function accepts.

After command line parsing, options are available on the pytest config
object via ``config.option.NAME`` where ``NAME`` is usually set
by passing a ``dest`` attribute, for example
``addoption("--long", dest="NAME", ...)``.
N)r   	addoptionr)   optsattrss      r.   rM   Parser.addoptioni   s     	!!4151r1   c                   SSK Jn  U" U R                  5        U Vs/ s H  n[        R                  " U5      PM     nnUc  [
        R                  " 5       n SUl        U R                  R                  XRS9U?$ s  snf ! U?f = f)zParse the arguments.

Unlike ``parse_known_args`` and ``parse_known_and_unknown_args``,
raises PrintHelp on `--help` and UsageError on unknown flags

:meta private:
r   )try_argcompleteT	namespace)	r   rS   r   osfspathargparse	Namespace_raise_print_helpparse_intermixed_args)r)   argsrU   rS   xstrargss         r.   parseParser.parsey   sz     	9')-.A299Q<. **,I	,*.I'>>777U+ / +s    A:A? ?Bc                &    U R                  XS9S   $ )zRParse the known arguments at this point.

:returns: An argparse namespace object.
rT   r   )parse_known_and_unknown_args)r)   r\   rU   s      r.   parse_known_argsParser.parse_known_args   s     000KANNr1   c                   U Vs/ s H  n[         R                  " U5      PM     nn[        R                  S:  d  S[        R                  s=::  a  S:  al  O  OiU R                  R                  XB5      u  p%Uc   e[        U[        5      n/ nU H,  nUR                  S5      (       a  UOUR                  U5        M.     X'4$ U R                  R                  XB5      $ s  snf )zParse the known arguments at this point, and also return the
remaining unknown flag arguments.

:returns:
    A tuple containing an argparse namespace object for the known
    arguments, and a list of unknown flag arguments.
)         )rf      )rf   ri   r
   -)rV   rW   sysversion_infor   rc   getattrr%   
startswithappendparse_known_intermixed_args)	r)   r\   rU   r]   r^   unknownr   unknown_flagsargs	            r.   rb   #Parser.parse_known_and_unknown_args   s     *..A299Q<.j(Gs7G7G,T*,T!%!@!@!TI(((!)[9K')M"%.."5"5;NNsS ++>>==gQQ /s    C )aliasesc               4   US;   d   eUc  SnU[         L a  [        U5      nX#U4U R                  U'   U H`  nX`R                  ;   a  [        SU< S35      eU R                  R                  U5      =nb  [        U< SU< 35      eXR                  U'   Mb     g)a  Register a configuration file option.

:param name:
    Name of the configuration.
:param type:
    Type of the configuration. Can be:

        * ``string``: a string
        * ``bool``: a boolean
        * ``args``: a list of strings, separated as in a shell
        * ``linelist``: a list of strings, separated by line breaks
        * ``paths``: a list of :class:`pathlib.Path`, separated as in a shell
        * ``pathlist``: a list of ``py.path``, separated as in a shell
        * ``int``: an integer
        * ``float``: a floating-point number

        .. versionadded:: 8.4

            The ``float`` and ``int`` types.

    For ``paths`` and ``pathlist`` types, they are considered relative to the config-file.
    In case the execution is happening without a config-file defined,
    they will be considered relative to the current working directory (for example with ``--override-ini``).

    .. versionadded:: 7.0
        The ``paths`` variable type.

    .. versionadded:: 8.1
        Use the current working directory to resolve ``paths`` and ``pathlist`` in the absence of a config-file.

    Defaults to ``string`` if ``None`` or not passed.
:param default:
    Default value if no config-file option exists but is queried.
:param aliases:
    Additional names by which this option can be referenced.
    Aliases resolve to the canonical name.

    .. versionadded:: 9.0
        The ``aliases`` parameter.

The value of configuration keys can be retrieved via a call to
:py:func:`config.getini(name) <pytest.Config.getini>`.
)	Nstringpathspathlistr\   linelistboolintfloatNrx   zalias z- conflicts with existing configuration optionz is already an alias of )r   get_ini_default_for_typer'   
ValueErrorr(   get)r)   r?   helptypedefaultrv   aliasalreadys           r.   addiniParser.addini   s    n  

 

 
	
 

 <Df.t4G#73dE% UI%RS   ,,0077D E9,DWK!PQQ'+e$ r1   )r   r"   r(   r'   r#   r   r   r   )NN)
r*   
str | Noner+   z!Callable[[Argument], None] | Noner   r   r   r|   returnNoner   str)r8   r   r   r   )r;   Argumentr   r   ) N)r?   r   rD   r   rE   r   r   r!   rO   r   rP   r   r   r   r3   )r\    Sequence[str | os.PathLike[str]]rU   argparse.Namespace | Noner   argparse.Namespace)r\   r   rU   r   r   z$tuple[argparse.Namespace, list[str]])r?   r   r   r   r   zYLiteral['string', 'paths', 'pathlist', 'args', 'linelist', 'bool', 'int', 'float'] | Noner   r   rv   Sequence[str]r   r   )__name__
__module____qualname____firstlineno____doc__r/   propertyr   setterr<   rJ   rM   r_   rc   rb   r   r   __static_attributes__ru   r1   r.   r   r      s    !8</
  // 6/
 / / 
/: # # 
[[$ $) EI&)7A	>2& 04,., -, 
	,6 04	O.	O -	O 
		O 04R.R -R 
.	R@ P, "$P,P, P,	P, P, P, 
P, P,r1   r   c                >    U S;   a  / $ U S:X  a  gU S:X  a  gU S:X  a  gg)	zg
Used by addini to get the default value for a given config option type, when
default is not supplied.
)ry   rz   r\   r{   r|   Fr}   r   r~   g        r   ru   )r   s    r.   r   r     s3     88				r1   c                  |    \ rS rSrSrSS jrSS jrSS jr\SS j5       r	\SS j5       r
\SS j5       rSS	 jrS
rg)r   i  z$An option defined in an OptionGroup.c                    Xl         g r3   _action)r)   actions     r.   r/   Argument.__init__   s    r1   c                .    U R                   R                  $ r3   )r   __dict__r5   s    r.   rP   Argument.attrs#  s    ||$$$r1   c                .    U R                   R                  $ r3   )r   option_stringsr5   s    r.   namesArgument.names&  s    ||***r1   c                .    U R                   R                  $ r3   )r   r:   r5   s    r.   r:   Argument.dest)      ||   r1   c                .    U R                   R                  $ r3   )r   r   r5   s    r.   r   Argument.default-  s    ||###r1   c                .    U R                   R                  $ r3   )r   r   r5   s    r.   r   Argument.type1  r   r1   c                r   [        U SS 5      nUc  g/ nUS[        U R                  5       5      -   /-  nUS[        U R                  5      -   /-  nUR                  (       a  US[        U R                  5      -   /-  nUS[        U R
                  5      -   /-  nSR                  SR                  U5      5      $ )	Nr   zArgument(<uninitialized>)zopts: zdest: ztype: z	default: zArgument({}), )rm   reprr   r:   r   r   formatjoin)r)   r   r\   s      r.   __repr__Argument.__repr__5  s    y$/>.D..//DO+,,;;XTYY/00DtDLL1122$$TYYt_55r1   r   N)r   argparse.Actionr   r   )r   dict[str, Any])r   r   r   )r   r   )r   z
Any | None)r   r   r   r   r   r/   rP   r   r   r:   r   r   r   r   ru   r1   r.   r   r     sU    .%+ ! ! $ $ ! !
6r1   r   c                  h    \ rS rSrSr S	         S
S jjrSS jrSS jr        SS jrSr	g)r!   iB  z,A group of options shown in its own section.c                L    [        U5        Xl        X l        / U l        X0l        g r3   )r   	_arggroupr?   optionsparser)r)   rG   r?   r   r   s        r.   r/   OptionGroup.__init__E  s"     	y!!	')r1   c                    [        U5      R                  S U R                   5       5      nU(       a  [        SU S35      eU R	                  XSS9  g)a;  Add an option to this group.

If a shortened version of a long option is specified, it will
be suppressed in the help. ``addoption('--twowords', '--two-words')``
results in help showing ``--two-words`` only, but ``--twowords`` gets
accepted **and** the automatic destination is in ``args.twowords``.

:param opts:
    Option names, can be short or long options.
    Note that lower-case short options (e.g. `-x`) are reserved.
:param attrs:
    Same attributes as the argparse library's :meth:`add_argument()
    <argparse.ArgumentParser.add_argument>` function accepts.
c              3  R   #    U  H  oR                  5         H  o"v   M     M     g 7fr3   )r   ).0optr?   s      r.   	<genexpr>(OptionGroup.addoption.<locals>.<genexpr>a  s      *
(SYY[TD[DLs   %'zoption names z already addedFallow_reservedN)setintersectionr   r   _addoption_inner)r)   rO   rP   conflicts       r.   rM   OptionGroup.addoptionR  sU     t9)) *
 LL*
 
 }XJnEFFd%@r1   c                $    U R                  XSS9  g)zuLike addoption(), but also allows registering short lower case options (e.g. -x),
which are reserved for pytest core.Tr   N)r   rN   s      r.   
_addoptionOptionGroup._addoptionh  s     	d$?r1   c                   U(       dH  U HB  n[        U5      S:  d  M  US   S:X  d  M  US   R                  5       (       d  M9  [        S5      e   U R                  R                  " U0 UD6n[        U5      nU R                  R                  U5        U R                  (       aV  UR                  5        H&  nUR                  U R                  R                  U'   M(     U R                  R                  U5        g g )N   r   rj   r
   z$lowercase short options are reserved)lenislowerr   r   r$   r   r   ro   r   r   r:   r#   r<   )r)   rO   rP   r   r   r   r;   r?   s           r.   r   OptionGroup._addoption_innerm  s     s8q=SVs]s1v~~7G7G$%KLL  ,,d<e<&!F#;;.4kk%%d+ 'KK%%f- r1   )r   r?   r   r   N)F)
rG   zargparse._ArgumentGroupr?   r   r   zParser | Noner   r|   r   r   r   )rO   ztuple[str, ...]rP   r   r   r|   r   r   )
r   r   r   r   r   r/   rM   r   r   r   ru   r1   r.   r!   r!   B  sp    6  )  	
  
A,@
.#.,:.LP.	.r1   r!   c                  L   ^  \ rS rSrSS.       SU 4S jjjrSS jrSrU =r$ )	r   i~  Nr   c          	     >   > [         TU ]  UUS[        SSS9  X l        g )NF@)r*   r   add_helpformatter_classallow_abbrevfromfile_prefix_chars)superr/   DropShorterLongHelpFormatterr   )r)   r*   r   r   	__class__s       r.   r/   PytestArgumentParser.__init__  s0     	8"% 	 	
 %r1   c           	         U R                    SU 3nU R                  (       a?  USSR                  S [        U R                  R	                  5       5       5       5      -   -  n[        U R                  5       U-   5      e)z1Transform argparse error message into UsageError.z	: error: 
c              3  6   #    U  H  u  pS U SU 3v   M     g7f)z  z: Nru   )r   kvs      r.   r   -PytestArgumentParser.error.<locals>.<genexpr>  s"      $*I$!"QCr!*Is   )r   r   r   sorteditemsr   format_usage)r)   messagemsgs      r.   errorPytestArgumentParser.error  su     9WI.??4$)) $*01F1F1H*I$   C **,s233r1   )r   )r*   r   r   zdict[str, str]r   r   r   r   )r   r   r   r	   )r   r   r   r   r/   r   r   __classcell__r   s   @r.   r   r   ~  sB      %% #%
 % 
% %&	4 	4r1   r   c                  J   ^  \ rS rSrSrSU 4S jjrSU 4S jjrS	S jrSrU =r	$ )
r   i  zShorten help for long options that differ only in extra hyphens.

- Collapse **long** options that are the same except for extra hyphens.
- Shortcut if there are only two options and one of them is a short one.
c                t   > SU;  a!  [         R                  R                  5       US'   [        TU ]  " U0 UD6  g )Nwidth)_pytest_ioget_terminal_widthr   r/   )r)   r\   kwargsr   s      r.   r/   %DropShorterLongHelpFormatter.__init__  s3    & %kk<<>F7O$)&)r1   c                  > [         T	U ]  U5      nU(       a  US   S:w  a  U$ UR                  S5      n[        U5      S:X  a&  [        US   5      S:X  d  [        US   5      S:X  a  U$ / n0 nU Hz  n[        U5      S:X  d	  US   S:X  a  M  UR	                  S5      (       d   SU S	35       eUSS  nUR                  SS
5      nX;  d  [        XX   5      [        U5      :  d  Mv  XuU'   M|     U Hx  n[        U5      S:X  d	  US   S:X  a  UR                  U5        USS  UR                  UR                  SS
5      5      :X  d  MV  UR                  UR                  SSS5      5        Mz     SR                  U5      $ )Nr   rj   r   r   r
    z--z&long optional argument without "--": []r   =)	r   _format_action_invocationsplitr   rn   replacero   r   r   )
r)   r   orgstrr   return_list
short_longr;   xxoption	shortenedr   s
            r.   r   6DropShorterLongHelpFormatter._format_action_invocation  s   26:fQi3&M,,t$w<1#gaj/Q"6#gaj/Q:NM%'
F6{a6!9#3$$T** 8B* abzH ((b1I*c*2G.H3L / )19%  F6{a6!9#3""6*abzZ^^FNN3,CDD""6>>#sA#>?	 
 yy%%r1   c                    / nUR                  5        H7  nUR                  [        R                  " UR	                  5       U5      5        M9     U$ )zmWrap lines after splitting on original newlines.

This allows to have explicit line breaks in the help text.
)
splitlinesextendtextwrapwrapstrip)r)   textr   lineslines        r.   _split_lines)DropShorterLongHelpFormatter._split_lines  s<    
 OO%DLLtzz|U;< &r1   ru   )r\   r   r   r   r   r   )r   r   r   r   )r  r   r   r}   r   z	list[str])
r   r   r   r   r   r/   r   r  r   r   r   s   @r.   r   r     s    *&> r1   r   c                  b   ^  \ rS rSrSr S           SU 4S jjjr      SS jrSrU =r$ )	OverrideIniActioni  zCustom argparse action that makes a CLI flag equivalent to overriding an
option, in addition to behaving like `store_true`.

This can simplify things since code only needs to inspect the config option
and not consider the CLI flag.
c               H   > [         TU ]  " XS/UQ70 UD6  X@l        XPl        g )Nr   )r   r/   
ini_option	ini_value)	r)   r   r:   r   r  r  r\   r   r   s	           r.   r/   OverrideIniAction.__init__  s(     	qB4B6B$"r1   c                    [        X R                  S5        [        USS 5      nUc  / nUR                  U R                   SU R
                   35        [        USU5        g )NToverride_inir   )setattrr:   rm   ro   r  r  )r)   r   rU   r\   r   current_overridess         r.   __call__OverrideIniAction.__call__  s]     		99d+#I~tD$ "  DOO#4Adnn5E!FG	>+<=r1   )r  r  r3   )r   r   r:   r   r   zint | str | Noner  r   r  r   r   r   )r   zargparse.ArgumentParserrU   r   r   r   )	r   r   r   r   r   r/   r  r   r   r   s   @r.   r  r    sw     #'	#%# #  	# # # 
# #>'> &> 
> >r1   r  )r   zRLiteral['string', 'paths', 'pathlist', 'args', 'linelist', 'bool', 'int', 'float']r   r   )!
__future__r   rX   collections.abcr   r   rV   rk   r  typingr   r   r   r	   
exceptionsr   _pytest._ior   _pytest.compatr   _pytest.deprecatedr   r%   r   r   r   r!   ArgumentParserr   HelpFormatterr   Actionr  ru   r1   r.   <module>r&     s    "  $ $ 	 
      "  ! -  l, l, l,^ 		*"6 "6J9. 9.x4822 4@48#9#9 4n"> ">r1   