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

Class SourcelessFileLoader

Lib/importlib/_bootstrap_external.py:1007–1029  ·  view source on GitHub ↗

Loader which handles sourceless file imports.

Source from the content-addressed store, hash-verified

1005
1006
1007class SourcelessFileLoader(FileLoader, _LoaderBasics):
1008
1009 """Loader which handles sourceless file imports."""
1010
1011 def get_code(self, fullname):
1012 path = self.get_filename(fullname)
1013 data = self.get_data(path)
1014 # Call _classify_pyc to do basic validation of the pyc but ignore the
1015 # result. There's no source to check against.
1016 exc_details = {
1017 'name': fullname,
1018 'path': path,
1019 }
1020 _classify_pyc(data, fullname, exc_details)
1021 return _compile_bytecode(
1022 memoryview(data)[16:],
1023 name=fullname,
1024 bytecode_path=path,
1025 )
1026
1027 def get_source(self, fullname):
1028 """Return None as there is no source code."""
1029 return None
1030
1031
1032class ExtensionFileLoader(FileLoader, _LoaderBasics):

Callers 1

_fix_up_moduleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected