chore: satisfy custom image backend lint

Issue: #51
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-09-02 21:56:04 +00:00
committed by claude[bot]
parent e56f0f297b
commit b3bcd3df8f
3 changed files with 15 additions and 8 deletions
+2 -1
View File
@@ -12,10 +12,10 @@ import math
import re
import struct
import xml.etree.ElementTree as ET
from xml.parsers import expat
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from xml.parsers import expat
from .const import CONTENT_URL, MAX_DECOR_ASSET_BYTES
@@ -328,6 +328,7 @@ def validate_asset(
# but truncated/corrupt payloads before they enter the authenticated store.
try:
from io import BytesIO
from PIL import Image
with Image.open(BytesIO(data)) as image:
+6 -6
View File
@@ -5,10 +5,10 @@ breaks the connection on a large PDF) but via a plain multipart POST — like me
"""
from __future__ import annotations
import hashlib
import json
import logging
import os
import json
import hashlib
import shutil
import tempfile
from datetime import datetime, timezone
@@ -17,24 +17,24 @@ from pathlib import Path
from aiohttp import web
from homeassistant.components.http import HomeAssistantView
from homeassistant.core import HomeAssistant
try: # KEY_HASS — the modern way to access hass from the aiohttp application
from homeassistant.components.http import KEY_HASS
except ImportError: # older HA versions
KEY_HASS = "hass" # type: ignore[assignment]
from homeassistant.core import HomeAssistant
from .auth import may_write
from .const import (
ASSETS_DIR,
CONTENT_URL,
FILES_DIR,
MAX_EXPORT_BYTES,
MAX_FILES_BYTES,
MAX_FILES_COUNT,
MAX_DECOR_ASSET_BYTES,
MAX_DECOR_ASSETS_BYTES,
MAX_DECOR_ASSETS_COUNT,
MAX_EXPORT_BYTES,
MAX_FILES_BYTES,
MAX_FILES_COUNT,
MIN_FREE_BYTES,
PLANS_DIR,
)
+7 -1
View File
@@ -45,11 +45,17 @@ from .const import (
SUPPORT_PREVIEW_TTL_S,
VERSION,
)
from .decor_assets import ASSET_ID_RE, asset_meta_path, asset_refs, public_asset, read_catalog
from .coordinate_canonicalization import (
canonicalize_config_geometry,
canonicalize_layout_geometry,
)
from .decor_assets import (
ASSET_ID_RE,
asset_meta_path,
asset_refs,
public_asset,
read_catalog,
)
from .import_export import (
ImportFailure,
content_manifest,