From e721e8c2037f1205b4c8b674d75606e7ab6b5dcf Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 19 Sep 2025 15:54:17 -0600 Subject: [PATCH] preen --- esphome/components/esphome/ota/__init__.py | 2 +- esphome/components/esphome/ota/ota_esphome.cpp | 2 -- esphome/espota2.py | 9 ++++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index 370f50fcbc..72a690b926 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -32,7 +32,7 @@ def supports_sha256() -> bool: return bool(CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny) -def AUTO_LOAD(): +def AUTO_LOAD() -> list[str]: """Conditionally auto-load sha256 only on platforms that support it.""" base_components = ["md5", "socket"] if supports_sha256(): diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index 06fd119c07..8b6235e247 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -102,7 +102,6 @@ static const uint8_t FEATURE_SUPPORTS_COMPRESSION = 0x01; static const uint8_t FEATURE_SUPPORTS_SHA256_AUTH = 0x02; #endif -// Template traits for hash algorithms template struct HashTraits; template<> struct HashTraits { @@ -121,7 +120,6 @@ template<> struct HashTraits { }; #endif -// Template helper for hash-based authentication template bool perform_hash_auth(ESPHomeOTAComponent *ota, const std::string &password) { using Traits = HashTraits; diff --git a/esphome/espota2.py b/esphome/espota2.py index 8215c14cb3..33176cc35f 100644 --- a/esphome/espota2.py +++ b/esphome/espota2.py @@ -9,6 +9,7 @@ import random import socket import sys import time +from typing import Any from esphome.core import EsphomeError from esphome.helpers import resolve_ip_address @@ -228,7 +229,13 @@ def perform_ota( else: upload_contents = file_contents - def perform_auth(sock, password, hash_func, nonce_size, hash_name): + def perform_auth( + sock: socket.socket, + password: str, + hash_func: Any, + nonce_size: int, + hash_name: str, + ) -> None: """Perform challenge-response authentication using specified hash algorithm.""" if not password: raise OTAError("ESP requests password, but no password given!")