diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a22bc68..4dc5325 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,12 +8,12 @@ default_language_version: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.19.1 hooks: - id: pyupgrade args: [--py310-plus] - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.10.0 hooks: - id: black args: @@ -22,7 +22,7 @@ repos: <<: &python-files-with-tests files: ^((custom_components|tests)/.+)?[^/]+\.py$ - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.1.1 hooks: - id: flake8 additional_dependencies: @@ -31,7 +31,7 @@ repos: <<: &python-files files: ^(custom_components/.+)?[^/]+\.py$ - repo: https://github.com/PyCQA/bandit - rev: 1.7.6 + rev: 1.8.0 hooks: - id: bandit args: @@ -44,7 +44,7 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-executables-have-shebangs - id: check-merge-conflict @@ -66,7 +66,7 @@ repos: - python exclude: manifest\.json$ - repo: https://github.com/adrienverge/yamllint.git - rev: v1.33.0 + rev: v1.35.1 hooks: - id: yamllint - repo: local diff --git a/custom_components/bodymiscale/__init__.py b/custom_components/bodymiscale/__init__.py index 0bd4d48..6338ab5 100644 --- a/custom_components/bodymiscale/__init__.py +++ b/custom_components/bodymiscale/__init__.py @@ -1,4 +1,5 @@ """Support for bodymiscale.""" + import asyncio import logging from collections.abc import MutableMapping diff --git a/custom_components/bodymiscale/config_flow.py b/custom_components/bodymiscale/config_flow.py index 85b9318..3d68a39 100644 --- a/custom_components/bodymiscale/config_flow.py +++ b/custom_components/bodymiscale/config_flow.py @@ -1,4 +1,5 @@ """Config flow to configure the bodymiscale integration.""" + from __future__ import annotations from types import MappingProxyType @@ -36,9 +37,11 @@ def _get_options_schema( { vol.Required( CONF_HEIGHT, - description={"suggested_value": defaults[CONF_HEIGHT]} - if CONF_HEIGHT in defaults - else None, + description=( + {"suggested_value": defaults[CONF_HEIGHT]} + if CONF_HEIGHT in defaults + else None + ), ): selector( { "number": { @@ -51,15 +54,19 @@ def _get_options_schema( ), vol.Required( CONF_SENSOR_WEIGHT, - description={"suggested_value": defaults[CONF_SENSOR_WEIGHT]} - if CONF_SENSOR_WEIGHT in defaults - else None, + description=( + {"suggested_value": defaults[CONF_SENSOR_WEIGHT]} + if CONF_SENSOR_WEIGHT in defaults + else None + ), ): selector({"entity": {"domain": ["sensor", "input_number", "number"]}}), vol.Optional( CONF_SENSOR_IMPEDANCE, - description={"suggested_value": defaults[CONF_SENSOR_IMPEDANCE]} - if CONF_SENSOR_IMPEDANCE in defaults - else None, + description=( + {"suggested_value": defaults[CONF_SENSOR_IMPEDANCE]} + if CONF_SENSOR_IMPEDANCE in defaults + else None + ), ): selector({"entity": {"domain": ["sensor", "input_number", "number"]}}), } ) diff --git a/custom_components/bodymiscale/metrics/__init__.py b/custom_components/bodymiscale/metrics/__init__.py index 2ab704b..154bfe9 100644 --- a/custom_components/bodymiscale/metrics/__init__.py +++ b/custom_components/bodymiscale/metrics/__init__.py @@ -1,6 +1,5 @@ """Metrics module.""" - import logging from collections.abc import Callable, Mapping, MutableMapping from dataclasses import dataclass, field diff --git a/custom_components/bodymiscale/metrics/body_score.py b/custom_components/bodymiscale/metrics/body_score.py index ac5fccc..8ce50ac 100644 --- a/custom_components/bodymiscale/metrics/body_score.py +++ b/custom_components/bodymiscale/metrics/body_score.py @@ -1,4 +1,5 @@ """Body score module.""" + from collections import namedtuple from collections.abc import Mapping from typing import Any diff --git a/custom_components/bodymiscale/metrics/impedance.py b/custom_components/bodymiscale/metrics/impedance.py index 1bb0358..cef8b2b 100644 --- a/custom_components/bodymiscale/metrics/impedance.py +++ b/custom_components/bodymiscale/metrics/impedance.py @@ -1,4 +1,5 @@ """Metrics module, which require impedance.""" + from collections.abc import Mapping from typing import Any diff --git a/custom_components/bodymiscale/metrics/scale.py b/custom_components/bodymiscale/metrics/scale.py index 590f1d3..ff2fbfd 100644 --- a/custom_components/bodymiscale/metrics/scale.py +++ b/custom_components/bodymiscale/metrics/scale.py @@ -1,4 +1,5 @@ """Body scale module.""" + from functools import cached_property from ..models import Gender diff --git a/custom_components/bodymiscale/models.py b/custom_components/bodymiscale/models.py index 90f1f76..be0a4c2 100644 --- a/custom_components/bodymiscale/models.py +++ b/custom_components/bodymiscale/models.py @@ -1,4 +1,5 @@ """Models module.""" + from enum import Enum from .const import ( diff --git a/custom_components/bodymiscale/sensor.py b/custom_components/bodymiscale/sensor.py index 95fb41e..cc7684d 100644 --- a/custom_components/bodymiscale/sensor.py +++ b/custom_components/bodymiscale/sensor.py @@ -1,4 +1,5 @@ """Sensor module.""" + from collections.abc import Callable, Mapping from typing import Any @@ -185,8 +186,9 @@ def __init__( handler: BodyScaleMetricsHandler, entity_description: SensorEntityDescription, metric: Metric, - get_attributes: None - | (Callable[[StateType, Mapping[str, Any]], Mapping[str, Any]]) = None, + get_attributes: None | ( + Callable[[StateType, Mapping[str, Any]], Mapping[str, Any]] + ) = None, ): super().__init__(handler, entity_description) self._metric = metric diff --git a/custom_components/bodymiscale/util.py b/custom_components/bodymiscale/util.py index dcb5dc5..252567b 100644 --- a/custom_components/bodymiscale/util.py +++ b/custom_components/bodymiscale/util.py @@ -1,6 +1,5 @@ """Util module.""" - from collections.abc import Mapping from datetime import datetime from typing import Any