Skip to content

Commit

Permalink
Remove unused RequirementSet.require_hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrahunt committed Sep 22, 2019
1 parent 6e530d5 commit a47803f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ def populate_requirement_set(
use_pep517=options.use_pep517):
req_to_add.is_direct = True
requirement_set.add_requirement(req_to_add)
# If --require-hashes was a line in a requirements file, tell
# RequirementSet about it:
requirement_set.require_hashes = options.require_hashes

if not (args or options.editables or options.requirements):
opts = {'name': self.name}
Expand Down
4 changes: 1 addition & 3 deletions src/pip/_internal/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ def run(self, options, args):
options.build_dir, delete=build_delete, kind="download"
) as directory:

requirement_set = RequirementSet(
require_hashes=options.require_hashes,
)
requirement_set = RequirementSet()
self.populate_requirement_set(
requirement_set,
args,
Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ def run(self, options, args):
options.build_dir, delete=build_delete, kind="install"
) as directory:
requirement_set = RequirementSet(
require_hashes=options.require_hashes,
check_supported_wheels=not options.target_dir,
)

Expand Down
4 changes: 1 addition & 3 deletions src/pip/_internal/commands/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def run(self, options, args):
options.build_dir, delete=build_delete, kind="wheel"
) as directory:

requirement_set = RequirementSet(
require_hashes=options.require_hashes,
)
requirement_set = RequirementSet()

try:
self.populate_requirement_set(
Expand Down
5 changes: 2 additions & 3 deletions src/pip/_internal/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@

class RequirementSet(object):

def __init__(self, require_hashes=False, check_supported_wheels=True):
# type: (bool, bool) -> None
def __init__(self, check_supported_wheels=True):
# type: (bool) -> None
"""Create a RequirementSet.
"""

self.requirements = OrderedDict() # type: Dict[str, InstallRequirement] # noqa: E501
self.require_hashes = require_hashes
self.check_supported_wheels = check_supported_wheels

self.unnamed_requirements = [] # type: List[InstallRequirement]
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/test_req.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_missing_hash_with_require_hashes(self, data):
"""Setting --require-hashes explicitly should raise errors if hashes
are missing.
"""
reqset = RequirementSet(require_hashes=True)
reqset = RequirementSet()
reqset.add_requirement(get_processed_req_from_line(
'simple==1.0', lineno=1
))
Expand All @@ -194,7 +194,7 @@ def test_missing_hash_with_require_hashes_in_reqs_file(self, data, tmpdir):
"""--require-hashes in a requirements file should make its way to the
RequirementSet.
"""
req_set = RequirementSet(require_hashes=False)
req_set = RequirementSet()
finder = make_test_finder(find_links=[data.find_links])
session = finder._link_collector.session
command = create_command('install')
Expand All @@ -203,7 +203,7 @@ def test_missing_hash_with_require_hashes_in_reqs_file(self, data, tmpdir):
command.populate_requirement_set(
req_set, args, options, finder, session, wheel_cache=None,
)
assert req_set.require_hashes
assert options.require_hashes

def test_unsupported_hashes(self, data):
"""VCS and dir links should raise errors when --require-hashes is
Expand All @@ -213,7 +213,7 @@ def test_unsupported_hashes(self, data):
should trump the presence or absence of a hash.
"""
reqset = RequirementSet(require_hashes=True)
reqset = RequirementSet()
reqset.add_requirement(get_processed_req_from_line(
'git+git://github.com/pypa/pip-test-package --hash=sha256:123',
lineno=1,
Expand Down Expand Up @@ -272,7 +272,7 @@ def test_hash_mismatch(self, data):
"""A hash mismatch should raise an error."""
file_url = path_to_url(
(data.packages / 'simple-1.0.tar.gz').abspath)
reqset = RequirementSet(require_hashes=True)
reqset = RequirementSet()
reqset.add_requirement(get_processed_req_from_line(
'%s --hash=sha256:badbad' % file_url, lineno=1,
))
Expand Down

0 comments on commit a47803f

Please sign in to comment.