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

Function _import_member

Lib/test/support/hashlib_helper.py:48–60  ·  view source on GitHub ↗

Import a member from a module. If *strict* is false, import failures are suppressed and None is returned.

(module_name, member_name, *, strict=False)

Source from the content-addressed store, hash-verified

46
47
48def _import_member(module_name, member_name, *, strict=False):
49 """Import a member from a module.
50
51 If *strict* is false, import failures are suppressed and None is returned.
52 """
53 if member_name is None:
54 if strict:
55 raise ImportError(f"no member to import from {module_name}")
56 return None
57 module = _import_module(module_name, strict=strict)
58 if strict:
59 return getattr(module, member_name)
60 return getattr(module, member_name, None)
61
62
63class Implementation(enum.StrEnum):

Callers 1

import_memberMethod · 0.85

Calls 1

_import_moduleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…