MCPcopy Create free account
hub / github.com/catboost/catboost / exec_module

Method exec_module

library/python/runtime_py3/__res.py:375–396  ·  view source on GitHub ↗
(self, module)

Source from the content-addressed store, hash-verified

373 """Use default semantics for module creation."""
374
375 def exec_module(self, module):
376 code = self.get_code(module.__name__)
377 module.__file__ = code.co_filename
378 if self.is_package(module.__name__):
379 module.__path__= [executable + path_sep + module.__name__.replace('.', path_sep)]
380 # exec(code, module.__dict__)
381
382 # __name__ and __file__ could be overwritten after execution
383 # So these two things are needed if wee want to be consistent at some point
384 initial_modname = module.__name__
385 initial_filename = module.__file__
386
387 if self._before_import_callback:
388 self._before_import_callback(initial_modname, initial_filename)
389
390 # “Zero-cost” exceptions are implemented.
391 # The cost of try statements is almost eliminated when no exception is raised
392 try:
393 _call_with_frames_removed(exec, code, module.__dict__)
394 finally:
395 if self._after_import_callback:
396 self._after_import_callback(initial_modname, initial_filename)
397
398 # PEP-302 extension 1 of 3: data loader.
399 def get_data(self, path):

Callers 2

load_dynamicFunction · 0.45
load_dynamicFunction · 0.45

Calls 3

get_codeMethod · 0.95
is_packageMethod · 0.95
replaceMethod · 0.45

Tested by

no test coverage detected