§
    0›jh-  ã                  ó<  — U 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ZddlmZmZmZmZ ddlmZ ddlmZmZmZ ddlT ddlmZ dd	lmZ i Zd
ed<   dQd„Z  e e¦  «        Z G d„ d¦  «        Z!ej"        dRd„¦   «         Z#dSd„Z$dTd„Z%dUd„Z&dVd!„Z'dWd$„Z(dXd&„Z)dWd'„Z* G d(„ d)¦  «        Z+dYd-„Z, G d.„ d/¦  «        Z-dZd3„Z.d[d6„Z/d\d]d9„Z0ej1        d^d<„¦   «         Z2d_d?„Z3 ed@ee         ¬A¦  «        Z4	 d`dadH„Z5dbdcdN„Z6dddP„Z7dS )ez$Miscellaneous stuff for coverage.py.é    )ÚannotationsN)ÚIterableÚIteratorÚMappingÚSequence)Ú
ModuleType)ÚAnyÚNoReturnÚTypeVar)Ú*)ÚCoverageException)ÚTArczdict[ModuleType, ModuleType]ÚISOLATED_MODULESÚmodr   Úreturnc                ó,  — | t           vrt          j        | j        ¦  «        }|t           | <   t	          | ¦  «        D ]L}t          | |¦  «        }t          |t          j        ¦  «        rt          |¦  «        }t          |||¦  «         ŒMt           |          S )aJ  Copy a module so that we are isolated from aggressive mocking.

    If a test suite mocks os.path.exists (for example), and then we need to use
    it during the test, everything will get tangled up if we use their mock.
    Making a copy of the module when we import it will isolate coverage.py from
    those complications.
    )	r   Útypesr   Ú__name__ÚdirÚgetattrÚ
isinstanceÚisolate_moduleÚsetattr)r   Únew_modÚnameÚvalues       úL/home/lighthouse/health/venv/lib64/python3.11/site-packages/coverage/misc.pyr   r   #   s“   € ð Õ"Ð"Ð"ÝÔ" 3¤<Ñ0Ô0ˆØ 'Õ˜ÑÝ˜‘H”Hð 	*ð 	*ˆDÝ˜C Ñ&Ô&ˆEÝ˜%¥Ô!1Ñ2Ô2ð .Ý& uÑ-Ô-�Ý�G˜T 5Ñ)Ô)Ð)Ð)Ý˜CÔ Ð ó    c                  ó"   — e Zd ZdZdd„Zdd„ZdS )ÚSysModuleSaverzASaves the contents of sys.modules, and removes new modules later.r   ÚNonec                óB   — t          t          j        ¦  «        | _        d S ©N©ÚsetÚsysÚmodulesÚold_modules©Úselfs    r   Ú__init__zSysModuleSaver.__init__<   s   € Ý�sœ{Ñ+Ô+ˆÔÐÐr   c                ól   — t          t          j        ¦  «        | j        z
  }|D ]}t          j        |= ŒdS )z6Remove any modules imported since this object started.Nr$   )r*   Únew_modulesÚms      r   ÚrestorezSysModuleSaver.restore?   s=   € å�#œ+Ñ&Ô&¨Ô)9Ñ9ˆØð 	ð 	ˆAÝ”˜A��ð	ð 	r   N©r   r!   )r   Ú
__module__Ú__qualname__Ú__doc__r+   r/   © r   r   r    r    9   sB   € € € € € ØKÐKð,ð ,ð ,ð ,ðð ð ð ð ð r   r    úIterator[None]c               #  óŠ   K  — t          ¦   «         } 	 dV — |                      ¦   «          dS # |                      ¦   «          w xY w)z@A context manager to remove any modules imported during a block.N)r    r/   )Úsavers    r   Úsys_modules_savedr8   F   sD   è è € õ ÑÔ€EðØˆˆˆà�Š‰Œˆˆˆøˆ�Š‰Œˆˆøøøs	   ’, ¬AÚmodnameÚstrútuple[ModuleType, bool]c                óÊ   — t          ¦   «         5  	 t          j        | ¦  «        dfcddd¦  «         S # t          $ r t          dfcY cddd¦  «         S w xY w# 1 swxY w Y   dS )aü  Import a third-party module we need, but might not be installed.

    This also cleans out the module after the import, so that coverage won't
    appear to have imported it.  This lets the third party use coverage for
    their own tests.

    Arguments:
        modname (str): the name of the module to import.

    Returns:
        The imported module, and a boolean indicating if the module could be imported.

    If the boolean is False, the module returned is not the one you want: don't use it.

    TNF)r8   Ú	importlibÚimport_moduleÚImportErrorr&   )r9   s    r   Úimport_third_partyr@   P   sÞ   € õ  
Ñ	Ô	ð ð ð	ÝÔ*¨7Ñ3Ô3°TÐ9ðð ð ð ñ ô ð ð øõ ð 	ð 	ð 	Ý˜�:ÐÐð	ð ð ð ñ ô ð ð ð	øøøðð ð ð øøøð ð ð ð ð ð s,   �A‘3³AÁAÁAÁAÁAÁAÚpairr   c                ó,   — | \  }}||k    r|› S |› d|› �S )zÂMake a nice string representation of a pair of numbers.

    If the numbers are equal, just return the number, otherwise return the pair
    with a dash between them, indicating the range.

    ú-r4   )rA   ÚstartÚends      r   Ú	nice_pairrF   g   s2   € ð �J€Eˆ3Ø�‚|€|ØˆzÐàÐÐ˜#ÐÐÐr   Úbr	   úbool | Nonec                ó(   — | €dS t          | ¦  «        S )z"Return bool(b), but preserve None.N)Úbool)rG   s    r   Úbool_or_nonerK   u   s   € à€yØˆtå�A‰wŒwˆr   ÚregexesúIterable[str]c                ó”   — t          | ¦  «        } t          | ¦  «        dk    r| d         S d                     d„ | D ¦   «         ¦  «        S )zDCombine a series of regex strings into one that matches any of them.é   r   ú|c              3  ó"   K  — | ]
}d |› d�V — ŒdS )z(?:ú)Nr4   )Ú.0Úrs     r   ú	<genexpr>zjoin_regex.<locals>.<genexpr>ƒ   s*   è è € Ð4Ð4 q˜
˜a˜
˜
˜
Ð4Ð4Ð4Ð4Ð4Ð4r   )ÚlistÚlenÚjoin)rL   s    r   Ú
join_regexrY   }   sI   € å�7‰mŒm€GÝ
ˆ7�|„|�qÒÐØ�qŒzÐà�xŠxÐ4Ð4¨GÐ4Ñ4Ô4Ñ4Ô4Ð4r   Úpathr!   c                óŒ   — 	 t          j        | ¦  «         dS # t          $ r!}|j        t          j        k    r‚ Y d}~dS d}~ww xY w)z9Remove a file, and don't get annoyed if it doesn't exist.N)ÚosÚremoveÚOSErrorÚerrnoÚENOENT)rZ   Úes     r   Úfile_be_gonerb   †   s]   € ðÝ
Œ	�$‰ŒˆˆˆøÝð ð ð ØŒ7•e”lÒ"Ð"Øð #Ð"Ð"Ð"Ð"Ð"øøøøðøøøs   ‚ ˜
A¢>¾AÚ	directoryc                ó:   — | rt          j        | d¬¦  «         dS dS )zVMake sure the directory exists.

    If `directory` is None or empty, do nothing.
    T)Úexist_okN)r\   Úmakedirs)rc   s    r   Ú
ensure_dirrg   �   s1   € ð
 ð .Ý
Œ�I¨Ð-Ñ-Ô-Ð-Ð-Ð-ð.ð .r   c                ó^   — t          t          j                             | ¦  «        ¦  «         dS )z,Make sure the directory for the path exists.N)rg   r\   rZ   Údirname)rZ   s    r   Úensure_dir_for_filerj   ˜   s$   € å�rŒw�Š˜tÑ$Ô$Ñ%Ô%Ð%Ð%Ð%r   c                  ó2   — e Zd ZdZdd„Zdd„Zdd	„Zdd„ZdS )ÚHasherz&Hashes Python data for fingerprinting.r   r!   c                ó<   — t          j        dd¬¦  «        | _        d S )NÚsha3_256F)Úusedforsecurity)ÚhashlibÚnewÚhashr)   s    r   r+   zHasher.__init__    s   € Ý”K 
¸EÐBÑBÔBˆŒ	ˆ	ˆ	r   Úvr	   c                óî  — | j                              t          t          |¦  «        ¦  «                             d¦  «        ¦  «         |x€ �n�xt          d˜ x�n\    | j                              t          |¦  «        › d�                     ¦   «         ¦  «         | j                              |                     d¦  «        ¦  «         �n xt          d˜ x�[\    | j                              t          |¦  «        › d�                     ¦   «         ¦  «         | j                              |¦  «         �n­ xxt          d˜ x�\   n xt          d˜ x�\   n  n>  | j                              t          |¦  «                             d¦  «        ¦  «         �nMxxt          d˜ x�\   n xt          d˜ x�\   n  n  |D ]}|                      |¦  «         Œ�nxt          d˜ x�U\    t          |                     ¦   «         ¦  «        D ]/\  }}|                      |¦  «         |                      |¦  «         Œ0n® t          d˜ x�*\   t          |¦  «        D ]}|                      |¦  «         Œny 	 t          |¦  «        D ]g}|                     d¦  «        rŒt#          ||¦  «        }t%          j        |¦  «        rŒ=|                      |¦  «         |                      |¦  «         Œh| j                              d¦  «         dS )z+Add `v` to the hash, recursively if needed.zutf-8Nr4   ú:Ú__ó   .)rr   Úupdater:   ÚtypeÚencoderW   ÚbytesÚintÚfloatÚtuplerV   ÚdictÚsortedÚitemsr%   r   Ú
startswithr   ÚinspectÚ	isroutine)r*   rs   ra   ÚkÚkvÚas         r   rx   zHasher.update£   sä  € àŒ	×Ò��T !™WœW™œ×,Ò,¨WÑ5Ô5Ñ6Ô6Ð6ØØ��ÙØ•����‘�Ø”	× Ò ¥C¨¡F¤F   ×!4Ò!4Ñ!6Ô!6Ñ7Ô7Ð7Ø”	× Ò  §¢¨'Ñ!2Ô!2Ñ3Ô3Ð3Ñ3ð ð •����‘�Ø”	× Ò ¥C¨¡F¤F   ×!4Ò!4Ñ!6Ô!6Ñ7Ô7Ð7Ø”	× Ò  Ñ#Ô#Ð#Ñ#ð ð !�•����‘��˜�˜˜˜˜™˜˜˜˜˜˜Ø”	× Ò ¥ Q¡¤§¢¨wÑ!7Ô!7Ñ8Ô8Ð8Ñ8Ø!�•����‘��˜6�4˜6˜6˜6˜6™6˜6˜6˜6˜6˜6˜6Øð #ð #�AØ—K’K ‘N”N�N�Nñ#à•����‘�Ý# A§G¢G¡I¤IÑ.Ô.ð $ð $‘E�A�rØ—K’K ‘N”N�NØ—K’K ‘O”O�O�Oð$ð õ ����‘Ý ™œð #ð #�AØ—K’K ‘N”N�N�Nð#ð ð Ý˜Q™œð #ð #�AØ—|’| DÑ)Ô)ð !Ø Ý  1™œ�AÝÔ(¨Ñ+Ô+ð !Ø Ø—K’K ‘N”N�NØ—K’K ‘N”N�N�NØŒ	×Ò˜ÑÔÐÐÐr   r{   c                ó4   — | j                              ¦   «         S )z'Get the full binary digest of the hash.)rr   Údigestr)   s    r   r‰   zHasher.digestÆ   s   € àŒy×ÒÑ!Ô!Ð!r   r:   c                óD   — | j                              ¦   «         dd…         S )z*Retrieve a 32-char hex digest of the hash.Né    )rr   Ú	hexdigestr)   s    r   rŒ   zHasher.hexdigestÊ   s   € àŒy×"Ò"Ñ$Ô$ S b SÔ)Ð)r   Nr0   )rs   r	   r   r!   )r   r{   ©r   r:   )r   r1   r2   r3   r+   rx   r‰   rŒ   r4   r   r   rl   rl   �   so   € € € € € Ø0Ð0ðCð Cð Cð Cð!ð !ð !ð !ðF"ð "ð "ð "ð*ð *ð *ð *ð *ð *r   rl   ÚthatÚ	func_namer
   c                óš   — t          | d¦  «        r
d}| j        }nd}| j        }|j        › d|j        › �}t          |› d|›d|› d�¦  «        ‚)z7Helper to raise NotImplementedError in interface stubs.Ú_coverage_plugin_nameÚPluginÚClassú.ú z needs to implement z())Úhasattrr‘   Ú	__class__r1   r   ÚNotImplementedError)rŽ   r�   Úthingr   Úklasss        r   Ú_needs_to_implementr›   Ï   sv   € åˆtÐ,Ñ-Ô-ð 6ØˆØÔ)ˆˆàˆØ”ˆØÔ"Ð5Ð5 U¤^Ð5Ð5ˆå
ØÐ<Ð<�4Ð<Ð<¨yÐ<Ð<Ð<ñô ð r   c                  ó"   — e Zd ZdZd	d„Zd
d„ZdS )ÚDefaultValuez¦A sentinel object to use for unusual default-value needs.

    Construct with a string that will be used as the repr, for display in help
    and Sphinx output.

    Ú
display_asr:   r   r!   c                ó   — || _         d S r#   ©rž   )r*   rž   s     r   r+   zDefaultValue.__init__æ   s   € Ø$ˆŒˆˆr   c                ó   — | j         S r#   r    r)   s    r   Ú__repr__zDefaultValue.__repr__é   s
   € ØŒÐr   N)rž   r:   r   r!   r�   )r   r1   r2   r3   r+   r¢   r4   r   r   r�   r�   Þ   sF   € € € € € ðð ð%ð %ð %ð %ðð ð ð ð ð r   r�   ÚtextÚ	variablesúMapping[str, str]c                óP   ‡ ‡‡— d}dŠdˆˆ ˆfd„}t          j        ||‰ ¦  «        Š ‰ S )	aÎ  Substitute ``${VAR}`` variables in `text` with their values.

    Variables in the text can take a number of shell-inspired forms::

        $VAR
        ${VAR}
        ${VAR?}             strict: an error if VAR isn't defined.
        ${VAR-missing}      defaulted: "missing" if VAR isn't defined.
        $$                  just a dollar sign.

    `variables` is a dictionary of variable values.

    Returns the resulting text with values substituted.

    aV  (?x)   # Use extended regex syntax
        \$                      # A dollar sign,
        (?:                     # then
            (?P<dollar> \$ ) |      # a dollar sign, or
            (?P<word1> \w+ ) |      # a plain word, or
            \{                      # a {-wrapped
                (?P<word2> \w+ )        # word,
                (?:                         # either
                    (?P<strict> \? ) |      # with a strict marker
                    -(?P<defval> [^}]* )    # or a default value
                )?                      # maybe.
            }
        )
        )ÚdollarÚword1Úword2Úmatchúre.Match[str]r   r:   c                ó¼   •— t          d„  | j        ‰Ž D ¦   «         ¦  «        }|dk    rdS |‰v r‰|         S | d         rd|› d‰›�}t          |¦  «        ‚| d         S )zCalled for each $replacement.c              3  ó   K  — | ]}|¯|V — Œ	d S r#   r4   )rS   Úgs     r   rU   z?substitute_variables.<locals>.dollar_replace.<locals>.<genexpr>  s'   è è € Ð@Ð@˜!¸aÐ@�AÐ@Ð@Ð@Ð@Ð@Ð@r   ú$Ústrictz	Variable z is undefined: Údefval)ÚnextÚgroupr   )rª   ÚwordÚmsgÚdollar_groupsr£   r¤   s      €€€r   Údollar_replacez,substitute_variables.<locals>.dollar_replace  s†   ø€ õ Ð@Ð@˜{˜uœ{¨MÐ:Ð@Ñ@Ô@Ñ@Ô@ˆØ�3Š;ˆ;Ø�3Ø�YÐÐØ˜T”?Ð"Ø�8Œ_ð 	#Ø;˜dÐ;Ð;°4Ð;Ð;ˆCÝ# CÑ(Ô(Ð(à˜”?Ð"r   )rª   r«   r   r:   )ÚreÚsub)r£   r¤   Údollar_patternr·   r¶   s   ``  @r   Úsubstitute_variablesr»   í   sU   øøø€ ð €Nð 1€Mð#ð #ð #ð #ð #ð #ð #ð #õ Œ6�. .°$Ñ7Ô7€DØ€Kr   Údtúdatetime.datetimec                óP   — |                       ¦   «                              d¦  «        S )z:Return a string with local timezone representing the date.z%Y-%m-%d %H:%M %z)Ú
astimezoneÚstrftime)r¼   s    r   Úformat_local_datetimerÁ      s   € à�=Š=‰?Œ?×#Ò#Ð$7Ñ8Ô8Ð8r   Úmodfileú
str | Nonec                óþ   — |€| dz   }t           j                             | |¦  «        }|€J ‚t           j                             |¦  «        }|t          j        | <   |j        €J ‚|j                             |¦  «         |S )zìImport a local file as a module.

    Opens a file in the current directory named `modname`.py, imports it
    as `modname`, and returns the module object.  `modfile` is the file to
    import if it isn't in the current directory.

    Nz.py)r=   ÚutilÚspec_from_file_locationÚmodule_from_specr&   r'   ÚloaderÚexec_module)r9   rÂ   Úspecr   s       r   Úimport_local_filerË   %  s   € ð €Ø˜E‘/ˆÝŒ>×1Ò1°'¸7ÑCÔC€DØÐÐÐÝ
Œ.×
)Ò
)¨$Ñ
/Ô
/€CØ…C„K�ÑØŒ;Ð"Ð"Ð"Ø„K×Ò˜CÑ Ô Ð à€Jr   Úsútuple[list[str | int], str]c                óR   ‡— dd„Šˆfd„t          j        d| ¦  «        D ¦   «         | fS )	zïTurn a string into a list of string and number chunks.

    "z23a" -> (["z", 23, "a"], "z23a")

    The original string is appended as a last value to ensure the
    key is unique enough so that "x1y" and "x001y" can be distinguished.
    rÌ   r:   r   ú	str | intc                óF   — 	 t          | ¦  «        S # t          $ r | cY S w xY w)z6If `s` is a number, return an int, else `s` unchanged.)r|   Ú
ValueError)rÌ   s    r   Útryintz_human_key.<locals>.tryintC  s6   € ð	Ý�q‘6”6ˆMøÝð 	ð 	ð 	ØˆHˆHˆHð	øøøs   ‚ ‘ Ÿ c                ó&   •— g | ]} ‰|¦  «        ‘ŒS r4   r4   )rS   ÚcrÒ   s     €r   ú
<listcomp>z_human_key.<locals>.<listcomp>J  s!   ø€ Ð6Ð6Ð6˜1ˆVˆV�A‰YŒYÐ6Ð6Ð6r   z(\d+))rÌ   r:   r   rÏ   )r¸   Úsplit)rÌ   rÒ   s    @r   Ú
_human_keyr×   9  sD   ø€ ðð ð ð ð 7Ð6Ð6Ð6¥¤¨°1Ñ 5Ô 5Ð6Ñ6Ô6¸Ð:Ð:r   Ústringsú	list[str]c                ó.   — t          | t          ¬¦  «        S )z Sort the given iterable of strings the way that humans expect.

    Numeric components in the strings are sorted as numbers.

    Returns the sorted list.

    )Úkey)r€   r×   )rØ   s    r   Úhuman_sortedrÜ   M  s   € õ �'�zÐ*Ñ*Ô*Ð*r   ÚSortableItem)ÚboundFr�   úIterable[SortableItem]ÚreverserJ   úlist[SortableItem]c                ó(   — t          | d„ |¬¦  «        S )zòSort (string, ...) items the way humans expect.

    The elements of `items` can be any tuple/list. They'll be sorted by the
    first element (a string), with ties broken by the remaining elements.

    Returns the sorted list of items.
    c                óD   — t          | d         ¦  «        g| dd …         ¢R S )Nr   rO   )r×   )Úitems    r   ú<lambda>z$human_sorted_items.<locals>.<lambda>f  s%   € ­:°d¸1´gÑ+>Ô+>Ð*JÀÀaÀbÀbÄÐ*JÐ*J€ r   )rÛ   rà   )r€   )r�   rà   s     r   Úhuman_sorted_itemsræ   [  s   € õ �%ÐJÐJÐT[Ð\Ñ\Ô\Ð\r   Ú Únr|   r™   Úthingsc                ó0   — | dk    r|}n|p|dz   }| › d|› �S )zZPluralize a word.

    If n is 1, return thing.  Otherwise return things, or thing+s.
    rO   rÌ   r•   r4   )rè   r™   ré   Únouns       r   Úpluralrì   i  s2   € ð
 	ˆA‚v€vØˆˆàÐ&˜% #™+ˆØˆ=ˆ=�$ˆ=ˆ=Ðr   Úurlc                óˆ   — t          t          j        d¦  «        r't          j                             ¦   «         r	d|› d| › d�S | S )z�Format text+url as a clickable link for stdout.

    If attached to a terminal, use escape sequences. Otherwise, just return
    the text.
    Úisattyz]8;;úz]8;;)r–   r&   Ústdoutrï   )r£   rí   s     r   Ústdout_linkrò   u  sK   € õ �sŒz˜8Ñ$Ô$ð ­¬×):Ò):Ñ)<Ô)<ð Ø1˜#Ð1Ð1 Ð1Ð1Ð1Ð1àˆr   )r   r   r   r   )r   r5   )r9   r:   r   r;   )rA   r   r   r:   )rG   r	   r   rH   )rL   rM   r   r:   )rZ   r:   r   r!   )rc   r:   r   r!   )rŽ   r	   r�   r:   r   r
   )r£   r:   r¤   r¥   r   r:   )r¼   r½   r   r:   r#   )r9   r:   rÂ   rÃ   r   r   )rÌ   r:   r   rÍ   )rØ   rM   r   rÙ   )F)r�   rß   rà   rJ   r   rá   )rç   rç   )rè   r|   r™   r:   ré   r:   r   r:   )r£   r:   rí   r:   r   r:   )8r3   Ú
__future__r   Ú
contextlibÚdatetimer_   Ú	functoolsrp   r=   Úimportlib.utilrƒ   r\   Úos.pathr¸   r&   r   Úcollections.abcr   r   r   r   r   Útypingr	   r
   r   Úcoverage.exceptionsr   Úcoverage.typesr   r   Ú__annotations__r   r    Úcontextmanagerr8   r@   rF   rK   rY   rb   rg   rj   rl   r›   r�   r»   rÁ   rË   Úcacher×   rÜ   rÝ   ræ   rì   rò   r4   r   r   ú<module>r      s‰  ðð +Ð *Ð *à "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AØ Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )ð
 "Ð !Ð !Ð !Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø Ð Ð Ð Ð Ð à13Ð Ð 3Ð 3Ð 3Ñ 3ð!ð !ð !ð !ð& €^�BÑÔ€ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð Ôðð ð ñ Ôððð ð ð ð. ð  ð  ð  ðð ð ð ð5ð 5ð 5ð 5ðð ð ð ð.ð .ð .ð .ð&ð &ð &ð &ð
/*ð /*ð /*ð /*ð /*ñ /*ô /*ð /*ðdð ð ð ðð ð ð ð ñ ô ð ð0ð 0ð 0ð 0ðf9ð 9ð 9ð 9ð
ð ð ð ð ð( „ð;ð ;ð ;ñ „ð;ð&+ð +ð +ð +ð ˆw�~¨X°c¬]Ð;Ñ;Ô;€ð
 ð]ð ]ð ]ð ]ð ]ð	ð 	ð 	ð 	ð 	ð	ð 	ð 	ð 	ð 	ð 	r   