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 not.
(name, package=None, level=0)
| 1303 | |
| 1304 | |
| 1305 | def _gcd_import(name, package=None, level=0): |
| 1306 | """Import and return the module based on its name, the package the call is |
| 1307 | being made from, and the level adjustment. |
| 1308 | |
| 1309 | This function represents the greatest common denominator of functionality |
| 1310 | between import_module and __import__. This includes setting __package__ if |
| 1311 | the loader did not. |
| 1312 | |
| 1313 | """ |
| 1314 | _sanity_check(name, package, level) |
| 1315 | if level > 0: |
| 1316 | name = _resolve_name(name, package, level) |
| 1317 | return _find_and_load(name, _gcd_import) |
| 1318 | |
| 1319 | |
| 1320 | def _handle_fromlist(module, fromlist, import_, *, recursive=False): |
no test coverage detected
searching dependent graphs…