ó â\e[c@@smddlmZddlZddlZddlZddlmZeje ƒZ de fd„ƒYZ dS(i(tabsolute_importN(trmtreet TempDirectorycB@sMeZdZdddd„Zd„Zd„Zd„Zd„Zd„Z RS( s'Helper 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 or None delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: create() Creates a temporary directory and stores its path in the path attribute. cleanup() Deletes the temporary directory and sets path attribute to None When used as a context manager, a temporary directory is created on entering the context and, if the delete attribute is True, on exiting the context the created directory is deleted. ttempcC@sStt|ƒjƒ|dkr4|dkr4t}n||_||_||_dS(N(tsuperRt__init__tNonetTruetpathtdeletetkind(tselfRR R ((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyR%s    cC@sdj|jj|jƒS(Ns <{} {!r}>(tformatt __class__t__name__R(R ((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyt__repr__1scC@s|jƒ|S(N(tcreate(R ((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyt __enter__4s cC@s|jr|jƒndS(N(R tcleanup(R texctvaluettb((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyt__exit__8s cC@sv|jdk r,tjdj|jƒƒdStjjtjddj|j ƒƒƒ|_tjdj|jƒƒdS(sFCreate a temporary directory and store it's path in self.path s+Skipped creation of temporary directory: {}Ntprefixspip-{}-sCreated temporary directory: {}( RRtloggertdebugR tostrealpathttempfiletmkdtempR (R ((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyR<s $cC@sA|jdk r4tjj|jƒr4t|jƒnd|_dS(s?Remove the temporary directory created and reset state N(RRRtexistsR(R ((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyRMs$N( Rt __module__t__doc__RRRRRRR(((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyR s    ( t __future__Rtloggingtos.pathRRtpip._internal.utils.miscRt getLoggerRRtobjectR(((s;/tmp/pip-install-0xiv62/pip/pip/_internal/utils/temp_dir.pyts