1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Improve typing via hassfest serializer (#117382)

This commit is contained in:
Jakob Schlyter
2024-05-22 08:22:18 +02:00
committed by GitHub
parent 1985a2ad8b
commit 2e68363755
7 changed files with 18 additions and 7 deletions

View File

@@ -102,6 +102,6 @@ def format_python_namespace(
for key, value in sorted(content.items())
)
if annotations:
# If we had any annotations, add the __future__ import.
code = f"from __future__ import annotations\n{code}"
# If we had any annotations, add __future__ and typing imports.
code = f"from __future__ import annotations\n\nfrom typing import Final\n{code}"
return format_python(code, generator=generator)