
    L-Ph                    R   d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddlmZ ddlmZmZmZmZmZ ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
l m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZC ddlDmEZE ddlFmGZGmHZH ddlFmIZImJZJmKZK ddlLmMZM ddlNmOZO ddlPmQZQmRZR ddlSmTZT ddlUmVZV ddlWmXZX ddlYmZZZm[Z[ ddl\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZd dd lemfZf  eKe          Zejg        d4d'            Zh eId(          ZieiZj G d) d"e^          Zk el ejm        d*d                    r)dd+l,mnZnmoZo   en eod,-          d.g/          ek          Zkd5d1Zpd6d3ZqdS )7z&Central control stuff for coverage.py.    )annotationsN)	FrameType)castAnyCallableIOUnion)IterableIterator)env)AnnotateReporter)	Collector)CoverageConfigread_coverage_config)"should_start_context_test_functioncombine_context_switchers)CoreCTRACER_FILE)CoverageDatacombine_parallel_data)DebugControlNoDebuggingshort_stackwrite_formatted_inforelevant_environment_display)disposition_debug_msg)ConfigErrorCoverageExceptionCoverageWarningPluginError)PathAliasesabs_filerelative_filenameset_relative_directory)HtmlReporter)InOrOut)JsonReporter)LcovReporter)bool_or_none
join_regex)DefaultValueensure_dir_for_fileisolate_module)patch_multiprocessing)FileReporter)PluginsTCoverageInit)PythonFileReporter)SummaryReporter)render_report)Analysisanalysis_from_file_reporter)FilePathTConfigurableTConfigSectionInTConfigValueInTConfigValueOutTFileDispositionTLineNoTMorf)XmlReportercovCoveragekwargsr:   returnIterator[None]c              +     K   | j         }| j                                         | _         	  | j         j        di | dV  || _         dS # || _         w xY w)zTemporarily tweak the configuration of `cov`.

    The arguments are applied to `cov.config` with the `from_args` method.
    At the end of the with-statement, the old configuration is restored.
    N )configcopy	from_args)r@   rB   original_configs      P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/coverage/control.pyoverride_configrL   ;   si       jO""CJ%
&&v&&&$


_
$$$$s   A 	AMISSINGc                     e Zd ZU dZg Zded<   edd            Zedddddd	dddddddddddfdd&Z	dd'Z
dd(Zdd)Zdd/Zdd0Zddd4Zdd5Zdd8Zdd;Zdd<Zdd=Zdd?Zdd@ZddAZej        ddC            ZdddFZddKZddLZddNZdddQZdddSZ ddTZ!ddUZ"dddWZ#ddXZ$ddZZ%	 	 	 ddd^Z&dd`Z'ddaZ(ddeZ)ddgZ* e+j,        dhi          ddk            Z-ddmZ. e+j,        dhi          ddo            Z/	 dddsZ0ddtZ1	 	 	 	 	 	 	 	 	 	 	 	 dddZ2	 	 	 	 	 	 dddZ3	 	 	 	 	 	 	 	 	 	 	 	 dddZ4	 	 	 	 	 	 	 dddZ5	 	 	 	 	 	 	 	 dddZ6	 	 	 	 	 	 dddZ7ddZ8dS )rA   a  Programmatic access to coverage.py.

    To use::

        from coverage import Coverage

        cov = Coverage()
        cov.start()
        #.. call your code ..
        cov.stop()
        cov.html_report(directory="covhtml")

    A context manager is available to do the same thing::

        cov = Coverage()
        with cov.collect():
            #.. call your code ..
        cov.html_report(directory="covhtml")

    Note: in keeping with Python custom, names starting with underscore are
    not part of the public API. They might stop working at any point.  Please
    limit yourself to documented methods to avoid problems.

    Methods can raise any of the exceptions described in :ref:`api_exceptions`.

    zlist[Coverage]
_instancesrC   Coverage | Nonec                .    | j         r| j         d         S dS )zGet the latest started `Coverage` instance, if any.

        Returns: a `Coverage` instance, or None.

        .. versionadded:: 5.0

        N)rO   )clss    rK   currentzCoverage.currentm   s      > 	>"%%4    NFT	data_fileFilePath | DefaultValue | Nonedata_suffixstr | bool | Nonecover_pylibbool | None	auto_databooltimidbranchconfig_fileFilePath | boolsourceIterable[str] | Nonesource_pkgssource_dirsomitstr | Iterable[str] | Noneincludedebugconcurrencycheck_preimportedcontext
str | Nonemessagesplugins$Iterable[Callable[..., None]] | NoneNonec                   t                      | _        |du | _        t          |t                    rd}|t          j        |          }d| _        |x| _        | _	        || _
        d| _        d| _        || _        t                      | _        || _        g | _        t%                      | _        d| _        t+                      | _        t/          t0          t2          t4                   df         |          | _        d| _        d| _        d| _        d| _        t@          | _!        dx| _"        | _#        i | _$        d| _%        d| _&        d| _'        d| _(        d| _)        t          |tT                    st          j        |          }tW          di d|d| j,        d|d|d|d	|d
t[          |          d|d|	d|
d|d|d|d|d|d|d|| _        t\          j/        sta                       dS dS )a[  
        Many of these arguments duplicate and override values that can be
        provided in a configuration file.  Parameters that are missing here
        will use values from the config file.

        `data_file` is the base name of the data file to use. The config value
        defaults to ".coverage".  None can be provided to prevent writing a data
        file.  `data_suffix` is appended (with a dot) to `data_file` to create
        the final file name.  If `data_suffix` is simply True, then a suffix is
        created with the machine and process identity included.

        `cover_pylib` is a boolean determining whether Python code installed
        with the Python interpreter is measured.  This includes the Python
        standard library and any packages installed with the interpreter.

        If `auto_data` is true, then any existing data file will be read when
        coverage measurement starts, and data will be saved automatically when
        measurement stops.

        If `timid` is true, then a slower and simpler trace function will be
        used.  This is important for some environments where manipulation of
        tracing functions breaks the faster trace function.

        If `branch` is true, then branch coverage will be measured in addition
        to the usual statement coverage.

        `config_file` determines what configuration file to read:

            * If it is ".coveragerc", it is interpreted as if it were True,
              for backward compatibility.

            * If it is a string, it is the name of the file to read.  If the
              file can't be read, it is an error.

            * If it is True, then a few standard files names are tried
              (".coveragerc", "setup.cfg", "tox.ini").  It is not an error for
              these files to not be found.

            * If it is False, then no configuration file is read.

        `source` is a list of file paths or package names.  Only code located
        in the trees indicated by the file paths or package names will be
        measured.

        `source_pkgs` is a list of package names. It works the same as
        `source`, but can be used to name packages where the name can also be
        interpreted as a file path.

        `source_dirs` is a list of file paths. It works the same as
        `source`, but raises an error if the path doesn't exist, rather
        than being treated as a package name.

        `include` and `omit` are lists of file name patterns. Files that match
        `include` will be measured, files that match `omit` will not.  Each
        will also accept a single string argument.

        `debug` is a list of strings indicating what debugging information is
        desired.

        `concurrency` is a string indicating the concurrency library being used
        in the measured code.  Without this, coverage.py will get incorrect
        results if these libraries are in use.  Valid strings are "greenlet",
        "eventlet", "gevent", "multiprocessing", or "thread" (the default).
        This can also be a list of these strings.

        If `check_preimported` is true, then when coverage is started, the
        already-imported files will be checked to see if they should be
        measured by coverage.  Importing measured files before coverage is
        started can mean that code is missed.

        `context` is a string to use as the :ref:`static context
        <static_contexts>` label for collected data.

        If `messages` is true, some messages will be printed to stdout
        indicating what is happening.

        If `plugins` are passed, they are an iterable of function objects
        accepting a `reg` object to register plugins, as described in
        :ref:`api_plugin`.  When they are provided, they will override the
        plugins found in the coverage configuration file.

        .. versionadded:: 4.0
            The `concurrency` parameter.

        .. versionadded:: 4.2
            The `concurrency` parameter can now be a list of strings.

        .. versionadded:: 5.0
            The `check_preimported` and `context` parameters.

        .. versionadded:: 5.3
            The `source_pkgs` parameter.

        .. versionadded:: 6.0
            The `messages` parameter.

        .. versionadded:: 7.7
            The `plugins` parameter.

        .. versionadded:: 7.8
            The `source_dirs` parameter.
        NTFr`   warnrV   rZ   r^   r_   parallelrb   rd   re   run_omitrun_includeri   report_omitreport_includerj   rl   rF   )1r   rG   _no_disk
isinstancer+   osfspath_debug_file
_auto_load
_auto_save_data_suffix_specified_warn_no_data_warn_unimported_source_warn_preimported_sourceset_no_warn_slugs	_messages	_warningsr   _debug_inoroutr0   _pluginsr   r	   r
   r1   _plugin_override_data_core
_collector_metacovr"   _file_mapper_data_suffix_run_suffix_exclude_re_old_sigterm_inited_inited_for_start_started_should_write_debugr]   r   _warnr)   r   METACOV _prevent_sub_process_measurement)selfrV   rX   rZ   r\   r^   r_   r`   rb   rd   re   rf   rh   ri   rj   rk   rl   rn   ro   s                      rK   __init__zCoverage.__init__{   sz   z %&& "T)i.. 	I 	),,I ,0,55$/&1# "'+$(9%(+! %' %0MM(,!( $U8M+BD+H%I7 S S*.
"&
,02:/33D,+-KO !&#'  +t,, 	1)K00K* 
 
 
#

  i
 $	

 %
 6
 "+...
 6
 $
 $
 T
  
 %
 
 #7
  $!
" G#
2 { 	/,.....	/ 	/rU   c                   | j         rdS d| _         t          | j        j        | j        | j        j                  | _        | j                            d          r| j                            d           d| j        j	        pdv rd| j        _
        i | _        t                       | j        j        rt          | _        t!          | j                  | _        | j        r | j                            | j                   n*| j                            | j        j        | j                   | j        j        D ]E}|                    | | j        gt1          t3          j                              dz                      FdS )zSet all the initial state.

        This is called by the public methods to initialize state. This lets us
        construct a :class:`Coverage` object, then tweak its state before this
        function is called.

        NTprocesszCoverage._initmultiprocessingrF      )r   r   rG   ri   r}   
debug_filer   shouldwriterj   rt   r   r$   relative_filesr#   r   r0   r   r   load_from_callablesload_from_configro   configurers	configureinttimer   plugins     rK   _initzCoverage._initJ  sm    < 	F #4;#4d6FH^__;i(( 	0K.///!8!>B?? $(DK     ;% 	2 1D  ,,  	MM--d.CDDDDM**4;+>LLL m/ 	H 	HF
 dDK0TY[[1A1AA1EFGGGG	H 	HrU   c                    | j         rd| _         |                                  | j        j        r6| j        j        t	                      v rt          d| j        j                   dS dS )z,Stuff to do after everything is initialized.FzCrashing because called by N)r   _write_startup_debugrG   _crashr   RuntimeErrorr   s    rK   
_post_initzCoverage._post_initw  sx    # 	(',D$%%''' ; 	S$+"4"E"EQT[=OQQRRR	S 	S"E"ErU   c                   d}| j                                         5  | j                             d          r6| j                                        }t          | j         j        d|           d}| j                             d          rrt          | j         j        d|                                            | j        D ];}d|j	        z   }|                                }t          | j         j        ||           <d}| j                             d          r.t          | j         j        dt          j                               d}ddd           n# 1 swxY w Y   |rt          | j         j        dd	           dS dS )
z*Write out debug info at startup if needed.FrG   Tsyszsys: pybehaveNendrF   )r   without_callersr   rG   
debug_infor   r   sys_infor   _coverage_plugin_namer   )r   	wrote_anyconfig_infor   headerinfos         rK   r   zCoverage._write_startup_debug  s   	[((** 	! 	!{!!(++ !"k4466$T[%6+NNN 	{!!%(( !$T[%6t}}OOO"m J JF$v'CCF!??,,D():FDIIII 	{!!*-- !$T[%6
CNDTDTUUU 	!	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!$  	? !2E2>>>>>	? 	?s   D%EEEfilenamestrframer   r<   c                    | j         J | j                             ||          }| j                            d          r'| j                            t          |                     |S )zDecide whether to trace execution in `filename`.

        Calls `_should_trace_internal`, and returns the FileDisposition.

        Ntrace)r   should_tracer   r   r   r   )r   r   r   disps       rK   _should_tracezCoverage._should_trace  se     }(((}))(E::;g&& 	;K3D99:::rU   c                    | j         J | j                             ||          }| j                            d          r*|sd|}nd|d| }| j                            |           | S )zCheck a file name against the include/omit/etc, rules, verbosely.

        Returns a boolean: True if the file should be traced, False if not.

        Nr   z
Including zNot including z: )r   check_include_omit_etcr   r   r   )r   r   r   reasonmsgs        rK   _check_include_omit_etcz Coverage._check_include_omit_etc  s     }(((55hFF;g&& 	# >/8//=x==V==Kc"""zrU   r   slugoncec                   | j         st          | j        j                  | _         || j         v rdS | j                            |           |r| d| d}| j                            d          rdt          j	                     d| }t          j        |t          d           |r |J | j                             |           dS dS )	zUse `msg` as a warning.

        For warning suppression, use `slug` as the shorthand.

        If `once` is true, only show this warning once (determined by the
        slug.)

        Nz ()pid[z] r   )category
stacklevel)r   r   rG   disable_warningsr   appendr   r   r{   getpidwarningsrs   r   add)r   r   r   r   s       rK   r   zCoverage._warn  s     " 	D"%dk&B"C"CD4&&&Fc""" 	$##D###C;e$$ 	+*bikk**S**CcOBBBB 	*#####D)))))	* 	*rU   c                6    | j         rt          |           dS dS )z4Write a message to the user, if configured to do so.N)r   print)r   r   s     rK   _messagezCoverage._message  s%    > 	#JJJJJ	 	rU   option_nameTConfigValueOut | Nonec                6    | j                             |          S )a  Get an option from the configuration.

        `option_name` is a colon-separated string indicating the section and
        option name.  For example, the ``branch`` option in the ``[run]``
        section of the config file would be indicated with `"run:branch"`.

        Returns the value of the option.  The type depends on the option
        selected.

        As a special case, an `option_name` of ``"paths"`` will return an
        dictionary with the entire ``[paths]`` section value.

        .. versionadded:: 4.0

        )rG   
get_option)r   r   s     rK   r   zCoverage.get_option  s      {%%k222rU   value!TConfigValueIn | TConfigSectionInc                <    | j                             ||           dS )ah  Set an option in the configuration.

        `option_name` is a colon-separated string indicating the section and
        option name.  For example, the ``branch`` option in the ``[run]``
        section of the config file would be indicated with ``"run:branch"``.

        `value` is the new value for the option.  This should be an
        appropriate Python value.  For example, use True for booleans, not the
        string ``"True"``.

        As an example, calling:

        .. code-block:: python

            cov.set_option("run:branch", True)

        has the same effect as this configuration file:

        .. code-block:: ini

            [run]
            branch = True

        As a special case, an `option_name` of ``"paths"`` will replace the
        entire ``[paths]`` section.  The value should be a dictionary.

        .. versionadded:: 4.0

        N)rG   
set_option)r   r   r   s      rK   r   zCoverage.set_option  s"    < 	{E22222rU   c                ~   |                                   | j        | j                                         | j        j        o)t
          j                            | j        j                   }|s| 	                    d           | 
                                 |s$| j        J | j                                         dS dS )z;Load previously-collected coverage data from the data file.Nsuffix)r   r   resetrG   rt   r{   pathexistsrV   
_init_datar   r   read)r   should_skips     rK   loadzCoverage.load	  s    

?&O!!###k*X27>>$+BW3X3X/X 	)OO4O((( 	:)))JOO	 	rU   c           
        | j         j        pg }d|v r5| j         j        t          d          t	          | j         j                   | j         j        }|r|dk    rg }n!|dk    r	t          g}nt          d|          |                    d | j        j	        D                        t          |          }t          | j        | j         |du| j        	          | _        t          | j        | j        | j        || j        | j         j        | j        |
          | _        | j        }|rt-          |t.                    sd}n8| j         j        r*|d}n't-          |t.                    st3          |          }nd}|                     |           | j        J | j                            | j        | j         j                   | j        j        r| j        j        s}|                     d                     d!                    d | j        j        D                       | j        "                                                     | j        j        D ]	}d|_#        
tI          | j         | j        | j%        &                    d          r| j%        nd| j         j'                  | _(        | j        | j(        _)        | j        j*        | j(        _+        d| _,        t[          j.        | j/                   | j         j0        ratc          j2                    tc          j3                    k    }|r9th          j5        s/tm          j6        tl          j7        | j8                  | _9        dS dS dS dS )zInitialization for start()r   Nz-multiprocessing requires a configuration file)rcfilenonetest_functionz*Don't understand dynamic_context setting: c              3  $   K   | ]}|j         V  d S N)dynamic_context.0r   s     rK   	<genexpr>z+Coverage._init_for_start.<locals>.<genexpr>'  s6       !
 !
'-F"!
 !
 !
 !
 !
 !
rU   )rs   rG   dynamic_contextsmetacov)corer   check_includeshould_start_contextfile_mapperr_   rs   rj   Tz1Plugin file tracers ({}) aren't supported with {}z, c              3  $   K   | ]}|j         V  d S r   )r   r   s     rK   r   z+Coverage._init_for_start.<locals>.<genexpr>T  s9         & 4     rU   Fr   )rG   rs   ri   include_namespace_packages):rG   rj   r`   r   r.   r   r   extendr   context_switchersr   r   r   r   r   r   r   r   r   r_   r   r   rz   r   rt   r]   r   r   use_datarl   file_tracerssupports_pluginsformatjointracer_name_coverage_enabledr&   r   r   r  r   ro   file_disposition_class
disp_classr   atexitregister_atexitsigterm	threadingcurrent_threadmain_threadr   WINDOWSsignalSIGTERM_on_sigtermr   )r   rj   dyconr  r   r   r   is_mains           rK   _init_for_startzCoverage._init_for_start  s    "&!8!>B++{&.!"QRRR!)@AAAA+ 	V "o%%!C DT5TTUUU   !
 !
151P!
 !
 !
 	
 	
 	
  99JKK;2$>M	
 
 

 $+6!5);%#	
 	
 	
 , 
	fc** [! 	~,, &fFz%%%  T[-@AAA =% 	1dj.I 	1JJCJJII  *.-*D     O//11    -4 1 1+0((  ;"&+"4"4W"="=G4;;4'+{'M	
 
 
 !%#':#D  $(  	%%%; 	 /11Y5J5L5LLG s{  %+MND$4% %!!!	 	   rU   r   c                    | j         Mt          | j        j                   t	          | j        j        || j        | j        | j                  | _         dS dS )z,Create a data file if we don't have one yet.N)basenamer   rs   ri   no_disk)r   r,   rG   rV   r   r   r   ry   )r   r   s     rK   r   zCoverage._init_dataw  s[    :   5666%.Zk  DJJJ rU   c                   |                                   | j        sd| _        |                                  |                                  | j        J | j        J | j                                         | j        r| j                                         | j	        r| 
                                 | j                                         d| _        | j                            |            dS )a  Start measuring code coverage.

        Coverage measurement is only collected in functions called after
        :meth:`start` is invoked.  Statements in the same scope as
        :meth:`start` won't be measured.

        Once you invoke :meth:`start`, you must also call :meth:`stop`
        eventually, or your process might not shut down cleanly.

        The :meth:`collect` method is a context manager to handle both
        starting and stopping collection.

        TN)r   r   r  r   r   r   warn_conflicting_settingsr   warn_already_imported_filesr~   r   startr   rO   r   r   s    rK   r!  zCoverage.start  s     	

% 	#%)D"  """***}((( 	//111 ( 	8M55777? 	IIKKKt$$$$$rU   c                    | j         r(| j         d         | u r| j                                          | j        r"| j        J | j                                         d| _        dS )zStop measuring code coverage.rR   NF)rO   popr   r   stopr   s    rK   r$  zCoverage.stop  si    ? 	&r"d**##%%%= 	#?...O  """rU   rD   c              #     K   |                                   	 dV  |                                  dS # |                                  w xY w)ziA context manager to start/stop coverage measurement collection.

        .. versionadded:: 7.3

        N)r!  r$  r   s    rK   collectzCoverage.collect  sF       	

	EEEIIKKKKKDIIKKKKs	   2 Ar  eventc                   | j                             d          r3| j                             | dt          j                     d|            | j        r|                                  | j        s|dk    r|                                  dS dS )zClean up on process shutdown.r   z: pid: z, instance: r  N)	r   r   r   r{   r   r   r$  r   save)r   r'  s     rK   r  zCoverage._atexit  s    ;i(( 	RKPPry{{PPPPQQQ= 	IIKKK? 	ey00IIKKKKK 10rU   signum_unusedr   frame_unusedFrameType | Nonec                    |                      d           t          j        t          j        | j                   t	          j        t	          j                    t          j                   dS )zA handler for signal.SIGTERM.r  N)r  r  r  r   r{   killr   )r   r*  r+  s      rK   r  zCoverage._on_sigterm  sM    Y 	fnd&7888
	V^,,,,,rU   c                :   |                                   |                                  | j        | j                                         |                     d           | j        J | j                            | j        j                   d| _        d| _	        dS )zErase previously collected coverage data.

        This removes the in-memory data collected in this session as well as
        discarding the data file.

        Nr   )rt   F)
r   r   r   r   r   r   eraserG   rt   r   r   s    rK   r0  zCoverage.erase  s     	

?&O!!###t$$$z%%%
$+"6777
!&rU   new_contextc                    | j         st          d          | j        J | j        j        r|                     ddd           | j                            |           dS )a  Switch to a new dynamic context.

        `new_context` is a string to use as the :ref:`dynamic context
        <dynamic_contexts>` label for collected data.  If a :ref:`static
        context <static_contexts>` is in use, the static and dynamic context
        labels will be joined together with a pipe character.

        Coverage collection must be started already.

        .. versionadded:: 5.0

        z.Cannot switch context, coverage is not startedNzConflicting dynamic contextszdynamic-conflictT)r   r   )r   r   r   r   r   switch_context)r   r1  s     rK   r3  zCoverage.switch_context  sq     } 	V#$TUUU***?/ 	[JJ5<NUYJZZZ&&{33333rU   excludewhichc                    |                                   t          | j        |dz   g            |                                  dS )zClear the exclude list._listN)r   setattrrG   _exclude_regex_staler   r5  s     rK   clear_excludezCoverage.clear_exclude  s?    

UW_b111!!#####rU   regexc                    |                                   t          | j        |dz             }|                    |           |                                  dS )a|  Exclude source lines from execution consideration.

        A number of lists of regular expressions are maintained.  Each list
        selects lines that are treated differently during reporting.

        `which` determines which list is modified.  The "exclude" list selects
        lines that are not considered executable at all.  The "partial" list
        indicates lines with branches that are not taken.

        `regex` is a regular expression.  The regex is added to the specified
        list.  If any of the regexes in the list is found in a line, the line
        is marked for special treatment during reporting.

        r7  N)r   getattrrG   r   r9  )r   r<  r5  	excl_lists       rK   r4  zCoverage.exclude  sR     	

DK99	!!#####rU   c                8    | j                                          dS )z=Drop all the compiled exclusion regexes, a list was modified.N)r   clearr   s    rK   r9  zCoverage._exclude_regex_stale  s         rU   c                    || j         vr/t          | j        |dz             }t          |          | j         |<   | j         |         S )z3Return a regex string for the given exclusion list.r7  )r   r>  rG   r*   )r   r5  r?  s      rK   _exclude_regexzCoverage._exclude_regex  sH    (((UW_==I&0&;&;DU#&&rU   	list[str]c                    |                                   t          t          t                   t	          | j        |dz                       S )zReturn a list of excluded regex strings.

        `which` indicates which list is desired.  See :meth:`exclude` for the
        lists that are available, and their meaning.

        r7  )r   r   listr   r>  rG   r:  s     rK   get_exclude_listzCoverage.get_exclude_list   s5     	

DIwt{EGODDEEErU   c                V    |                                  }|                                 dS )z2Save the collected coverage data to the data file.N)get_datar   )r   datas     rK   r)  zCoverage.save*  s     }}

rU   r!   c                    t          | j                            d          r| j        j        nd| j        j                  }| j        j                                        D ]-}|d         }|dd         D ]}|                    ||           .|S )z,Create a PathAliases from our configuration.pathmapN)debugfnrelativer      )	r!   r   r   r   rG   r   pathsvaluesr   )r   aliasesrP  resultpatterns        rK   _make_aliaseszCoverage._make_aliases/  s    *.+*<*<Y*G*GQT[&&T[/
 
 
 [&--// 	- 	-E1XF 9 - -GV,,,,-rU   
data_pathsstrictkeepc                   |                                   |                     d           |                                  |                                  | j        J t          | j        |                                 |||| j                   dS )a  Combine together a number of similarly-named coverage data files.

        All coverage data files whose name starts with `data_file` (from the
        coverage() constructor) will be read, and combined together into the
        current measurements.

        `data_paths` is a list of files or directories from which data should
        be combined. If no list is passed, then the data files from the
        directory indicated by the current data file (probably the current
        directory) will be combined.

        If `strict` is true, then it is an error to attempt to combine when
        there are no data files to combine.

        If `keep` is true, then original input data files won't be deleted.

        .. versionadded:: 4.0
            The `data_paths` parameter.

        .. versionadded:: 4.3
            The `strict` parameter.

        .. versionadded: 5.5
            The `keep` parameter.
        Nr   )rR  rV  rW  rX  message)r   r   r   rI  r   r   rU  r   )r   rV  rW  rX  s       rK   combinezCoverage.combine;  s    > 	

t$$$z%%%J&&((!M	
 	
 	
 	
 	
 	
rU   r   c                \   |                                   |                     d           |                                  | j        X| j        D ]#}|j        s| j                            |           $| j                                        r|                                  | j	        J | j	        S )zGet the collected data.

        Also warn about various problems collecting data.

        Returns a :class:`coverage.CoverageData`, the collected coverage data.

        .. versionadded:: 4.0

        Nr   )
r   r   r   r   r   r
  plugin_was_disabled
flush_data_post_save_workr   r   s     rK   rI  zCoverage.get_datai  s     	

t$$$?&- @ @/ @O77???))++ '$$&&&z%%%zrU   c                   | j         J | j        J | j        r| j                                         | j         s| j        r|                     dd           t          j        t                    }| j        	                                D ]5\  }}| 
                    |          }||                             |           6|                                D ] \  }}| j                             ||           !dS )zAfter saving data, look for warnings, post-work, etc.

        Warn about things that should have happened but didn't.
        Look for un-executed files.

        NzNo data was collected.zno-data-collected)r   )r   r   r   warn_unimported_sourcer   r   collectionsdefaultdictrF  find_possibly_unexecuted_filesr   r   itemstouch_files)r   
file_paths	file_pathplugin_namerP  s        rK   r_  zCoverage._post_save_work  s    z%%%}((( ' 	3M00222 z 	Kd0 	KJJ/6IJJJJ !,T22
&*m&R&R&T&T 	6 	6"I{)))44I{#**95555","2"2"4"4 	7 	7KJ""5+6666	7 	7rU   morfr>   -tuple[str, list[TLineNo], list[TLineNo], str]c                D    |                      |          \  }}}}}||||fS )z:Like `analysis2` but doesn't return excluded line numbers.)	analysis2)r   rj  fs_mmfs          rK   analysiszCoverage.analysis  s+    --1aB!Q{rU   <tuple[str, list[TLineNo], list[TLineNo], list[TLineNo], str]c                    |                      |          }|j        t          |j                  t          |j                  t          |j                  |                                fS )aG  Analyze a module.

        `morf` is a module or a file name.  It will be analyzed to determine
        its coverage statistics.  The return value is a 5-tuple:

        * The file name for the module.
        * A list of line numbers of executable statements.
        * A list of line numbers of excluded statements.
        * A list of line numbers of statements not run (missing from
          execution).
        * A readable formatted string of the missing line numbers.

        The analysis uses the source file itself and the current measured
        coverage data.

        )_analyzer   sorted
statementsexcludedmissingmissing_formattedr   rj  rs  s      rK   rm  zCoverage.analysis2  s^    ( ==&&8&''8$%%8#$$&&((
 	
rU   rO  )maxsizer5   c                   |                                   |                                  |                                 }|                     |          }|                     |j                  }t          || j        j        ||          S )z+Analyze a module or file.  Private for now.)	r   r   rI  _get_file_reporterr   r   r6   rG   	precision)r   rj  rJ  file_reporterr   s        rK   rv  zCoverage._analyze  sq     	

}}//55$$]%;<<*41FW_```rU   dict[TLineNo, tuple[int, int]]c                T    |                      |          }|                                S )zGet branch statistics about a module.

        `morf` is a module or a file name.

        Returns a dict mapping line numbers to a tuple:
        (total_exits, taken_exits).

        .. versionadded:: 7.7

        )rv  branch_statsr|  s      rK   r  zCoverage.branch_stats  s'     ==&&$$&&&rU   r/   c                   | j         J d}d}t          |t                    r|                     |          }| j                             |          }|r[| j                            |          }|r?|                    |          }|(t          d	                    |j
        |                    |dk    rt          ||           }t          |t                    sJ |S )z-Get a FileReporter for a module or file name.Npythonz5Plugin {!r} did not provide a file reporter for {!r}.)r   rz   r   r   file_tracerr   getr  r    r  r   r2   r/   )r   rj  r   r  mapped_morfri  s         rK   r  zCoverage._get_file_reporter  s     z%%%,4dC   	++D11K*00==K 
**;77 $*$8$8$E$EM$,)SZZ & <d    H$$.tT::M-66666rU   morfsIterable[TMorf] | None list[tuple[FileReporter, TMorf]]c                      j         J |s j                                         }t          |t          t          t
          f          s|g} fd|D             S )a  Get FileReporters for a list of modules or file names.

        For each module or file name in `morfs`, find a FileReporter.  Return
        a list pairing FileReporters with the morfs.

        If `morfs` is a single module or file name, this returns a list of one
        FileReporter.  If `morfs` is empty or None, then the list of all files
        measured is used to find the FileReporters.

        Nc                >    g | ]}                     |          |fS rF   )r  )r   rj  r   s     rK   
<listcomp>z0Coverage._get_file_reporters.<locals>.<listcomp>  s,    HHH$((..5HHHrU   )r   measured_filesrz   rF  tupler   )r   r  s   ` rK   _get_file_reporterszCoverage._get_file_reporters  sj     z%%% 	0J--//E %$s!344 	GEHHHH%HHHHrU   c                    | j         j        r_t          | j        | j        d          }| j        3|                    | j        |                                 j                   || _        dS dS )zARe-map data before reporting, to get implicit "combine" behavior.T)rs   ri   r  N)map_path)	rG   rP  r   r   r   r   updaterU  map)r   mapped_datas     rK   _prepare_data_for_reportingz$Coverage._prepare_data_for_reporting  so    ; 	%&DJdkSWXXXKz%""4:8J8J8L8L8P"QQQ$DJJJ		% 	%rU   show_missingignore_errorsfileIO[str] | Nonestr | list[str] | Noneskip_coveredcontextslist[str] | None
skip_emptyr  
int | Nonesortoutput_formatfloatc                    |                                   t          | |||||||	|
||          5  t          |           }|                    ||          cddd           S # 1 swxY w Y   dS )a  Write a textual summary report to `file`.

        Each module in `morfs` is listed, with counts of statements, executed
        statements, missing statements, and a list of lines missed.

        If `show_missing` is true, then details of which lines or branches are
        missing will be included in the report.  If `ignore_errors` is true,
        then a failure while reporting a single file will not stop the entire
        report.

        `file` is a file-like object, suitable for writing.

        `output_format` determines the format, either "text" (the default),
        "markdown", or "total".

        `include` is a list of file name patterns.  Files that match will be
        included in the report. Files matching `omit` will not be included in
        the report.

        If `skip_covered` is true, don't report on files with 100% coverage.

        If `skip_empty` is true, don't report on empty files (those that have
        no statements).

        `contexts` is a list of regular expression strings.  Only data from
        :ref:`dynamic contexts <dynamic_contexts>` that match one of those
        expressions (using :func:`re.search <python:re.search>`) will be
        included in the report.

        `precision` is the number of digits to display after the decimal
        point for percentages.

        All of the arguments default to the settings read from the
        :ref:`configuration file <config>`.

        Returns a float, the total percentage covered.

        .. versionadded:: 4.0
            The `skip_covered` parameter.

        .. versionadded:: 5.0
            The `contexts` and `skip_empty` parameters.

        .. versionadded:: 5.2
            The `precision` parameter.

        .. versionadded:: 7.0
            The `format` parameter.

        )
r  rw   rx   r  r  report_contextsr  r  r  r  )outfileN)r  rL   r3   report)r   r  r  r  r  rf   rh   r  r  r  r  r  r  reporters                 rK   r  zCoverage.report  s    B 	((***'"%%$! 
 
 
 	8 	8 't,,H??5$?77	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   &A""A&)A&	directoryc                    |                                   t          | ||||          5  t          |           }|                    ||           ddd           dS # 1 swxY w Y   dS )az  Annotate a list of modules.

        Each module in `morfs` is annotated.  The source is written to a new
        file, named with a ",cover" suffix, with each line prefixed with a
        marker to indicate the coverage of the line.  Covered lines have ">",
        excluded lines have "-", and missing lines have "!".

        See :meth:`report` for other arguments.

        )r  rw   rx   r  )r  N)r  rL   r   r  )r   r  r  r  rf   rh   r  r  s           rK   annotatezCoverage.annotateh  s    & 	((***'"$
 
 
 	8 	8 (--HOOEYO777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   'AA!$A!	extra_csstitleshow_contextsc                    |                                   t          | ||||||||	|
||          5  t          |           }|                    |          }|cddd           S # 1 swxY w Y   dS )aE  Generate an HTML report.

        The HTML is written to `directory`.  The file "index.html" is the
        overview starting point, with links to more detailed pages for
        individual modules.

        `extra_css` is a path to a file of other CSS to apply on the page.
        It will be copied into the HTML directory.

        `title` is a text string (not HTML) to use as the title of the HTML
        report.

        See :meth:`report` for other arguments.

        Returns a float, the total percentage covered.

        .. note::

            The HTML report files are generated incrementally based on the
            source files and coverage results. If you modify the report files,
            the changes will not be considered.  You should be careful about
            changing the files in the report folder.

        )r  rw   rx   html_dirr  
html_titlehtml_skip_coveredr  r  html_skip_emptyr  N)r  rL   r%   r  )r   r  r  r  rf   rh   r  r  r  r  r  r  r  r  rets                  rK   html_reportzCoverage.html_report  s    N 	((***'"*'$&
 
 
 	 	 $D))H//%((C!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   &A##A'*A'r  c           	         |                                   t          | ||||||          5  t          | j        j        t          |           || j                  cddd           S # 1 swxY w Y   dS )ab  Generate an XML report of coverage results.

        The report is compatible with Cobertura reports.

        Each module in `morfs` is included in the report.  `outfile` is the
        path to write the file to, "-" will write to stdout.

        See :meth:`report` for other arguments.

        Returns a float, the total percentage covered.

        )r  rw   rx   
xml_outputr  r  N)r  rL   r4   rG   r  r?   r   )r   r  r  r  rf   rh   r  r  s           rK   
xml_reportzCoverage.xml_report  s    , 	((***'"$!
 
 
 		b 		b !!7T9J9JESWS`aa		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		b 		bs   .A&&A*-A*pretty_printc	           
         |                                   t          | |||||||          5  t          | j        j        t          |           || j                  cddd           S # 1 swxY w Y   dS )a  Generate a JSON report of coverage results.

        Each module in `morfs` is included in the report.  `outfile` is the
        path to write the file to, "-" will write to stdout.

        `pretty_print` is a boolean, whether to pretty-print the JSON output or not.

        See :meth:`report` for other arguments.

        Returns a float, the total percentage covered.

        .. versionadded:: 5.0

        )r  rw   rx   json_outputr  json_pretty_printjson_show_contextsN)r  rL   r4   rG   r  r'   r   )	r   r  r  r  rf   rh   r  r  r  s	            rK   json_reportzCoverage.json_report  s    2 	((***'"$*,	
 	
 	
 
	d 
	d !!8,t:L:LeUYUbcc
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	d 
	ds   .A''A+.A+c                    |                                   t          | |||||          5  t          | j        j        t          |           || j                  cddd           S # 1 swxY w Y   dS )a  Generate an LCOV report of coverage results.

        Each module in `morfs` is included in the report. `outfile` is the
        path to write the file to, "-" will write to stdout.

        See :meth:`report` for other arguments.

        .. versionadded:: 6.3
        )r  rw   rx   lcov_outputr  N)r  rL   r4   rG   r  r(   r   )r   r  r  r  rf   rh   r  s          rK   lcov_reportzCoverage.lcov_report  s    $ 	((***'"$
 
 
 	d 	d !!8,t:L:LeUYUbcc	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	ds   .A%%A),A)Iterable[tuple[str, Any]]c                 ~   ddl }|                                  |                                  d+d}d|j        fd	|j        fd
| j        | j                                        ndfdt          r
dt           ndfd || j        j	                  fd || j        j
                  fd || j        j                  fd| j        j        fd| j        j        fd| j        j        fd| j        j        rt#          | j        j                  ndfd| j        | j                                        ndfdt(          j                            dd          fdt/          j                    fdt/          j                    fdt/          j                    fd t5          t(          dd                       fd t(          j        fd!t)          j                    fd"t)          j                    fd#t=          j                    fd$t=          j                     fd%t(          j!        fd&d' tE          t<          j#                  D             fd(d)$                    t5          t(          d*dg                    fg}| j%        ,|&                    | j%        '                                           |&                    tQ          j'                               |S ),zAReturn a list of (key, value) pairs showing internal information.r   Nro   	list[Any]rC   rD  c                d    g }| D ]*}|j         }|j        s|dz  }|                    |           +|S )z7Make an entry for the sys_info from a list of plug-ins.z (disabled))r   r
  r   )ro   entriesr   entrys       rK   plugin_infoz&Coverage.sys_info.<locals>.plugin_info-  sM    G! & &4/ +]*Eu%%%%NrU   coverage_versioncoverage_moduler   z-none-CTracerzavailable from unavailablezplugins.file_tracerszplugins.configurerszplugins.context_switchersconfigs_attemptedconfigs_readr`   config_contentsrV   r  
 platformimplementationbuildgil_enabled_is_gil_enabledc                     dS )NTrF   rF   rU   rK   <lambda>z#Coverage.sys_info.<locals>.<lambda>J  s    D rU   
executabledef_encodingfs_encodingr   cwdr   environmentc                "    g | ]\  }}| d | S )z = rF   )r   kvs      rK   r  z%Coverage.sys_info.<locals>.<listcomp>Q  s&    ___da\\a\\___rU   command_line argv)ro   r  rC   rD  ))coverager   r   __version____file__r   r	  r   r   r  r   r  rG   config_files_attemptedconfig_files_readr`   _config_contentsreprr   data_filenamer   versionreplacer  python_implementationpython_buildr>  r  getdefaultencodinggetfilesystemencodingr{   r   getcwdr   r   environr  r   r  r   r   )r   covmodr  r   s       rK   r   zCoverage.sys_info%  s    	"!!!

	 	 	 	  !340do6QT_00222W_`L[8,888m\#[[1K%L%LM"KK0I$J$JK(++dm6U*V*VW $+"DET[:;DK346:k6R`T[1222X` 
8N$*22444T\]s{**4445*,,-x=??@h+--.IGC):LLIIKKL3>*S3556C5778BIKK BIKK SX__6RSUS]6^6^___`SXXgc6H:&F&FGGH7
< =$KK..00111L)++,,,rU   rC   rP   )&rV   rW   rX   rY   rZ   r[   r\   r]   r^   r[   r_   r[   r`   ra   rb   rc   rd   rc   re   rc   rf   rg   rh   rg   ri   rc   rj   rg   rk   r]   rl   rm   rn   r]   ro   rp   rC   rq   rC   rq   )r   r   r   r   rC   r<   )r   r   r   r   rC   r]   )NF)r   r   r   rm   r   r]   rC   rq   )r   r   rC   rq   )r   r   rC   r   )r   r   r   r   rC   rq   )r   rY   rC   rq   )rC   rD   )r  )r'  r   rC   rq   )r*  r   r+  r,  rC   rq   )r1  r   rC   rq   )r4  )r5  r   rC   rq   )r<  r   r5  r   rC   rq   )r5  r   rC   r   )r5  r   rC   rD  )rC   r!   )NFF)rV  rc   rW  r]   rX  r]   rC   rq   )rC   r   )rj  r>   rC   rk  )rj  r>   rC   rt  )rj  r>   rC   r5   )rj  r>   rC   r  )rj  r>   rC   r/   r   )r  r  rC   r  )NNNNNNNNNNNN)r  r  r  r[   r  r[   r  r  rf   r  rh   r  r  r[   r  r  r  r[   r  r  r  rm   r  rm   rC   r  )NNNNNN)r  r  r  rm   r  r[   rf   r  rh   r  r  r  rC   rq   )r  r  r  rm   r  r[   rf   r  rh   r  r  rm   r  rm   r  r[   r  r[   r  r  r  r[   r  r  rC   r  )NNNNNNN)r  r  r  rm   r  r[   rf   r  rh   r  r  r  r  r[   rC   r  )NNNNNNNN)r  r  r  rm   r  r[   rf   r  rh   r  r  r  r  r[   r  r[   rC   r  )r  r  r  rm   r  r[   rf   r  rh   r  r  r  rC   r  )rC   r  )9__name__
__module____qualname____doc__rO   __annotations__classmethodrT   DEFAULT_DATAFILEr   r   r   r   r   r   r   r   r   r   r   r  r   r!  r$  
contextlibcontextmanagerr&  r  r  r0  r3  r;  r4  r9  rC  rG  r)  rU  r[  rI  r_  rs  rm  	functools	lru_cacherv  r  r  r  r  r  r  r  r  r  r  r   rF   rU   rK   rA   rA   N   s}         8 "$J####   [ 5E)-#'!"'+'+,0,0+/.2&*26"'"8<'M/ M/ M/ M/ M/^+H +H +H +HZ	S 	S 	S 	S? ? ? ?0
 
 
 
   "* * * * *6   
3 3 3 3$3 3 3 3@   _ _ _ _B   $% $% $% $%L    
 
 
 
    - - - -' ' ' '"4 4 4 4,$ $ $ $ $$ $ $ $ $(! ! ! !' ' ' 'F F F F F   

 
 
 
 ,0	,
 ,
 ,
 ,
 ,
\   27 7 7 7:   

 
 
 
: Y###a a a $#a' ' ' ' Y###   $#: )-I I I I I0% % % % )-$(%)#'+*.$(%)"& $$(P8 P8 P8 P8 P8h )- $%)'+*.%)8 8 8 8 8@ )- $%)'+*. $ $(%)%)"& $8 8 8 8 8x )-"%)'+*.%)"& b  b  b  b  bH )-"%)'+*.%)$(%)$d $d $d $d $dP )-"%)'+*.%)d d d d d:5 5 5 5 5 5rU   COVERAGE_DEBUG_CALLS)decorate_methods
show_callsT)	show_argsrI  )butnotrP   c                     t          j        d          } | sdS t          t          d          rdS t	          |           }|t          _        d|_        d|_        d|_        d|_	        |
                                 |S )a  Call this at Python start-up to perhaps measure coverage.

    If the environment variable COVERAGE_PROCESS_START is defined, coverage
    measurement is started.  The value of the variable is the config file
    to use.

    There are two ways to configure your Python installation to invoke this
    function when Python starts:

    #. Create or append to sitecustomize.py to add these lines::

        import coverage
        coverage.process_startup()

    #. Create a .pth file in your Python installation containing::

        import coverage; coverage.process_startup()

    Returns the :class:`Coverage` instance that was started, or None if it was
    not started by this call.

    COVERAGE_PROCESS_STARTNr  )r`   FT)r{   getenvhasattrprocess_startuprA   r  r   r   r   r   r!  )cpsr@   s     rK   r  r  h  s    . ),
-
-C t 
++  t
s
#
#
#C"OC"'C#(C CNIIKKKJrU   rq   c                 H    t          t          dd          } | 	d| _        dS dS )z7Stop any subprocess auto-measurement from writing data.r  NF)r>  r  r   )auto_created_coverages    rK   r   r     s1    #OZFF(+0((( )(rU   )r@   rA   rB   r:   rC   rD   r  r  )rr  
__future__r   r  rb  r   r  r{   os.pathr  r  r   r  r   r   typesr   typingr   r   r   r   r	   collections.abcr
   r   r  r   coverage.annotater   coverage.collectorr   coverage.configr   r   coverage.contextr   r   coverage.corer   r   coverage.datar   r   coverage.debugr   r   r   r   r   coverage.dispositionr   coverage.exceptionsr   r   r   r    coverage.filesr!   r"   r#   r$   coverage.htmlr%   coverage.inoroutr&   coverage.jsonreportr'   coverage.lcovreportr(   coverage.miscr)   r*   r+   r,   r-   coverage.multiprocr.   coverage.pluginr/   coverage.plugin_supportr0   r1   coverage.pythonr2   coverage.reportr3   coverage.report_corer4   coverage.resultsr5   r6   coverage.typesr7   r8   r9   r:   r;   r<   r=   r>   coverage.xmlreportr?   r  rL   r  _DEFAULT_DATAFILErA   r   r  r  r  r  r   rF   rU   rK   <module>r/     s   - , " " " " " "              				    



             1 1 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . .       . . . . . . ( ( ( ( ( ( @ @ @ @ @ @ @ @ Z Z Z Z Z Z Z Z , , , , , , , , = = = = = = = =              7 6 6 6 6 6 \ \ \ \ \ \ \ \ \ \ \ \ [ [ [ [ [ [ [ [ [ [ [ [ & & & & & & $ $ $ $ $ $ , , , , , , , , , , , , 2 2 2 2 2 2 2 2 K K K K K K K K K K 4 4 4 4 4 4 ( ( ( ( ( ( : : : : : : : : . . . . . . + + + + + + . . . . . . B B B B B B B B                    + * * * * *^B% % % %  <	** $ L L L L L} L L Lb( 3yry'++,, ;;;;;;;;
T"""|    H2 2 2 2j1 1 1 1 1 1rU   