MCPcopy Index your code
hub / github.com/python/cpython / get_source

Method get_source

Lib/importlib/_bootstrap_external.py:791–799  ·  view source on GitHub ↗

Concrete implementation of InspectLoader.get_source.

(self, fullname)

Source from the content-addressed store, hash-verified

789
790
791 def get_source(self, fullname):
792 """Concrete implementation of InspectLoader.get_source."""
793 path = self.get_filename(fullname)
794 try:
795 source_bytes = self.get_data(path)
796 except OSError as exc:
797 raise ImportError('source not available through get_data()',
798 name=fullname) from exc
799 return decode_source(source_bytes)
800
801 def source_to_code(self, data, path, fullname=None, *, _optimize=-1):
802 """Return the code object compiled from source.

Callers

nothing calls this directly

Calls 3

get_dataMethod · 0.95
decode_sourceFunction · 0.85
get_filenameMethod · 0.45

Tested by

no test coverage detected