From cdcb25be8ee0f85fcad7db8f9b32010a370f2b56 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Wed, 15 Nov 2023 00:38:36 +0100 Subject: [PATCH] Make precommit checks happy (#5751) --- script/bump-version.py | 2 +- tests/unit_tests/test_cpp_generator.py | 2 +- tests/unit_tests/test_cpp_helpers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script/bump-version.py b/script/bump-version.py index 1f034344f9..3e1e473c4b 100755 --- a/script/bump-version.py +++ b/script/bump-version.py @@ -45,7 +45,7 @@ def sub(path, pattern, repl, expected_count=1): content, count = re.subn(pattern, repl, content, flags=re.MULTILINE) if expected_count is not None: assert count == expected_count, f"Pattern {pattern} replacement failed!" - with open(path, "wt") as fh: + with open(path, "w") as fh: fh.write(content) diff --git a/tests/unit_tests/test_cpp_generator.py b/tests/unit_tests/test_cpp_generator.py index 331c500c04..6f4b5a40bc 100644 --- a/tests/unit_tests/test_cpp_generator.py +++ b/tests/unit_tests/test_cpp_generator.py @@ -1,4 +1,4 @@ -from typing import Iterator +from collections.abc import Iterator import math diff --git a/tests/unit_tests/test_cpp_helpers.py b/tests/unit_tests/test_cpp_helpers.py index ad234250ce..497b3966fb 100644 --- a/tests/unit_tests/test_cpp_helpers.py +++ b/tests/unit_tests/test_cpp_helpers.py @@ -1,5 +1,5 @@ import pytest -from mock import Mock +from unittest.mock import Mock from esphome import cpp_helpers as ch from esphome import const