mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 16:20:42 +00:00
[store_yaml] Address review: ConfigType typing and drop redundant priority override
- Annotate `_final_validate` and `to_code` with `ConfigType` parameter and return types. - Drop the `get_setup_priority()` override on `StoreYamlComponent`; the default `Component::get_setup_priority()` already returns `setup_priority::DATA`, so the override was a no-op.
This commit is contained in:
@@ -11,6 +11,7 @@ import esphome.config_validation as cv
|
||||
from esphome.const import CONF_API, CONF_ID, CONF_RAW_DATA_ID
|
||||
from esphome.core import CORE, EsphomeError, HexInt
|
||||
import esphome.final_validate as fv
|
||||
from esphome.types import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,7 +44,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
||||
def _final_validate(config):
|
||||
def _final_validate(config: ConfigType) -> ConfigType:
|
||||
"""Require API encryption: an unauthenticated client could otherwise pull
|
||||
the embedded YAML (which may include Wi-Fi credentials or opted-in
|
||||
secrets). The escape hatch ``allow_unencrypted_api: true`` exists for
|
||||
@@ -145,7 +146,7 @@ def _pack_envelope(files: list[tuple[str, bytes]]) -> bytes:
|
||||
return b"".join(parts)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
async def to_code(config: ConfigType) -> None:
|
||||
cg.add_define("USE_STORE_YAML")
|
||||
|
||||
zstd = _import_zstd()
|
||||
|
||||
@@ -15,7 +15,6 @@ class StoreYamlComponent : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
||||
|
||||
// Called once from codegen with the PROGMEM blob.
|
||||
void set_data(const uint8_t *data, size_t size, size_t uncompressed_size) {
|
||||
|
||||
Reference in New Issue
Block a user