From 840ba926204dff8e3a00b0a1c085814cd73034fe Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Thu, 10 Jun 2021 12:29:34 -0500 Subject: [PATCH] use Hashable type as dict key (instead of Any) --- bitarray/__init__.pyi | 2 +- bitarray/util.pyi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitarray/__init__.pyi b/bitarray/__init__.pyi index 10ca8294..05d9276a 100644 --- a/bitarray/__init__.pyi +++ b/bitarray/__init__.pyi @@ -108,7 +108,7 @@ class bitarray: class frozenbitarray(bitarray): - ... + def __hash__(self) -> int: ... def bits2bytes(n: int, /) -> int: ... diff --git a/bitarray/util.pyi b/bitarray/util.pyi index 79aab19c..0747a52a 100644 --- a/bitarray/util.pyi +++ b/bitarray/util.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, BinaryIO, Literal, Optional, Union +from typing import Any, AnyStr, BinaryIO, Hashable, Literal, Optional, Union from bitarray import bitarray @@ -41,5 +41,5 @@ def int2ba(i: int, /, def serialize(a: bitarray, /) -> bytes: ... def deserialize(b: bytes, /) -> bitarray: ... -def huffman_code(freq_map: dict[Any, Union[int, float]], - endian: Optional[str] = ...) -> dict[Any, bitarray]: ... +def huffman_code(freq_map: dict[Hashable, Union[int, float]], + endian: Optional[str] = ...) -> dict[Hashable, bitarray]: ...