From 454776a42c2f927b504320469c158ada21c1927a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:15:16 +0000 Subject: [PATCH 1/2] chore(pre-commit.ci): pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/commitizen-tools/commitizen: v4.9.1 → v4.19.3](https://github.com/commitizen-tools/commitizen/compare/v4.9.1...v4.19.3) - [github.com/asottile/pyupgrade: v3.21.0 → v3.22.0](https://github.com/asottile/pyupgrade/compare/v3.21.0...v3.22.0) - [github.com/astral-sh/ruff-pre-commit: v0.14.2 → v0.17.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.2...v0.17.5) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.3) - [github.com/PyCQA/flake8: 7.3.0 → 7.5.0](https://github.com/PyCQA/flake8/compare/7.3.0...7.5.0) - [github.com/pre-commit/mirrors-mypy: v1.18.2 → v2.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.18.2...v2.4.1) - [github.com/PyCQA/bandit: 1.8.6 → 1.9.4](https://github.com/PyCQA/bandit/compare/1.8.6...1.9.4) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4945ca..db1bf08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ ci: repos: - repo: https://github.com/commitizen-tools/commitizen - rev: v4.9.1 + rev: v4.19.3 hooks: - id: commitizen stages: [commit-msg] @@ -34,31 +34,31 @@ repos: - id: prettier args: ["--tab-width", "2"] - repo: https://github.com/asottile/pyupgrade - rev: v3.21.0 + rev: v3.22.0 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.2 + rev: v0.17.5 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell - repo: https://github.com/PyCQA/flake8 - rev: 7.3.0 + rev: 7.5.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.18.2 + rev: v2.4.1 hooks: - id: mypy additional_dependencies: [] - repo: https://github.com/PyCQA/bandit - rev: 1.8.6 + rev: 1.9.4 hooks: - id: bandit args: [-x, tests] From c7fd8cfcb042d2d66af00e820b52ea1fcf885b4e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:30:47 +0000 Subject: [PATCH 2/2] chore(pre-commit.ci): auto fixes --- docs/source/conf.py | 4 ++-- src/sensor_state_data/__init__.py | 2 +- src/sensor_state_data/data.py | 4 ++-- src/sensor_state_data/enum.py | 6 ++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b38de98..eab5670 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,7 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) -from typing import Any, List +from typing import Any # -- Project information ----------------------------------------------------- @@ -40,7 +40,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns: List[Any] = [] +exclude_patterns: list[Any] = [] # -- Options for HTML output ------------------------------------------------- diff --git a/src/sensor_state_data/__init__.py b/src/sensor_state_data/__init__.py index e1ff494..ad4826b 100644 --- a/src/sensor_state_data/__init__.py +++ b/src/sensor_state_data/__init__.py @@ -14,9 +14,9 @@ __all__ = [ "BaseDeviceClass", "BaseValue", - "BinarySensorValue", "BinarySensorDescription", "BinarySensorDeviceClass", + "BinarySensorValue", "DeviceClass", "DeviceKey", "Event", diff --git a/src/sensor_state_data/data.py b/src/sensor_state_data/data.py index 69b866d..f1c7288 100644 --- a/src/sensor_state_data/data.py +++ b/src/sensor_state_data/data.py @@ -218,7 +218,7 @@ def update_predefined_binary_sensor( def update_predefined_sensor( self, base_description: BaseSensorDescription, - native_value: None | str | int | float | date | datetime | Decimal, + native_value: None | str | float | date | datetime | Decimal, key: str | None = None, name: str | None = None, device_id: str | None = None, @@ -268,7 +268,7 @@ def update_sensor( self, key: str, native_unit_of_measurement: Units | None, - native_value: None | str | int | float | date | datetime | Decimal, + native_value: None | str | float | date | datetime | Decimal, device_class: SensorDeviceClass | None = None, name: str | None = None, device_id: str | None = None, diff --git a/src/sensor_state_data/enum.py b/src/sensor_state_data/enum.py index 9eb76c2..099b58e 100644 --- a/src/sensor_state_data/enum.py +++ b/src/sensor_state_data/enum.py @@ -3,7 +3,7 @@ from __future__ import annotations from enum import Enum -from typing import Any, TypeVar +from typing import Any, Self, TypeVar _StrEnumT = TypeVar("_StrEnumT", bound="StrEnum") @@ -11,9 +11,7 @@ class StrEnum(str, Enum): """Partial backport of Python 3.11's StrEnum for our basic use cases.""" - def __new__( - cls: type[_StrEnumT], value: str, *args: Any, **kwargs: Any - ) -> _StrEnumT: + def __new__(cls, value: str, *args: Any, **kwargs: Any) -> Self: """Create a new StrEnum instance.""" if not isinstance(value, str): raise TypeError(f"{value!r} is not a string")