diff --git a/pytools/__init__.py b/pytools/__init__.py index 27e4bca17955f8abd75d396dfd38be2f86fcaf1f..2304462bd15d51c23a0ca6b68cf50372cdc75a6b 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -2768,7 +2768,9 @@ def resolve_name(name): # {{{ unordered_hash -def unordered_hash(hash_instance, iterable, hash_constructor=None): +def unordered_hash(hash_instance: Any, + iterable: Iterable[Any], + hash_constructor: Optional[Callable[[], Any]] = None) -> Any: """Using a hash algorithm given by the parameter-less constructor *hash_constructor*, return a hash object whose internal state depends on the entries of *iterable*, but not their order. If *hash* @@ -2794,6 +2796,8 @@ def unordered_hash(hash_instance, iterable, hash_constructor=None): from functools import partial hash_constructor = partial(hashlib.new, hash_instance.name) + assert hash_constructor is not None + h_int = 0 for i in iterable: h_i = hash_constructor()