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

Function _gcd_import

tools/python-3.11.9-amd64/Lib/importlib/_bootstrap.py:1192–1204  ·  view source on GitHub ↗

Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did

(name, package=None, level=0)

Source from the content-addressed store, hash-verified

1190
1191
1192def _gcd_import(name, package=None, level=0):
1193 """Import and return the module based on its name, the package the call is
1194 being made from, and the level adjustment.
1195
1196 This function represents the greatest common denominator of functionality
1197 between import_module and __import__. This includes setting __package__ if
1198 the loader did not.
1199
1200 """
1201 _sanity_check(name, package, level)
1202 if level > 0:
1203 name = _resolve_name(name, package, level)
1204 return _find_and_load(name, _gcd_import)
1205
1206
1207def _handle_fromlist(module, fromlist, import_, *, recursive=False):

Callers 1

__import__Function · 0.85

Calls 3

_sanity_checkFunction · 0.85
_resolve_nameFunction · 0.85
_find_and_loadFunction · 0.85

Tested by

no test coverage detected