mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Collection, Iterable, Mapping
|
||||
import shutil
|
||||
import subprocess
|
||||
from typing import Any
|
||||
|
||||
import black
|
||||
from black.mode import Mode
|
||||
|
||||
DEFAULT_GENERATOR = "script.hassfest"
|
||||
|
||||
|
||||
@@ -72,7 +71,14 @@ To update, run python3 -m {generator}
|
||||
|
||||
{content}
|
||||
"""
|
||||
return black.format_str(content.strip(), mode=Mode())
|
||||
ruff = shutil.which("ruff")
|
||||
if not ruff:
|
||||
raise RuntimeError("ruff not found")
|
||||
return subprocess.check_output(
|
||||
[ruff, "format", "-"],
|
||||
input=content.strip(),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def format_python_namespace(
|
||||
|
||||
Reference in New Issue
Block a user