Skip to content

Commit 8bfb6b5

Browse files
authored
Merge pull request #10346 from jdufresne/simplify-prepare
Simplify RequirementPreparer._downloaded data structure
2 parents 29121df + 61333f5 commit 8bfb6b5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

news/b356d29d-cc4a-4949-90b2-220361044a10.trivial.rst

Whitespace-only changes.

src/pip/_internal/operations/prepare.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import mimetypes
99
import os
1010
import shutil
11-
from typing import Dict, Iterable, List, Optional, Tuple
11+
from typing import Dict, Iterable, List, Optional
1212

1313
from pip._vendor.packaging.utils import canonicalize_name
1414
from pip._vendor.pkg_resources import Distribution
@@ -319,8 +319,8 @@ def __init__(
319319
# Should in-tree builds be used for local paths?
320320
self.in_tree_build = in_tree_build
321321

322-
# Memoized downloaded files, as mapping of url: (path, mime type)
323-
self._downloaded: Dict[str, Tuple[str, str]] = {}
322+
# Memoized downloaded files, as mapping of url: path.
323+
self._downloaded: Dict[str, str] = {}
324324

325325
# Previous "header" printed for a link-based InstallRequirement
326326
self._previous_requirement_header = ("", "")
@@ -487,7 +487,7 @@ def prepare_linked_requirement(
487487

488488
if file_path is not None:
489489
# The file is already available, so mark it as downloaded
490-
self._downloaded[req.link.url] = file_path, None
490+
self._downloaded[req.link.url] = file_path
491491
else:
492492
# The file is not available, attempt to fetch only metadata
493493
wheel_dist = self._fetch_metadata_using_lazy_wheel(link)
@@ -509,7 +509,7 @@ def prepare_linked_requirements_more(
509509
hashes = self._get_linked_req_hashes(req)
510510
file_path = _check_download_dir(req.link, self.download_dir, hashes)
511511
if file_path is not None:
512-
self._downloaded[req.link.url] = file_path, None
512+
self._downloaded[req.link.url] = file_path
513513
req.needs_more_preparation = False
514514

515515
# Prepare requirements we found were already downloaded for some
@@ -550,10 +550,10 @@ def _prepare_linked_requirement(
550550
'error {} for URL {}'.format(req, exc, link)
551551
)
552552
else:
553-
file_path, content_type = self._downloaded[link.url]
553+
file_path = self._downloaded[link.url]
554554
if hashes:
555555
hashes.check_against_path(file_path)
556-
local_file = File(file_path, content_type)
556+
local_file = File(file_path, content_type=None)
557557

558558
# For use in later processing,
559559
# preserve the file path on the requirement.

0 commit comments

Comments
 (0)