Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:

repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.9.1
rev: v4.18.1
hooks:
- id: commitizen
stages: [commit-msg]
Expand All @@ -34,31 +34,31 @@ repos:
- id: prettier
args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2
rev: v0.16.8
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
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
rev: v2.3.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]
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----------------------------------------------------

Expand All @@ -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 -------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/sensor_state_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
__all__ = [
"BaseDeviceClass",
"BaseValue",
"BinarySensorValue",
"BinarySensorDescription",
"BinarySensorDeviceClass",
"BinarySensorValue",
"DeviceClass",
"DeviceKey",
"Event",
Expand Down
4 changes: 2 additions & 2 deletions src/sensor_state_data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/sensor_state_data/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from enum import Enum
from typing import Any, TypeVar

from typing_extensions import Self

_StrEnumT = TypeVar("_StrEnumT", bound="StrEnum")


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")
Expand Down
Loading