Commit bad03ef931 introduced the new
link_hash attribute that holds the link's hash info, but that attribute
does the same thing as _hashes, and some existing usages still populate
that old attribute. Since the plural variant covers more use cases (a
file can be hashed with multiple algorithms), we restore the old logic
that uses _hashes before the commit, and consolidate link_hash back into
that attribute.
This turns invalid egg fragments into a soft error, with a scheduled
deprecation period of two releases.
Signed-off-by: William Woodruff <william@trailofbits.com>
This should prevent us from accepting malformed egg fragments
that are shadowed by other parts of the requirement specifier.
Signed-off-by: William Woodruff <william@trailofbits.com>
This should now be consistent with existing tests (without establishing
that those tests are actually well-specified).
Signed-off-by: William Woodruff <william@trailofbits.com>
This should help reduce user confusion about what can go in a URI's
egg fragment.
Fixes#11567.
Signed-off-by: William Woodruff <william@trailofbits.com>
According to RFC 8089, an empty host value (i.e. "file:///") should be
taken to be "localhost" (i.e. "file://localhost/"), so we need to
perform some additional normalization to compare such URLs correctly.
The typing module has been available since Python 3.5. Guarding the
import has been unnecessary since dropping Python 2.
Some guards remain to either:
- Avoid circular imports
- Importing objects that are also guarded by typing.TYPE_CHECKING
- Avoid mypy_extensions dependency
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.
By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
Using typing.Text is unnecessary since dropping Python 2 support.
In Python 3, typing.Text is a simple alias of str. It exists as a
backward compatibility shim for Python 2.
add failing test
apply the fix
add template NEWS entry according to https://pip.pypa.io/en/latest/development/contributing/#news-entries (wrong PR #)
rename news entry to the current PR #
respond to review comments
fix test failures
fix tests by adding uuid salt in urls
cache html page fetching by link
make CI pass (?)
make the types much better
finally listen to the maintainer and cache parse_links() by url :)
avoid caching parse_links() when the url is an index url
cleanup
add testing for uncachable marking
only conditionally vendor _lru_cache for py2
bugfix => feature
python 2 does not cache!
Do away with type: ignore with getattr()
respond to review comments