Ë
    oPêj{-  ã                  óB  — 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­ ddlmZ dd	lmZ i Zd
ed<   d(d„Z  e e«      Z G d„ d«      Z!ejD                  d)d„«       Z#d*d„Z$d+d„Z%d,d„Z&d-d„Z'd.d„Z(d-d„Z) G d„ d«      Z*d/d„Z+ G d„ d«      Z,d0d„Z- ed«      Z.d1d„Z/d2d„Z0d3d4d„Z1ejd                  d5d „«       Z3d6d!„Z4 ed"ee   ¬#«      Z5	 d7	 	 	 	 	 d8d$„Z6d9d:d%„Z7d;d&„Z8d<d'„Z9y)=z$Miscellaneous stuff for coverage.py.é    )ÚannotationsN)ÚIterableÚIteratorÚMappingÚSequence)Ú
ModuleType)ÚAnyÚNoReturnÚTypeVar)Ú*)ÚCoverageException)ÚTArczdict[ModuleType, ModuleType]ÚISOLATED_MODULESc                ó  — | t         vrvt        j                  | j                  «      }|t         | <   t	        | «      D ]@  }t        | |«      }t        |t        j                  «      rt        |«      }t        |||«       ŒB t         |    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)ÚmodÚnew_modÚnameÚvalues       úR/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/coverage/misc.pyr   r   #   s~   € ð Ô"Ñ"Ü×"Ñ" 3§<¡<Ó0ˆØ 'Ô˜ÑÜ˜“Hò 	*ˆDÜ˜C Ó&ˆEÜ˜%¤×!1Ñ!1Ô2Ü& uÓ-�Ü�G˜T 5Õ)ð		*ô
 ˜CÑ Ð ó    c                  ó    — e Zd ZdZdd„Zdd„Zy)ÚSysModuleSaverzASaves the contents of sys.modules, and removes new modules later.c                ó@   — t        t        j                  «      | _        y ©N©ÚsetÚsysÚmodulesÚold_modules©Úselfs    r   Ú__init__zSysModuleSaver.__init__<   s   € ÜœsŸ{™{Ó+ˆÕr   c                ó€   — t        t        j                  «      | j                  z
  }|D ]  }t        j                  |= Œ y)z6Remove any modules imported since this object started.Nr"   )r(   Únew_modulesÚms      r   ÚrestorezSysModuleSaver.restore?   s5   € äœ#Ÿ+™+Ó&¨×)9Ñ)9Ñ9ˆØò 	ˆAÜ—‘˜A‘ñ	r   N©ÚreturnÚNone)r   Ú
__module__Ú__qualname__Ú__doc__r)   r-   © r   r   r   r   9   s   „ ÙKó,ôr   r   c               #  ót   K  — t        «       } 	 d–— | j                  «        y# | j                  «        w xY w­w)z@A context manager to remove any modules imported during a block.N)r   r-   )Úsavers    r   Úsys_modules_savedr7   F   s*   è ø€ ô Ó€EðÛà�‰�øˆ�‰�üs   ‚8Ž# ’8£5µ8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   )ÚpairÚstartÚends      r   Ú	nice_pairr=   P   s-   € ð �J€Eˆ3Ø�‚|Ø�Ðà�˜˜#˜ÐÐr   c                ó   — | €yt        | «      S )z"Return bool(b), but preserve None.N)Úbool)Úbs    r   Úbool_or_nonerA   ^   s   € à€yØä�A‹wˆr   c                ón   — t        | «      } t        | «      dk(  r| d   S dj                  d„ | D «       «      S )zDCombine a series of regex strings into one that matches any of them.é   r   ú|c              3  ó(   K  — | ]
  }d |› d�–— Œ y­w)z(?:ú)Nr4   )Ú.0Úrs     r   ú	<genexpr>zjoin_regex.<locals>.<genexpr>l   s   è ø€ Ò4 q˜#˜a˜S œ
Ñ4ùs   ‚)ÚlistÚlenÚjoin)Úregexess    r   Ú
join_regexrN   f   s6   € ä�7‹m€GÜ
ˆ7ƒ|�qÒØ�q‰zÐà�x‰xÑ4¨GÔ4Ó4Ð4r   c                ó˜   — 	 t        j                  | «       y# t        $ r(}|j                  t        j                  k7  r‚ Y d}~y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)ÚpathÚes     r   Úfile_be_gonerW   o   s:   € ðÜ
�	‰	�$�øÜò Ø�7‰7”e—l‘lÒ"Øô #ûðús   ‚ ˜	A	¡AÁA	c                ó8   — | rt        j                  | d¬«       yy)zVMake sure the directory exists.

    If `directory` is None or empty, do nothing.
    T)Úexist_okN)rP   Úmakedirs)Ú	directorys    r   Ú
ensure_dirr\   x   s   € ñ
 Ü
�‰�I¨Ö-ð r   c                óT   — t        t        j                  j                  | «      «       y)z,Make sure the directory for the path exists.N)r\   rP   rU   Údirname)rU   s    r   Úensure_dir_for_filer_   �   s   € äŒr�w‰w�‰˜tÓ$Õ%r   c                  ó0   — e Zd ZdZdd„Zdd„Zd	d„Zd
d„Zy)ÚHasherz&Hashes Python data for fingerprinting.c                ó<   — t        j                  dd¬«      | _        y )NÚsha3_256F)Úusedforsecurity)ÚhashlibÚnewÚhashr'   s    r   r)   zHasher.__init__‰   s   € Ü—K‘K 
¸EÔBˆ�	r   c                óJ  — | j                   j                  t        t        |«      «      j	                  d«      «       |x€ �nFxt        d˜ x�d\    | j                   j                  t        |«      › d�j	                  «       «       | j                   j                  |j	                  d«      «       �nØ xt        d˜ x�U\    | j                   j                  t        |«      › d�j	                  «       «       | j                   j                  |«       �nx xxt        d˜ x�\   n xt        d˜ x�\   n  n7  | j                   j                  t        |«      j	                  d«      «       �n!xxt        d˜ x�\   n xt        d˜ x�\   n  n  |D ]  }| j                  |«       Œ nçxt        d˜ x�G\    t        |j                  «       «      D ]'  \  }}| j                  |«       | j                  |«       Œ) n– t        d˜ x�$\   t        |«      D ]  }| j                  |«       Œ nh 	 t        |«      D ]X  }|j!                  d«      rŒt#        ||«      }t%        j&                  |«      rŒ7| j                  |«       | j                  |«       ŒZ | j                   j                  d«       y)z+Add `v` to the hash, recursively if needed.zutf-8Nr4   ú:Ú__ó   .)rg   ÚupdateÚstrÚtypeÚencoderK   ÚbytesÚintÚfloatÚtuplerJ   ÚdictÚsortedÚitemsr#   r   Ú
startswithr   ÚinspectÚ	isroutine)r(   ÚvrV   ÚkÚkvÚas         r   rl   zHasher.updateŒ   sö  € à�	‰	×ÑœœT !›W›×,Ñ,¨WÓ5Ô6ØÚÙØ”–Ø—	‘	× Ñ ¤C¨£F 8¨1 ×!4Ñ!4Ó!6Ô7Ø—	‘	× Ñ  §¡¨'Ó!2Ö3ð ð ”–Ø—	‘	× Ñ ¤C¨£F 8¨1 ×!4Ñ!4Ó!6Ô7Ø—	‘	× Ñ  Ö#ð ð !�”—˜œŸ“Ø—	‘	× Ñ ¤ Q£§¡¨wÓ!7Ö8Ø!�”—˜6œ4Ÿ6Ó!Øò #�AØ—K‘K •Nñ#à”–Ü# A§G¡G£IÓ.ò $‘E�A�rØ—K‘K ”NØ—K‘K •Oñ$ð ô •Ü ›ò #�AØ—K‘K •Nñ#ð ð Ü˜Q›ò #�AØ—|‘| DÔ)Ø Ü  1›�AÜ×(Ñ(¨Ô+Ø Ø—K‘K ”NØ—K‘K •Nð#ð 	�	‰	×Ñ˜Õr   c                ó6   — | j                   j                  «       S )z'Get the full binary digest of the hash.)rg   Údigestr'   s    r   r   zHasher.digest¯   s   € à�y‰y×ÑÓ!Ð!r   c                ó<   — | j                   j                  «       dd S )z*Retrieve a 32-char hex digest of the hash.Né    )rg   Ú	hexdigestr'   s    r   r‚   zHasher.hexdigest³   s   € à�y‰y×"Ñ"Ó$ S bÐ)Ð)r   Nr.   )rz   r	   r/   r0   )r/   rp   ©r/   rm   )r   r1   r2   r3   r)   rl   r   r‚   r4   r   r   ra   ra   †   s   „ Ù0óCó!óF"ô*r   ra   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)ÚthatÚ	func_nameÚthingr   Úklasss        r   Ú_needs_to_implementr‘   ¸   sk   € äˆtÐ,Ô-ØˆØ×)Ñ)‰àˆØ—‘ˆØ×"Ñ"Ð# 1 U§^¡^Ð$4Ð5ˆä
Øˆ'��4�(Ð.¨y¨k¸Ð<óð r   c                  ó    — e Zd ZdZdd„Zdd„Zy)Ú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.

    c                ó   — || _         y r!   ©Ú
display_as)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–   rm   r/   r0   rƒ   )r   r1   r2   r3   r)   r˜   r4   r   r   r“   r“   Ç   s   „ ñó%ôr   r“   c                óR   ‡ ‡‡— 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Úword2c                óš   •— t        d„  | j                  ‰Ž D «       «      }|dk(  ry|‰v r‰|   S | d   rd|› d‰›�}t        |«      ‚| d   S )zCalled for each $replacement.c              3  ó&   K  — | ]	  }|sŒ|–— Œ y ­wr!   r4   )rG   Úgs     r   rI   z?substitute_variables.<locals>.dollar_replace.<locals>.<genexpr>ú   s   è ø€ Ò@˜!ºa”AÑ@ùs   ‚Šú$Ústrictz	Variable z is undefined: Údefval)ÚnextÚgroupr   )ÚmatchÚwordÚmsgÚdollar_groupsÚtextÚ	variabless      €€€r   Údollar_replacez,substitute_variables.<locals>.dollar_replace÷   sj   ø€ ô Ñ@˜{˜uŸ{™{¨MÐ:Ô@Ó@ˆØ�3Š;ØØ�YÑØ˜T‘?Ð"Ø�8Š_Ø˜d˜V ?°4°(Ð;ˆCÜ# CÓ(Ð(à˜‘?Ð"r   )r¥   zre.Match[str]r/   rm   )ÚreÚsub)r©   rª   Údollar_patternr«   r¨   s   ``  @r   Úsubstitute_variablesr¯   Ö   s/   ú€ ð €Nð 1€M÷#ô �6‰6�. .°$Ó7€DØ€Kr   ÚTc                ó*   — t        t        | «      «      S )z(Return the first value from an iterable.)r£   Úiter)Úits    r   Úfirstr´     s   € ä”�R“‹>Ðr   c                ó@   — | j                  «       j                  d«      S )z:Return a string with local timezone representing the date.z%Y-%m-%d %H:%M %z)Ú
astimezoneÚstrftime)Údts    r   Úformat_local_datetimer¹     s   € à�=‰=‹?×#Ñ#Ð$7Ó8Ð8r   c                ó  — |€| dz   }t         j                  j                  | |«      }|€J ‚t         j                  j                  |«      }|t        j
                  | <   |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.

    z.py)Ú	importlibÚutilÚspec_from_file_locationÚmodule_from_specr$   r%   ÚloaderÚexec_module)ÚmodnameÚmodfileÚspecr   s       r   Úimport_local_filerÄ     s}   € ð €Ø˜E‘/ˆÜ�>‰>×1Ñ1°'¸7ÓC€DØÐÐÐÜ
�.‰.×
)Ñ
)¨$Ó
/€CØ„C‡K�K�ÑØ�;‰;Ð"Ð"Ð"Ø‡K�K×Ñ˜CÔ à€Jr   c                ól   — dd„}t        j                  d| «      D �cg c]
  } ||«      ‘Œ c}| fS c c}w )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.
    c                ó<   — 	 t        | «      S # t        $ r | cY S w xY w)z6If `s` is a number, return an int, else `s` unchanged.)rq   Ú
ValueError)Úss    r   Útryintz_human_key.<locals>.tryint4  s$   € ð	Ü�q“6ˆMøÜò 	ØŠHð	ús   ‚
 �šz(\d+))rÈ   rm   r/   z	str | int)r¬   Úsplit)rÈ   rÉ   Úcs      r   Ú
_human_keyrÌ   *  s1   € óô !#§¡¨°1Ó 5Ö6˜1‰V�A�YÒ6¸Ð:Ð:ùÒ6s   �1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)ru   rÌ   )Ústringss    r   Úhuman_sortedrÐ   >  s   € ô �'œzÔ*Ð*r   ÚSortableItem)Úboundc                ó    — 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                ó,   — t        | d   «      g| dd  ¢­S )Nr   rC   )rÌ   )Úitems    r   ú<lambda>z$human_sorted_items.<locals>.<lambda>W  s   € ¬:°d¸1±gÓ+>Ð*JÀÀaÀbÀÑ*J€ r   )rÎ   Úreverse)ru   )rv   r×   s     r   Úhuman_sorted_itemsrØ   L  s   € ô �%ÑJÐT[Ô\Ð\r   c                ó2   — | dk(  r|}n	|xs |dz   }| › d|› �S )zZPluralize a word.

    If n is 1, return thing.  Otherwise return things, or thing+s.
    rC   rÈ   r‰   r4   )Únr�   ÚthingsÚnouns       r   ÚpluralrÝ   Z  s.   € ð
 	ˆA‚vØ‰àÒ&˜% #™+ˆØˆS��$�ˆ=Ðr   c                óV   — | j                  «       r| S dj                  d„ | D «       «      S )aÐ  Make `text` safe to put in a report.

    File names (and plugin names read from a data file) can contain control
    characters: they are legal in a POSIX path but unsafe in our output.  In a
    terminal they act as escape sequences (SGR colors, OSC title/clipboard
    sequences, cursor moves to forge output); in XML 1.0 they make the document
    non-well-formed.  Replace anything non-printable and leave ordinary text, so
    valid names are unchanged.
    Ú c              3  óD   K  — | ]  }|j                  «       r|nd –— Œ y­w)ú?N)Úisprintable)rG   Úchs     r   rI   z%neutralize_control.<locals>.<genexpr>r  s   è ø€ ÒB°r˜Ÿ™Ô)‘2¨sÓ2ÑBùs   ‚ )râ   rL   )r©   s    r   Úneutralize_controlrä   f  s*   € ð ×ÑÔØˆØ�7‰7ÑB¸TÔBÓBÐBr   c                óˆ   — t        t        j                  d«      r't        j                  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©   Úurls     r   Ústdout_linkrê   u  s;   € ô Œs�z‰z˜8Ô$¬¯©×):Ñ):Ô)<Ø˜#˜˜b   jÐ1Ð1àˆr   )r   r   r/   r   )r/   zIterator[None])r:   r   r/   rm   )r@   r	   r/   zbool | None)rM   úIterable[str]r/   rm   )rU   rm   r/   r0   )r[   rm   r/   r0   )r�   r	   rŽ   rm   r/   r
   )r©   rm   rª   zMapping[str, str]r/   rm   )r³   zIterable[T]r/   r°   )r¸   zdatetime.datetimer/   rm   r!   )rÁ   rm   rÂ   z
str | Noner/   r   )rÈ   rm   r/   ztuple[list[str | int], str])rÏ   rë   r/   z	list[str])F)rv   zIterable[SortableItem]r×   r?   r/   zlist[SortableItem])rß   rß   )rÚ   rq   r�   rm   rÛ   rm   r/   rm   )r©   rm   r/   rm   )r©   rm   ré   rm   r/   rm   ):r3   Ú
__future__r   Ú
contextlibÚdatetimerS   Ú	functoolsre   r»   Úimportlib.utilrx   rP   Úos.pathr¬   r$   r   Úcollections.abcr   r   r   r   r   Útypingr	   r
   r   Úcoverage.exceptionsr   Úcoverage.typesr   r   Ú__annotations__r   r   Úcontextmanagerr7   r=   rA   rN   rW   r\   r_   ra   r‘   r“   r¯   r°   r´   r¹   rÄ   ÚcacherÌ   rÐ   rÑ   rØ   rÝ   rä   rê   r4   r   r   ú<module>rù      sN  ðò +å "ã Û Û Û Û Û Û Û Û 	Û Û 	Û 
Û ß AÓ AÝ ß )Ñ )ô
 "Ý 1Ý à13Ð Ð.Ó 3ó!ñ& �BÓ€÷
ñ 
ð ×Ñòó ðó óó5óó.ó&÷
/*ñ /*ód÷ñ ó0ñf ˆCƒL€óó
9ô
ð( ‡�ò;ó ð;ó&+ñ �~¨X°c©]Ô;€ð
 ð]Ø!ð]àð]ð ó]ô	óCô	r   