From 227b2d30a8675b44918f9d9ca89b24144a938215 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Mon, 5 Aug 2019 14:02:33 +0530 Subject: removing venv files --- .../pip/_internal/utils/temp_dir.py | 82 ---------------------- 1 file changed, 82 deletions(-) delete mode 100644 venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/temp_dir.py (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/temp_dir.py') diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/temp_dir.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/temp_dir.py deleted file mode 100644 index 25bc0d9..0000000 --- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/temp_dir.py +++ /dev/null @@ -1,82 +0,0 @@ -from __future__ import absolute_import - -import logging -import os.path -import tempfile - -from pip._internal.utils.misc import rmtree - -logger = logging.getLogger(__name__) - - -class TempDirectory(object): - """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. - """ - - def __init__(self, path=None, delete=None, kind="temp"): - super(TempDirectory, self).__init__() - - if path is None and delete is None: - # If we were not given an explicit directory, and we were not given - # an explicit delete option, then we'll default to deleting. - delete = True - - self.path = path - self.delete = delete - self.kind = kind - - def __repr__(self): - return "<{} {!r}>".format(self.__class__.__name__, self.path) - - def __enter__(self): - self.create() - return self - - def __exit__(self, exc, value, tb): - if self.delete: - self.cleanup() - - def create(self): - """Create a temporary directory and store it's path in self.path - """ - if self.path is not None: - logger.debug( - "Skipped creation of temporary directory: {}".format(self.path) - ) - return - # We realpath here because some systems have their default tmpdir - # symlinked to another directory. This tends to confuse build - # scripts, so we canonicalize the path by traversing potential - # symlinks here. - self.path = os.path.realpath( - tempfile.mkdtemp(prefix="pip-{}-".format(self.kind)) - ) - logger.debug("Created temporary directory: {}".format(self.path)) - - def cleanup(self): - """Remove the temporary directory created and reset state - """ - if self.path is not None and os.path.exists(self.path): - rmtree(self.path) - self.path = None -- cgit v1.2.3