MCPcopy Index your code
hub / github.com/RustPython/RustPython / _code_to_hash_pyc

Function _code_to_hash_pyc

Lib/importlib/_bootstrap_external.py:532–540  ·  view source on GitHub ↗

Produce the data for a hash-based pyc.

(code, source_hash, checked=True)

Source from the content-addressed store, hash-verified

530
531
532def _code_to_hash_pyc(code, source_hash, checked=True):
533 "Produce the data for a hash-based pyc."
534 data = bytearray(MAGIC_NUMBER)
535 flags = 0b1 | checked << 1
536 data.extend(_pack_uint32(flags))
537 assert len(source_hash) == 8
538 data.extend(source_hash)
539 data.extend(marshal.dumps(code))
540 return data
541
542
543def decode_source(source_bytes):

Callers 1

get_codeMethod · 0.70

Calls 4

lenFunction · 0.85
_pack_uint32Function · 0.70
extendMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected