MCPcopy
hub / github.com/pex-tool/pex / create

Method create

pex/pep_376.py:47–60  ·  view source on GitHub ↗
(cls, hasher)

Source from the content-addressed store, hash-verified

45class Hash(object):
46 @classmethod
47 def create(cls, hasher):
48 # type: (Hasher) -> Hash
49
50 # The fingerprint encoding is defined for PEP-376 RECORD files as `urlsafe-base64-nopad`
51 # which is fully spelled out in code in PEP-427:
52 # + https://peps.python.org/pep-0376/#record
53 # + https://peps.python.org/pep-0427/#appendix
54 fingerprint = base64.urlsafe_b64encode(hasher.digest()).rstrip(b"=")
55
56 # N.B.: The algorithm is all caps under Python 2.7, but lower case under Python 3; so we
57 # normalize.
58 alg = hasher.name.lower()
59
60 return cls(value="{alg}={hash}".format(alg=alg, hash=fingerprint.decode("ascii")))
61
62 value = attr.ib() # type: str
63

Callers 11

record_installed_fileFunction · 0.45
_loaded_envsMethod · 0.45
test_resolveMethod · 0.45
_resolve_requirementMethod · 0.45
_install_distributionFunction · 0.45
_ensure_installedFunction · 0.45
unzip_dirFunction · 0.45
venv_dirFunction · 0.45
create_installed_fileFunction · 0.45
_build_packedappMethod · 0.45

Calls 3

lowerMethod · 0.80
decodeMethod · 0.80
digestMethod · 0.45

Tested by 1

test_resolveMethod · 0.36