§
    o¬¸j{,  ã                  óh  — d Z ddlmZ ddlmZ ddlZddlZddlmZ ddl	Z	ddl
mZ ddlZddlmZ ddlmZ dd	lmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*  e*e+e,e-f                  ¦   «         Z.ed         Z/eej0         G d„ d¦  «        ¦   «         ¦   «         Z1d=d!„Z2d>d%„Z3d?d(„Z4 e!d)¬*¦  «        d@d-„¦   «         Z5dAd0„Z6e!dBd3„¦   «         Z7dCd6„Z8 ed7d7¬8¦  «        dDd<„¦   «         Z9dS )Ez>Support for providing temporary directories to test functions.é    )Úannotations)Ú	GeneratorN)ÚPath)Úrmtree)ÚAny)Úfinal)ÚLiteralé   )Úcleanup_dead_symlinks)ÚLOCK_TIMEOUT)Úmake_numbered_dir)Úmake_numbered_dir_with_cleanup)Úrm_rf)Úget_user_id)ÚConfig)ÚExitCode)Úhookimpl)ÚParser)Úcheck_ispytest)Úfixture)ÚFixtureRequest)ÚMonkeyPatch)ÚItem)Ú
TestReport)ÚStashKey©ÚallÚfailedÚnonec                  ó�   — e Zd ZU dZded<   ded<   ded<   ded<   d	ed
<   	 d"ddœd#d„Zeddœd$d„¦   «         Zd%d„Zd&d'd „Z	d(d!„Z
dS ))ÚTempPathFactoryz“Factory for temporary directories under the common base temp directory,
    as discussed at :ref:`temporary directory location and retention`.
    úPath | NoneÚ_given_basetempr   Ú_traceÚ	_basetempÚintÚ_retention_countÚRetentionTypeÚ_retention_policyNF©Ú	_ispytestÚgiven_basetempÚretention_countÚretention_policyÚbasetempr+   ÚboolÚreturnÚNonec               óì   — t          |¦  «         |€d | _        n>t          t          j                             t          |¦  «        ¦  «        ¦  «        | _        || _        || _        || _	        || _
        d S ©N)r   r#   r   ÚosÚpathÚabspathÚstrr$   r'   r)   r%   )Úselfr,   r-   r.   Útracer/   r+   s          ú^/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/_pytest/tmpdir.pyÚ__init__zTempPathFactory.__init__6   sm   € õ 	�yÑ!Ô!Ð!ØÐ!Ø#'ˆDÔ Ð õ
 $(­¬¯ª½¸NÑ8KÔ8KÑ(LÔ(LÑ#MÔ#MˆDÔ ØˆŒØ /ˆÔØ!1ˆÔØ!ˆŒˆˆó    Úconfigr   c               óR  — t          |¦  «         t          |                     d¦  «        ¦  «        }|dk     rt          d|› d�¦  «        ‚|                     d¦  «        }|dvrt          d|› d�¦  «        ‚ | |j        j        |j                             d¦  «        ||d	¬
¦  «        S )zTCreate a factory according to pytest configuration.

        :meta private:
        Útmp_path_retention_countr   z6tmp_path_retention_count must be >= 0. Current input: ú.Útmp_path_retention_policyr   zKtmp_path_retention_policy must be either all, failed, none. Current input: ÚtmpdirT)r,   r:   r-   r.   r+   )r   r&   ÚgetiniÚ
ValueErrorÚoptionr/   r:   Úget)Úclsr>   r+   ÚcountÚpolicys        r;   Úfrom_configzTempPathFactory.from_configM   sÕ   € õ 	�yÑ!Ô!Ð!Ý�F—M’MÐ"<Ñ=Ô=Ñ>Ô>ˆØ�1Š9ˆ9ÝØQÈÐQÐQÐQñô ð ð —’Ð:Ñ;Ô;ˆØÐ2Ð2Ð2ÝØgÐ^dÐgÐgÐgñô ð ð ˆsØ!œ=Ô1Ø”,×"Ò" 8Ñ,Ô,Ø!Ø#Øð
ñ 
ô 
ð 	
r=   Úbasenamer8   c                óð   — t           j                             |¦  «        }|                      ¦   «         |z                       ¦   «         j        |                      ¦   «         k    rt          |› d�¦  «        ‚|S )Nz& is not a normalized and relative path)r5   r6   ÚnormpathÚgetbasetempÚresolveÚparentrE   )r9   rL   s     r;   Ú_ensure_relative_to_basetempz,TempPathFactory._ensure_relative_to_basetempm   sj   € Ý”7×#Ò# HÑ-Ô-ˆØ×ÒÑÔ Ñ)×2Ò2Ñ4Ô4Ô;¸t×?OÒ?OÑ?QÔ?QÒQÐQÝ ÐPÐPÐPÑQÔQÐQØˆr=   TÚnumberedr   c                ó$  — |                       |¦  «        }|s>|                      ¦   «                              |¦  «        }|                     d¬¦  «         n:t	          |                      ¦   «         |d¬¦  «        }|                      d|¦  «         |S )a  Create a new temporary directory managed by the factory.

        :param basename:
            Directory base name, must be a relative path.

        :param numbered:
            If ``True``, ensure the directory is unique by adding a numbered
            suffix greater than any existing one: ``basename="foo-"`` and ``numbered=True``
            means that this function will create directories named ``"foo-0"``,
            ``"foo-1"``, ``"foo-2"`` and so on.

        :returns:
            The path to the new directory.
        éÀ  ©Úmode)ÚrootÚprefixrW   Úmktemp)rR   rO   ÚjoinpathÚmkdirr   r$   )r9   rL   rS   Úps       r;   rZ   zTempPathFactory.mktemps   s�   € ð ×4Ò4°XÑ>Ô>ˆØð 	%Ø× Ò Ñ"Ô"×+Ò+¨HÑ5Ô5ˆAØ�GŠG˜ˆGÑÔÐÐå! t×'7Ò'7Ñ'9Ô'9À(ÐQVÐWÑWÔWˆAØ�KŠK˜ !Ñ$Ô$Ð$Øˆr=   c                ó  — | j         �| j         S | j        �V| j        }|                     ¦   «         rt          |¦  «         |                     d¬¦  «         |                     ¦   «         }�njt          j                             d¦  «        }t          |pt          j        ¦   «         ¦  «                             ¦   «         }t          ¦   «         pd}|                     d|› �¦  «        }	 |                     dd¬¦  «         n<# t          $ r/ |                     d	¦  «        }|                     dd¬¦  «         Y nw xY wt          ¦   «         }|�]|                     ¦   «         }|j        |k    rt          d
|› d�¦  «        ‚|j        dz  dk    rt          j        ||j        dz  ¦  «         | j        }| j        dk    rd}t-          d||t.          d¬¦  «        }|€
J |¦   «         ‚|| _         |                      d|¦  «         |S )z�Return the base temporary directory, creating it if needed.

        :returns:
            The base temporary directory.
        NrU   rV   ÚPYTEST_DEBUG_TEMPROOTÚunknownz
pytest-of-T)rW   Úexist_okzpytest-of-unknownzThe temporary directory z: is not owned by the current user. Fix this and try again.é?   r   iÀÿÿÿr   zpytest-)rY   rX   ÚkeepÚlock_timeoutrW   znew basetemp)r%   r#   Úexistsr   r\   rP   r5   ÚenvironrG   r   ÚtempfileÚ
gettempdirÚget_userr[   ÚOSErrorr   ÚstatÚst_uidÚst_modeÚchmodr'   r)   r   r   r$   )	r9   r/   Úfrom_envÚtemprootÚuserÚrootdirÚuidÚrootdir_statrc   s	            r;   rO   zTempPathFactory.getbasetemp‹   s/  € ð Œ>Ð%Ø”>Ð!àÔÐ+ØÔ+ˆHØ�ŠÑ Ô ð  Ý�h‘”�Ø�NŠN ˆNÑ&Ô&Ð&Ø×'Ò'Ñ)Ô)ˆH‰Hå”z—~’~Ð&=Ñ>Ô>ˆHÝ˜HÐ=­Ô(;Ñ(=Ô(=Ñ>Ô>×FÒFÑHÔHˆHÝ‘:”:Ð* ˆDð ×'Ò'Ð(;°TÐ(;Ð(;Ñ<Ô<ˆGð9Ø—’ 5°4�Ñ8Ô8Ð8Ð8øÝð 9ð 9ð 9à"×+Ò+Ð,?Ñ@Ô@�Ø—’ 5°4�Ñ8Ô8Ð8Ð8Ð8ð9øøøõ ‘-”-ˆCØˆØ&Ÿ|š|™~œ~�ØÔ&¨#Ò-Ð-Ý!ð2°7ð 2ð 2ð 2ñô ð ð !Ô(¨5Ñ0°QÒ6Ð6Ý”H˜W lÔ&:¸VÑ&CÑDÔDÐDØÔ(ˆDØÔ%¨Ò/Ð/Ø�Ý5Ø ØØÝ)Øðñ ô ˆHð Ð#Ð# XÑ#Ô#Ð#Ø!ˆŒØ�Š�N HÑ-Ô-Ð-Øˆs   Ã(D  Ä 6D9Ä8D9r4   )r,   r"   r-   r&   r.   r(   r/   r"   r+   r0   r1   r2   )r>   r   r+   r0   r1   r!   )rL   r8   r1   r8   )T)rL   r8   rS   r0   r1   r   )r1   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r<   ÚclassmethodrK   rR   rZ   rO   © r=   r;   r!   r!   (   sø   € € € € € € ðð ð !Ð Ð Ñ à€K€K�KØÐÐÑØÐÐÑØ$Ð$Ð$Ñ$ð !%ð"ð  ð"ð "ð "ð "ð "ð "ð. ð
  ð	
ð 
ð 
ð 
ð 
ñ „[ð
ð>ð ð ð ðð ð ð ð ð09ð 9ð 9ð 9ð 9ð 9r=   r!   r1   ú
str | Nonec                 óp   — 	 ddl } |                      ¦   «         S # t          t          t          f$ r Y dS w xY w)zlReturn the current user name, or None if getuser() does not work
    in the current environment (see #1010).r   N)ÚgetpassÚgetuserÚImportErrorrj   ÚKeyError)r~   s    r;   ri   ri   Ç   sI   € ðàˆˆˆà�ŠÑ Ô Ð øÝ�¥(Ð+ð ð ð Øˆtˆtðøøøs   ‚ š5´5r>   r   r2   c                óÀ   — t          ¦   «         }|                      |j        ¦  «         t                               | d¬¦  «        }|                     | d|d¬¦  «         dS )a  Create a TempPathFactory and attach it to the config object.

    This is to comply with existing plugins which expect the handler to be
    available at pytest_configure time, but ideally should be moved entirely
    to the tmp_path_factory session fixture.
    Tr*   Ú_tmp_path_factoryF)ÚraisingN)r   Úadd_cleanupÚundor!   rK   Úsetattr)r>   Úmprƒ   s      r;   Úpytest_configurer‰   Ó   s^   € õ 
‰Œ€BØ
×Ò�r”wÑÔÐÝ'×3Ò3°FÀdÐ3ÑKÔKÐØ‡J‚JˆvÐ*Ð,=Àu€JÑMÔMÐMÐMÐMr=   Úparserr   c                ój   — |                       dddd¬¦  «         |                       dddd¬	¦  «         d S )
Nr@   zfHow many sessions should we keep the `tmp_path` directories, according to `tmp_path_retention_policy`.Ú3Ústring)ÚhelpÚdefaultÚtyperB   zvControls which directories created by the `tmp_path` fixture are kept around, based on test outcome. (all/failed/none)r   )rŽ   r�   r�   )Úaddini)rŠ   s    r;   Úpytest_addoptionr’   à   s^   € Ø
‡M‚MØ"ØuØàð ñ ô ð ð ‡M‚MØ#ðàØð ñ ô ð ð ð r=   Úsession)ÚscopeÚrequestr   c                ó   — | j         j        S )zGReturn a :class:`pytest.TempPathFactory` instance for the test session.)r>   rƒ   )r•   s    r;   Útmp_path_factoryr—   ò   s   € ð Œ>Ô+Ð+r=   Úfactoryr   c                óŒ   — | j         j        }t          j        dd|¦  «        }d}|d |…         }|                     |d¬¦  «        S )Nz[\W]Ú_é   T)rS   )ÚnodeÚnameÚreÚsubrZ   )r•   r˜   r�   ÚMAXVALs       r;   Ú_mk_tmpr¡   ù   sG   € ØŒ<Ô€DÝŒ6�'˜3 Ñ%Ô%€DØ€FØ���Œ=€DØ�>Š>˜$¨ˆ>Ñ.Ô.Ð.r=   r—   úGenerator[Path]c              #  óì   K  — t          | |¦  «        }|V — |j        }| j        j        t                   }|dk    r'|                     dd¦  «        rt          |d¬¦  «         | j        j        t          = dS )a;  Return a temporary directory (as :class:`pathlib.Path` object)
    which is unique to each test function invocation.
    The temporary directory is created as a subdirectory
    of the base temporary directory, with configurable retention,
    as discussed in :ref:`temporary directory location and retention`.
    r   ÚcallT©Úignore_errorsN)r¡   r)   rœ   ÚstashÚtmppath_result_keyrG   r   )r•   r—   r6   rJ   Úresult_dicts        r;   Útmp_pathrª     s‚   è è € õ �7Ð,Ñ-Ô-€DØ
€J€J€Jð Ô/€FØ”,Ô$Õ%7Ô8€Kà�ÒÐ˜kŸošo¨f°dÑ;Ô;Ðõ 	ˆt 4Ð(Ñ(Ô(Ð(àŒÔÕ-Ð.Ð.Ð.r=   Ú
exitstatusúint | ExitCodec                óü   — | j         j        }|j        }|€dS |j        }|dk    r2|dk    r,|j        €%|                     ¦   «         rt          |d¬¦  «         |                     ¦   «         rt          |¦  «         dS dS )z�After each session, remove base directory if all the tests passed,
    the policy is "failed", and the basetemp is not specified by a user.
    Nr   r   Tr¥   )r>   rƒ   r%   r)   r#   Úis_dirr   r   )r“   r«   r—   r/   rJ   s        r;   Úpytest_sessionfinishr¯     s    € ð )0¬Ô(HÐØÔ)€HØÐØˆàÔ/€Fà�aŠˆØ�hÒÐØÔ,Ð4à�?Š?ÑÔð 	1õ �8¨4Ð0Ñ0Ô0Ð0ð ‡‚ÑÔð (Ý˜hÑ'Ô'Ð'Ð'Ð'ð(ð (r=   T)ÚwrapperÚtryfirstÚitemr   ú'Generator[None, TestReport, TestReport]c              #  ó‚   K  — d V —}|j         €J ‚i }|j        | j                             t          |¦  «        |j         <   |S r4   )ÚwhenÚpassedr§   Ú
setdefaultr¨   )r²   r¤   ÚrepÚemptys       r;   Úpytest_runtest_makereportrº   3  sJ   è è € ð ˆ%ˆ%€CØŒ8ÐÐÐØ€EØADÄ€D„J×ÒÕ,¨eÑ4Ô4°S´XÑ>Ø€Jr=   )r1   r|   )r>   r   r1   r2   )rŠ   r   r1   r2   )r•   r   r1   r!   )r•   r   r˜   r!   r1   r   )r•   r   r—   r!   r1   r¢   )r«   r¬   )r²   r   r1   r³   ):rx   Ú
__future__r   Úcollections.abcr   Údataclassesr5   Úpathlibr   rž   Úshutilr   rg   Útypingr   r   r	   r   r   r   r   r   Ú_pytest.compatr   Ú_pytest.configr   r   r   Ú_pytest.config.argparsingr   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   r   Ú_pytest.monkeypatchr   Ú_pytest.nodesr   Ú_pytest.reportsr   Ú_pytest.stashr   Údictr8   r0   r¨   r(   Ú	dataclassr!   ri   r‰   r’   r—   r¡   rª   r¯   rº   r{   r=   r;   ú<module>rÌ      sE  ðà DÐ Dà "Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø !Ð !Ð !Ð !Ð !Ð !Ø &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø !Ð !Ð !Ð !Ð !Ð !Ø #Ð #Ð #Ð #Ð #Ð #Ø #Ð #Ð #Ð #Ð #Ð #Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -Ø $Ð $Ð $Ð $Ð $Ð $Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ø "Ð "Ð "Ð "Ð "Ð "ð /�X˜d 3¨ 9œoÔ.Ñ0Ô0Ð ØÐ/Ô0€ð ØÔðZð Zð Zð Zð Zñ Zô Zñ Ôñ „ðZðz	ð 	ð 	ð 	ð
Nð 
Nð 
Nð 
Nðð ð ð ð$ 	€ˆyÐÑÔð,ð ,ð ,ñ Ôð,ð/ð /ð /ð /ð 	ð/ð /ð /ñ 	„ð/ð0(ð (ð (ð (ð2 
€�$ Ð&Ñ&Ô&ðð ð ñ 'Ô&ðð ð r=   