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

Function _builtin_hash

Lib/test/support/hashlib_helper.py:620–643  ·  view source on GitHub ↗

Check availability of . (**kwargs). - The *module_name* is the C extension module name based on HACL*. - The *digestname* is one of its member, e.g., 'md5'. The constructor function is returned, or SkipTest is raised if none exists.

(module_name, digestname, /, **kwargs)

Source from the content-addressed store, hash-verified

618
619
620def _builtin_hash(module_name, digestname, /, **kwargs):
621 """Check availability of <module_name>.<digestname>(**kwargs).
622
623 - The *module_name* is the C extension module name based on HACL*.
624 - The *digestname* is one of its member, e.g., 'md5'.
625
626 The constructor function is returned, or SkipTest is raised if none exists.
627 """
628 assert isinstance(module_name, str), module_name
629 assert isinstance(digestname, str), digestname
630 fullname = f'{module_name}.{digestname}'
631 try:
632 builtin_module = importlib.import_module(module_name)
633 except ImportError as exc:
634 raise SkipNoHash(fullname, "builtin") from exc
635 try:
636 constructor = getattr(builtin_module, digestname)
637 except AttributeError as exc:
638 raise SkipNoHash(fullname, "builtin") from exc
639 try:
640 constructor(**kwargs)
641 except ValueError as exc:
642 raise SkipNoHash(fullname, "builtin") from exc
643 return constructor
644
645
646def _openssl_new(digestname, /, **kwargs):

Callers 1

_find_constructorMethod · 0.85

Calls 3

SkipNoHashClass · 0.85
constructorFunction · 0.85
import_moduleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…