From f89dc93f60edeafd9a80a8b971c9e6f0c0aac4bd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:36:17 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.15.0 → v3.19.1](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.19.1) - [github.com/psf/black: 23.12.1 → 25.1.0](https://github.com/psf/black/compare/23.12.1...25.1.0) - [github.com/PyCQA/flake8: 6.1.0 → 7.1.2](https://github.com/PyCQA/flake8/compare/6.1.0...7.1.2) - [github.com/PyCQA/bandit: 1.7.6 → 1.8.3](https://github.com/PyCQA/bandit/compare/1.7.6...1.8.3) - [github.com/PyCQA/isort: 5.13.2 → 6.0.0](https://github.com/PyCQA/isort/compare/5.13.2...6.0.0) - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0) - [github.com/adrienverge/yamllint.git: v1.33.0 → v1.35.1](https://github.com/adrienverge/yamllint.git/compare/v1.33.0...v1.35.1) --- .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 a22bc68..f1c6f13 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: 25.1.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.2 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.3 hooks: - id: bandit args: @@ -40,11 +40,11 @@ repos: - --configfile=bandit.yaml <<: *python-files-with-tests - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.0 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 From 7f5ea3d3d76a6dc5d3e4d3f70f5f167706e698dd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:36:27 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- custom_components/bodymiscale/__init__.py | 1 + custom_components/bodymiscale/config_flow.py | 27 ++++++++++++------- .../bodymiscale/metrics/__init__.py | 1 - .../bodymiscale/metrics/body_score.py | 1 + .../bodymiscale/metrics/impedance.py | 1 + .../bodymiscale/metrics/scale.py | 1 + custom_components/bodymiscale/models.py | 1 + custom_components/bodymiscale/sensor.py | 6 +++-- custom_components/bodymiscale/util.py | 1 - 9 files changed, 26 insertions(+), 14 deletions(-) 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..1ba866d 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 @@ -29,16 +30,18 @@ @callback # type: ignore[misc] def _get_options_schema( - defaults: dict[str, Any] | MappingProxyType[str, Any] + defaults: dict[str, Any] | MappingProxyType[str, Any], ) -> vol.Schema: """Return options schema.""" return vol.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