mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
cdcf74fb8e
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.
14 lines
481 B
Python
14 lines
481 B
Python
from pip._internal.models.candidate import InstallationCandidate
|
|
from pip._internal.models.link import Link
|
|
|
|
|
|
def make_mock_candidate(version, yanked_reason=None, hex_digest=None):
|
|
url = f'https://example.com/pkg-{version}.tar.gz'
|
|
if hex_digest is not None:
|
|
assert len(hex_digest) == 64
|
|
url += f'#sha256={hex_digest}'
|
|
|
|
link = Link(url, yanked_reason=yanked_reason)
|
|
candidate = InstallationCandidate('mypackage', version, link)
|
|
|
|
return candidate
|