a  ze@sddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeeZedddZedd d d Zdaed d ZGdddZdaeddZGdddZeZGdddZGdddeZ dS)N) ExitStackcontextmanager)AnyDictIteratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDccsJt0}t|}azdVW|an|a0Wdn1s<0YdSN)r_tempdir_manager)stackold_tempdir_managerr^/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managers  rc@s(eZdZdZddZddZddZdS) TempDirectoryTypeRegistryzManages temp directory behaviorcCs i|_dSr_should_deleteselfrrr__init__+sz"TempDirectoryTypeRegistry.__init__cCs||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)rkindvaluerrr set_delete/sz$TempDirectoryTypeRegistry.set_deletecCs|j|dS)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)rget)rrrrr get_delete6sz$TempDirectoryTypeRegistry.get_deleteN)__name__ __module__ __qualname____doc__rr!r#rrrrr(srccs$t}taztVW|an|a0dS)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)_tempdir_registryr)old_tempdir_registryrrrtempdir_registryAs r*c@s eZdZdS)_DefaultN)r$r%r&rrrrr+Psr+cs^eZdZdZdeddffdd ZeddZd d Zd d Z d dZ ddZ ddZ Z S)r aMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. NtempFcslt|tur$|dur d}nd}|dur6||}||_d|_||_||_|rhtdus^Jt |dS)NF) superr_default_create_path_deleteddeleterr enter_context)rpathr2rglobally_managed __class__rrrls   zTempDirectory.__init__cCs|jrJd|j|jS)Nz"Attempted to access deleted path: )r1r0rrrrr4szTempDirectory.pathcCsd|jjd|jdS)N< >)r7r$r4rrrr__repr__szTempDirectory.__repr__cCs|Srrrrrr __enter__szTempDirectory.__enter__cCs8|jdur|j}ntr$t|j}nd}|r4|dS)NT)r2r(r#rcleanup)rexcr tbr2rrr__exit__s zTempDirectory.__exit__cCs,tjtjd|dd}td||S)zs2     d