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

Method get_code

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

Source from the content-addressed store, hash-verified

317 return self.etc[2]==imp.PKG_DIRECTORY
318
319 def get_code(self, fullname=None):
320 fullname = self._fix_name(fullname)
321 if self.code is None:
322 mod_type = self.etc[2]
323 if mod_type==imp.PY_SOURCE:
324 source = self.get_source(fullname)
325 self.code = compile(source, self.filename, 'exec')
326 elif mod_type==imp.PY_COMPILED:
327 self._reopen()
328 try:
329 self.code = read_code(self.file)
330 finally:
331 self.file.close()
332 elif mod_type==imp.PKG_DIRECTORY:
333 self.code = self._get_delegate().get_code()
334 return self.code
335
336 def get_source(self, fullname=None):
337 fullname = self._fix_name(fullname)

Callers 1

_get_module_detailsFunction · 0.45

Calls 7

_fix_nameMethod · 0.95
get_sourceMethod · 0.95
_reopenMethod · 0.95
_get_delegateMethod · 0.95
read_codeFunction · 0.85
compileFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected