diff --git a/homeassistant/components/homekit/aidmanager.py b/homeassistant/components/homekit/aidmanager.py index 4addbeb1e23d17585d55f7c4824759f92467d173..9c3d9e7929ce6ae0aabfb8d12ff5134540a841b6 100644 --- a/homeassistant/components/homekit/aidmanager.py +++ b/homeassistant/components/homekit/aidmanager.py @@ -13,7 +13,7 @@ from __future__ import annotations from collections.abc import Generator import random -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import entity_registry as er diff --git a/homeassistant/components/homekit/manifest.json b/homeassistant/components/homekit/manifest.json index 80eea60b9e8effe9f0c94ef49dd4b5cceeaaf12c..def024d2046b98661a4378117f1171b23b18173b 100644 --- a/homeassistant/components/homekit/manifest.json +++ b/homeassistant/components/homekit/manifest.json @@ -10,7 +10,7 @@ "loggers": ["pyhap"], "requirements": [ "HAP-python==4.6.0", - "fnvhash==0.1.0", + "fnv-hash-fast==0.3.1", "PyQRCode==1.2.1", "base36==0.1.1" ], diff --git a/homeassistant/components/recorder/db_schema.py b/homeassistant/components/recorder/db_schema.py index c2252e9f68fed03b9a16d282955f14f8f5f12eb0..1619cc735131b9b6ff7bce39e093f6fb52d2f960 100644 --- a/homeassistant/components/recorder/db_schema.py +++ b/homeassistant/components/recorder/db_schema.py @@ -3,13 +3,12 @@ from __future__ import annotations from collections.abc import Callable from datetime import datetime, timedelta -from functools import lru_cache import logging import time from typing import Any, cast import ciso8601 -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from sqlalchemy import ( JSON, BigInteger, @@ -343,10 +342,9 @@ class EventData(Base): return bytes_result @staticmethod - @lru_cache def hash_shared_data_bytes(shared_data_bytes: bytes) -> int: """Return the hash of json encoded shared data.""" - return cast(int, fnv1a_32(shared_data_bytes)) + return fnv1a_32(shared_data_bytes) def to_native(self) -> dict[str, Any]: """Convert to an event data dictionary.""" @@ -592,10 +590,9 @@ class StateAttributes(Base): return bytes_result @staticmethod - @lru_cache(maxsize=2048) def hash_shared_attrs_bytes(shared_attrs_bytes: bytes) -> int: """Return the hash of json encoded shared attributes.""" - return cast(int, fnv1a_32(shared_attrs_bytes)) + return fnv1a_32(shared_attrs_bytes) def to_native(self) -> dict[str, Any]: """Convert to a state attributes dictionary.""" diff --git a/homeassistant/components/recorder/manifest.json b/homeassistant/components/recorder/manifest.json index 596d9a898490923e6e2a9d4c2497ed512ac65231..97eb9d062b06871a0c57599040bdc556a7a702a9 100644 --- a/homeassistant/components/recorder/manifest.json +++ b/homeassistant/components/recorder/manifest.json @@ -6,5 +6,5 @@ "integration_type": "system", "iot_class": "local_push", "quality_scale": "internal", - "requirements": ["sqlalchemy==2.0.8", "fnvhash==0.1.0"] + "requirements": ["sqlalchemy==2.0.8", "fnv-hash-fast==0.3.1"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index cd48245147b0131259af9c8e8ded2b5f2d99a290..b7f7bf53f5ab6b765a89a6d82c90ecb9276dbe6f 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -20,7 +20,7 @@ certifi>=2021.5.30 ciso8601==2.3.0 cryptography==40.0.1 dbus-fast==1.84.2 -fnvhash==0.1.0 +fnv-hash-fast==0.3.1 ha-av==10.0.0 hass-nabucasa==0.63.1 hassil==1.0.6 diff --git a/requirements_all.txt b/requirements_all.txt index 6841968424ebd9765a415aee8e4a5a3edc75ef64..b9fa171a6e6c19d75d37741637bc1dc7cc7a6e36 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -729,7 +729,7 @@ flux_led==0.28.36 # homeassistant.components.homekit # homeassistant.components.recorder -fnvhash==0.1.0 +fnv-hash-fast==0.3.1 # homeassistant.components.foobot foobot_async==1.0.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8d69556e8db1d2a066dc96cd4c8c96f06c1ff1b0..6e10a2983d4f6a62e85d3a4ec0cb5f3461b0185d 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -557,7 +557,7 @@ flux_led==0.28.36 # homeassistant.components.homekit # homeassistant.components.recorder -fnvhash==0.1.0 +fnv-hash-fast==0.3.1 # homeassistant.components.foobot foobot_async==1.0.0 diff --git a/tests/components/homekit/test_aidmanager.py b/tests/components/homekit/test_aidmanager.py index 64a44cd38a985101e8922493f08d0cde4e98bf16..18e654cb4ed1062088a7d473d1d800be959dd9e7 100644 --- a/tests/components/homekit/test_aidmanager.py +++ b/tests/components/homekit/test_aidmanager.py @@ -2,7 +2,7 @@ import os from unittest.mock import patch -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from homeassistant.components.homekit.aidmanager import ( AccessoryAidStorage, @@ -386,7 +386,7 @@ async def test_aid_generation_no_unique_ids_handles_collision( await aid_storage.async_save() await hass.async_block_till_done() - with patch("fnvhash.fnv1a_32", side_effect=Exception): + with patch("fnv_hash_fast.fnv1a_32", side_effect=Exception): aid_storage = AccessoryAidStorage(hass, config_entry) await aid_storage.async_initialize() diff --git a/tests/components/recorder/db_schema_25.py b/tests/components/recorder/db_schema_25.py index 7f276d42df86f6fd8218d52b19dca4e9f0ec0e21..291fdb1231d7bda8d73e312fa97b0da8661f61e1 100644 --- a/tests/components/recorder/db_schema_25.py +++ b/tests/components/recorder/db_schema_25.py @@ -6,7 +6,7 @@ import json import logging from typing import Any, TypedDict, cast, overload -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from sqlalchemy import ( BigInteger, Boolean, diff --git a/tests/components/recorder/db_schema_28.py b/tests/components/recorder/db_schema_28.py index 8127cb3f26f78fd5b4b75aec74c54873f2a820bb..7e88d6a5548d8c3f9b118004199d4aedf91e8df1 100644 --- a/tests/components/recorder/db_schema_28.py +++ b/tests/components/recorder/db_schema_28.py @@ -11,7 +11,7 @@ import logging import time from typing import Any, TypedDict, cast, overload -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from sqlalchemy import ( BigInteger, Boolean, diff --git a/tests/components/recorder/db_schema_30.py b/tests/components/recorder/db_schema_30.py index 9c5efaea1d32cc865411a39c31e3c5efb3636d94..4041775271918418e0fceb922bda47487c6b6001 100644 --- a/tests/components/recorder/db_schema_30.py +++ b/tests/components/recorder/db_schema_30.py @@ -12,7 +12,7 @@ import time from typing import Any, TypedDict, cast, overload import ciso8601 -from fnvhash import fnv1a_32 +from fnv_hash_fast import fnv1a_32 from sqlalchemy import ( JSON, BigInteger,