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

Method fetch_hash_function

Lib/test/test_support.py:888–900  ·  view source on GitHub ↗
(self, name, implementation)

Source from the content-addressed store, hash-verified

886 return default
887
888 def fetch_hash_function(self, name, implementation):
889 info = hashlib_helper.get_hash_func_info(name)
890 match hashlib_helper.Implementation(implementation):
891 case hashlib_helper.Implementation.hashlib:
892 method_name = info.hashlib.member_name
893 assert isinstance(method_name, str), method_name
894 return getattr(self.hashlib, method_name)
895 case hashlib_helper.Implementation.openssl:
896 method_name = info.openssl.member_name
897 assert isinstance(method_name, str | None), method_name
898 return getattr(self._hashlib, method_name or "", None)
899 fullname = info[implementation].fullname
900 return self.try_import_attribute(fullname)
901
902 def fetch_hmac_function(self, name):
903 target = hashlib_helper.get_hmac_item_info(name)

Callers 2

check_openssl_hashMethod · 0.95
check_builtin_hashMethod · 0.95

Calls 1

try_import_attributeMethod · 0.95

Tested by

no test coverage detected