
    [Fi#"                     t   d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	l
mZ dd
l
mZ ddlmZ ddlmZ ddlZ G d de      ZdeddfdZ ej*                  d      dedeef   fd       ZdeddfdZdedee	eef      fdZdeddfdZdgZdedee   fdZdedee   fdZy)z3Version info, help messages, tracing configuration.    )ActionN)	Generator)List)Optional)Union)Config)ExitCode)	PrintHelp)Parser)TerminalReporterc                   ,     e Zd ZdZd fd	ZddZ xZS )
HelpActiona}  An argparse Action that will raise an exception in order to skip the
    rest of the argument parsing when --help is passed.

    This prevents argparse from quitting due to missing required arguments
    when any are defined, for example by ``pytest_addoption``.
    This is similar to the way that the builtin argparse --help option is
    implemented by raising SystemExit.
    c                 0    t         |   ||d|d|       y )NTr   )option_stringsdestconstdefaultnargshelp)super__init__)selfr   r   r   r   	__class__s        d/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/_pytest/helpconfig.pyr   zHelpAction.__init__   s'    ) 	 	
    c                     t        || j                  | j                         t        |j                  dd      rt
        y )Nafter_preparseF)setattrr   r   getattr_parserr
   )r   parser	namespacevaluesoption_strings        r   __call__zHelpAction.__call__(   s3    	499djj1 6>>#3U;O <r   )NFN)N)__name__
__module____qualname____doc__r   r%   __classcell__)r   s   @r   r   r      s    
r   r   r!   returnc           	      >   | j                  d      }|j                  dddddd       |j                  d	d
t        dd       |j                  dddg dd       |j                  ddddd       |j                  ddddddd !       |j                  d"d#d$dd%&       y )'Ndebugconfigz	--versionz-Vcountr   versionzoDisplay pytest version and information about plugins. When given twice, also display information about plugins.)actionr   r   r   z-hz--helpr   z(Show help message and configuration info)r0   r   r   z-pappendpluginsnamezEarly-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use the `no:` prefix, e.g. `no:doctest`.)r0   r   r   metavarr   z--traceconfigz--trace-config
store_trueFz)Trace considerations of conftest.py files)r0   r   r   z--debugstore?zpytestdebug.logdebugDEBUG_FILE_NAMEzStore internal tracing debug information in this log file. This file is opened with 'w' and truncated as a result, care advised. Default: pytestdebug.log.)r0   r   r   r   r4   r   z-oz--override-inioverride_iniz^Override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.)r   r0   r   )getgroup	addoption
_addoptionr   )r!   groups     r   pytest_addoptionr?   0   s    OOM*E	OOD   
7   
  	 
OO8   
OO!$  
 
:  r   T)wrapperc               #     K   d j                   j                  r?j                   j                  } t        | dd      j                  dj	                  t
        j                  dj                  t        t        t        j                              j                  j                  t        j                         j                  j                                j"                  j$                  j'                  j                         j(                  j+                         t        j,                  j                  d| z         dfd}j/                  |       S w)	Nwzutf-8)encodingz@versions pytest-{}, python-{}
invocation_dir={}
cwd={}
args={}

.z'writing pytest debug information to %s
c                      j                          t        j                  j                  dj                  z          j
                  j                  j                  d                 y )Nz%wrote pytest debug information to %s
)closesysstderrwriter3   traceroot	setwriter)config	debugfileundo_tracings   r   unset_tracingz+pytest_cmdline_parse.<locals>.unset_tracing~   sF    OOJJE	VWLL''-Nr   )r+   N)optionr8   openrI   formatpytest__version__joinmapstrrG   version_infoinvocation_paramsdirosgetcwdargsrJ   rK   rL   pluginmanagerenable_tracingrH   add_cleanup)pathrP   rM   rN   rO   s     @@@r   pytest_cmdline_parserc   h   s     F}}}}""sW5	@@F""S#"2"234((,,		((--A		
 	##IOO4++::<

CdJK	 	=)Ms   EE"rM   c                    | j                   j                  dkD  rzt        j                  j	                  dt
        j                   dt
        j                   d       t        |       }|r*|D ]$  }t        j                  j	                  |dz          & y y t        j                  j	                  dt
        j                   d       y )N   zThis is pytest version z, imported from 
zpytest )	rQ   r/   rG   stdoutrI   rT   rU   __file__getpluginversioninfo)rM   
plugininfolines      r   showversionrl      s    }}q 

%f&8&8%99I&//IZZ\]	
 *&1
" .

  -.  	

76#5#5"6b9:r   c                     | j                   j                  dkD  rt        |        y| j                   j                  r,| j	                          t        |        | j                          yy )Nr   )rQ   r/   rl   r   _do_configureshowhelp_ensure_unconfigure)rM   s    r   pytest_cmdline_mainrq      sR    }}q F			""$r   c                 J   dd l }| j                  j                  d      }|J |j                  }|j	                  | j
                  j                  j                                |j                          |j                  d       |j                          |j                  }d}d|z  }| j
                  j                  D ]  }| j
                  j                  |   \  }}	}
|	d}	|t        d|       | d|	 d	}|j	                  d
|z         t        |      }||dz
  kD  r?|j                          |j                  ||||d      }|D ]  }|j                  |        |j	                  d||z
  dz
  z         |j                  |||z
  d      }|s|j                  |d          |dd  D ]  }|j                  ||z            |j                          |j                  d       g d}|D ]  \  }}|j                  d|dd|         |j                          |j                          |j                  d       |j                  d       |j                  d       |j                  j!                  dg       D ]"  }|j                  d|j"                  z   d       $ y )Nr   terminalreporterzY[pytest] ini-options in the first pytest.ini|tox.ini|setup.cfg|pyproject.toml file found:    stringz!help argument cannot be None for z (z):z  %s   F)initial_indentsubsequent_indentbreak_on_hyphens   )rz   re   zEnvironment variables:))PYTEST_ADDOPTSzExtra command line options)PYTEST_PLUGINSz.Comma-separated plugins to load during startup)PYTEST_DISABLE_PLUGIN_AUTOLOADz"Set to disable plugin auto-loading)PYTEST_DEBUGz1Set to enable debug tracing of pytest's internals  z<24z/to see available markers type: pytest --markersz1to see available fixtures type: pytest --fixturesz(shown according to specified file_or_dir or current dir if not specified; fixtures with leading '_' are only shown with the '-v' optionwarningsz
warning : T)red)textwrapr_   
get_plugin_twrI   r    	optparserformat_helprk   	fullwidth	_ininames_inidict	TypeErrorlenwrapstatsgetmessage)rM   r   reportertwcolumns
indent_lenindentr3   r   typer   specspec_len	helplinesrk   wrappedvarswarningreports                     r   ro   ro      s   +1+?+?+J+J,H 	BHHV^^%%1134GGIGG	B GGIllGJ:F(( +$nn55d;dG<D<?vFGGr$r"
$t9zA~&GGI %"(!& & I "  HHSJ1A567mmD'J*>QVmWG
##ABK +DGGFTM*+;+@ GGIGG$%D  (
d
"T#Jav&'(GGIGGIGG=>GG?@GG	 "++J; @
}444$?@
r   )pytest_pluginszlist of plugin names to loadc                    g }| j                   j                         }|rc|j                  d       |D ]M  \  }}t        |dt	        |            }|j
                   d|j                   d| }|j                  d|z          O |S )Nzsetuptools registered plugins:rh   -z at r   )r_   list_plugin_distinfor1   r   reprproject_namer/   )rM   linesrj   plugindistloccontents          r   ri   ri      s    E%%::<J56& 	)LFD&*d6l;C**+1T\\N$seDGLL(	) Lr   c                    g }| j                   j                  s| j                   j                  r@|j                  dt        j
                          t        |       }|r|j                  |       | j                   j                  rq|j                  d       | j                  j                         }|D ]A  \  }}t        |d      r|j                  }nt        |      }|j                  d|dd|        C |S )Nzusing: pytest-zactive plugins:rh   z    z<20z: )rQ   r8   traceconfigr1   rT   rU   ri   extendr_   list_name_pluginhasattrrh   r   )rM   r   verinfoitemsr3   r   rs          r   pytest_report_headerr      s    E}}fmm77~f&8&8%9:;&v.LL!}}  &'$$557! 	1LD&vz*OOLLL4SzA3/0	1 Lr   )r)   argparser   r\   rG   typingr   r   r   r   _pytest.configr   r	   r
   _pytest.config.argparsingr   _pytest.terminalr   rT   r   r?   hookimplrc   rl   intrq   ro   conftest_optionsrX   ri   r    r   r   <module>r      s   9  	 
     ! # $ , -  85V 5 5p iff(<=  @
; 
;4 
;	 	8E#x-4H+I 	JV J JZ GG 	 	DI 	 DI r   