Bump black from 23.12.1 to 24.2.0 (#6221)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
dependabot[bot] 2024-02-21 15:53:50 +13:00 committed by GitHub
parent 4d8b5edb1c
commit 07c3ee75e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 24 additions and 13 deletions

View file

@ -3,7 +3,7 @@
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks
repos: repos:
- repo: https://github.com/psf/black-pre-commit-mirror - repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1 rev: 24.2.0
hooks: hooks:
- id: black - id: black
args: args:

View file

@ -1,2 +1,3 @@
"""Support for Honeywell HumidIcon HIH""" """Support for Honeywell HumidIcon HIH"""
CODEOWNERS = ["@Benichou34"] CODEOWNERS = ["@Benichou34"]

View file

@ -1,2 +1,3 @@
"""Support for Honeywell ABP2""" """Support for Honeywell ABP2"""
CODEOWNERS = ["@jpfaff"] CODEOWNERS = ["@jpfaff"]

View file

@ -7,6 +7,7 @@ reading temperatures to a resolution of 0.0625°C.
https://www.sparkfun.com/datasheets/Sensors/Temperature/tmp102.pdf https://www.sparkfun.com/datasheets/Sensors/Temperature/tmp102.pdf
""" """
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.components import i2c, sensor from esphome.components import i2c, sensor

View file

@ -3,6 +3,7 @@
The cryptography package is loaded lazily in the functions The cryptography package is loaded lazily in the functions
so that it doesn't crash if it's not installed. so that it doesn't crash if it's not installed.
""" """
import logging import logging
from pathlib import Path from pathlib import Path

View file

@ -292,8 +292,7 @@ class ConfigValidationStep(abc.ABC):
priority: float = 0.0 priority: float = 0.0
@abc.abstractmethod @abc.abstractmethod
def run(self, result: Config) -> None: def run(self, result: Config) -> None: ... # noqa: E704
...
class LoadValidationStep(ConfigValidationStep): class LoadValidationStep(ConfigValidationStep):

View file

@ -1,4 +1,5 @@
"""Enum backports from standard lib.""" """Enum backports from standard lib."""
from __future__ import annotations from __future__ import annotations
from enum import Enum from enum import Enum

View file

@ -8,7 +8,6 @@ originally do.
However there is a property to further disable decorator However there is a property to further disable decorator
impact.""" impact."""
# This is set to true by script/build_language_schema.py # This is set to true by script/build_language_schema.py
# only, so data is collected (again functionality is not modified) # only, so data is collected (again functionality is not modified)
EnableSchemaExtraction = False EnableSchemaExtraction = False

View file

@ -1,4 +1,5 @@
"""This helper module tracks commonly used types in the esphome python codebase.""" """This helper module tracks commonly used types in the esphome python codebase."""
from typing import Union from typing import Union
from esphome.core import ID, Lambda, EsphomeCore from esphome.core import ID, Lambda, EsphomeCore

View file

@ -1,6 +1,6 @@
pylint==3.0.3 pylint==3.0.3
flake8==7.0.0 # also change in .pre-commit-config.yaml when updating flake8==7.0.0 # also change in .pre-commit-config.yaml when updating
black==23.12.1 # also change in .pre-commit-config.yaml when updating black==24.2.0 # also change in .pre-commit-config.yaml when updating
pyupgrade==3.15.0 # also change in .pre-commit-config.yaml when updating pyupgrade==3.15.0 # also change in .pre-commit-config.yaml when updating
pre-commit pre-commit

View file

@ -849,9 +849,11 @@ def convert(schema, config_var, path):
config_var["id_type"] = { config_var["id_type"] = {
"class": str(data.base), "class": str(data.base),
"parents": [str(x.base) for x in parents] "parents": (
if isinstance(parents, list) [str(x.base) for x in parents]
else None, if isinstance(parents, list)
else None
),
} }
elif schema_type == "use_id": elif schema_type == "use_id":
if inspect.ismodule(data): if inspect.ismodule(data):

View file

@ -28,8 +28,9 @@ def test_write_utf8_file_fails_at_rename(
test_dir = tmpdir.mkdir("files") test_dir = tmpdir.mkdir("files")
test_file = Path(test_dir / "test.json") test_file = Path(test_dir / "test.json")
with pytest.raises(OSError), patch( with (
"esphome.dashboard.util.file.os.replace", side_effect=OSError pytest.raises(OSError),
patch("esphome.dashboard.util.file.os.replace", side_effect=OSError),
): ):
write_utf8_file(test_file, '{"some":"data"}', False) write_utf8_file(test_file, '{"some":"data"}', False)
@ -45,9 +46,11 @@ def test_write_utf8_file_fails_at_rename_and_remove(
test_dir = tmpdir.mkdir("files") test_dir = tmpdir.mkdir("files")
test_file = Path(test_dir / "test.json") test_file = Path(test_dir / "test.json")
with pytest.raises(OSError), patch( with (
"esphome.dashboard.util.file.os.remove", side_effect=OSError pytest.raises(OSError),
), patch("esphome.dashboard.util.file.os.replace", side_effect=OSError): patch("esphome.dashboard.util.file.os.remove", side_effect=OSError),
patch("esphome.dashboard.util.file.os.replace", side_effect=OSError),
):
write_utf8_file(test_file, '{"some":"data"}', False) write_utf8_file(test_file, '{"some":"data"}', False)
assert "File replacement cleanup failed" in caplog.text assert "File replacement cleanup failed" in caplog.text

View file

@ -8,6 +8,7 @@ If adding unit tests ensure that they are fast. Slower integration tests should
not be part of a unit test suite. not be part of a unit test suite.
""" """
import sys import sys
import pytest import pytest

View file

@ -1,4 +1,5 @@
"""Tests for the wizard.py file.""" """Tests for the wizard.py file."""
import os import os
import esphome.wizard as wz import esphome.wizard as wz