MCPcopy Index your code
hub / github.com/python/cpython / _import_module

Function _import_module

Lib/test/support/hashlib_helper.py:30–45  ·  view source on GitHub ↗

Import a module from its fully-qualified name. If *strict* is false, import failures are suppressed and None is returned.

(module_name, *, strict=False)

Source from the content-addressed store, hash-verified

28
29
30def _import_module(module_name, *, strict=False):
31 """Import a module from its fully-qualified name.
32
33 If *strict* is false, import failures are suppressed and None is returned.
34 """
35 if module_name is None:
36 # To prevent a TypeError in importlib.import_module
37 if strict:
38 raise ImportError("no module to import")
39 return None
40 try:
41 return importlib.import_module(module_name)
42 except ImportError as exc:
43 if strict:
44 raise exc
45 return None
46
47
48def _import_member(module_name, member_name, *, strict=False):

Callers 12

_import_memberFunction · 0.85
import_moduleMethod · 0.85
requires_openssl_hashlibFunction · 0.85
requires_builtin_hmacFunction · 0.85
_hashlib_newFunction · 0.85
find_gil_minsizeFunction · 0.85
_block_openssl_hash_newFunction · 0.85
_block_openssl_hmac_newFunction · 0.85
_block_builtin_hmac_newFunction · 0.85
block_algorithmFunction · 0.85

Calls 1

import_moduleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…