mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 08:41:59 +00:00
cleanup
This commit is contained in:
@@ -183,7 +183,7 @@ async def to_code(config):
|
||||
if CORE.using_zephyr:
|
||||
zephyr_add_prj_conf("I2C", True)
|
||||
i2c = "i2c0"
|
||||
if zephyr_data()[KEY_BOARD] in ["xiao_ble"]:
|
||||
if zephyr_data()[KEY_BOARD] == "xiao_ble":
|
||||
i2c = "i2c1"
|
||||
zephyr_add_overlay(
|
||||
f"""
|
||||
|
||||
@@ -213,9 +213,10 @@ def copy_files():
|
||||
zephyr_data()[KEY_OVERLAY],
|
||||
)
|
||||
|
||||
if zephyr_data()[KEY_BOOTLOADER] == BOOTLOADER_MCUBOOT or zephyr_data()[
|
||||
KEY_BOARD
|
||||
] in ["xiao_ble"]:
|
||||
if (
|
||||
zephyr_data()[KEY_BOOTLOADER] == BOOTLOADER_MCUBOOT
|
||||
or zephyr_data()[KEY_BOARD] == "xiao_ble"
|
||||
):
|
||||
fake_board_manifest = """
|
||||
{
|
||||
"frameworks": [
|
||||
|
||||
@@ -2,19 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
from enum import StrEnum as _StrEnum
|
||||
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
"""Partial backport of Python 3.11's StrEnum for our basic use cases."""
|
||||
|
||||
def __new__(cls, value: str, *args: Any, **kwargs: Any) -> StrEnum:
|
||||
"""Create a new StrEnum instance."""
|
||||
if not isinstance(value, str):
|
||||
raise TypeError(f"{value!r} is not a string")
|
||||
return super().__new__(cls, value, *args, **kwargs)
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Return self.value."""
|
||||
return str(self.value)
|
||||
# Re-export StrEnum from standard library for backwards compatibility
|
||||
StrEnum = _StrEnum
|
||||
|
||||
@@ -470,7 +470,7 @@ def wizard(path: Path) -> int:
|
||||
sleep(1)
|
||||
|
||||
# Do not create wifi if the board does not support it
|
||||
if board not in ["rpipico"]:
|
||||
if board != "rpipico":
|
||||
safe_print_step(3, WIFI_BIG)
|
||||
safe_print("In this step, I'm going to create the configuration for WiFi.")
|
||||
safe_print()
|
||||
|
||||
@@ -1574,8 +1574,8 @@ def test_copy_src_tree_writes_build_info_files(
|
||||
mock_component.resources = mock_resources
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = "Test comment"
|
||||
@@ -1649,8 +1649,8 @@ def test_copy_src_tree_detects_config_hash_change(
|
||||
build_info_h_path.write_text("// old build_info_data.h")
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF # Different from existing
|
||||
mock_core.comment = ""
|
||||
@@ -1711,8 +1711,8 @@ def test_copy_src_tree_detects_version_change(
|
||||
build_info_h_path.write_text("// old build_info_data.h")
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = ""
|
||||
@@ -1761,8 +1761,8 @@ def test_copy_src_tree_handles_invalid_build_info_json(
|
||||
build_info_h_path.write_text("// old build_info_data.h")
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = ""
|
||||
@@ -1835,8 +1835,8 @@ def test_copy_src_tree_build_info_timestamp_behavior(
|
||||
mock_component.resources = mock_resources
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = ""
|
||||
@@ -1930,8 +1930,8 @@ def test_copy_src_tree_detects_removed_source_file(
|
||||
existing_file.write_text("// test file")
|
||||
|
||||
# Setup mocks - no components, so the file should be removed
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = ""
|
||||
@@ -1992,8 +1992,8 @@ def test_copy_src_tree_ignores_removed_generated_file(
|
||||
build_info_h.write_text("// old generated file")
|
||||
|
||||
# Setup mocks
|
||||
mock_core.relative_src_path.side_effect = lambda *args: src_path.joinpath(*args)
|
||||
mock_core.relative_build_path.side_effect = lambda *args: build_path.joinpath(*args)
|
||||
mock_core.relative_src_path.side_effect = src_path.joinpath
|
||||
mock_core.relative_build_path.side_effect = build_path.joinpath
|
||||
mock_core.defines = []
|
||||
mock_core.config_hash = 0xDEADBEEF
|
||||
mock_core.comment = ""
|
||||
|
||||
Reference in New Issue
Block a user