MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_source

Method get_source

tools/python-3.11.9-amd64/Lib/pkgutil.py:336–352  ·  view source on GitHub ↗
(self, fullname=None)

Source from the content-addressed store, hash-verified

334 return self.code
335
336 def get_source(self, fullname=None):
337 fullname = self._fix_name(fullname)
338 if self.source is None:
339 mod_type = self.etc[2]
340 if mod_type==imp.PY_SOURCE:
341 self._reopen()
342 try:
343 self.source = self.file.read()
344 finally:
345 self.file.close()
346 elif mod_type==imp.PY_COMPILED:
347 if os.path.exists(self.filename[:-1]):
348 with open(self.filename[:-1], 'r') as f:
349 self.source = f.read()
350 elif mod_type==imp.PKG_DIRECTORY:
351 self.source = self._get_delegate().get_source()
352 return self.source
353
354 def _get_delegate(self):
355 finder = ImpImporter(self.filename)

Callers 3

get_codeMethod · 0.95
runMethod · 0.45
_readmoduleFunction · 0.45

Calls 7

_fix_nameMethod · 0.95
_reopenMethod · 0.95
_get_delegateMethod · 0.95
openFunction · 0.70
readMethod · 0.45
closeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected