mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Enable Ruff PTH for the script directory (#124441)
* Enable Ruff PTH for the script directory * Address review comments * Fix translations script * Update script/hassfest/config_flow.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@@ -34,19 +34,15 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
if config.specific_integrations:
|
||||
return
|
||||
|
||||
with open(str(bluetooth_path)) as fp:
|
||||
current = fp.read()
|
||||
if current != content:
|
||||
config.add_error(
|
||||
"bluetooth",
|
||||
"File bluetooth.py is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
return
|
||||
if bluetooth_path.read_text() != content:
|
||||
config.add_error(
|
||||
"bluetooth",
|
||||
"File bluetooth.py is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
|
||||
|
||||
def generate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
"""Generate bluetooth file."""
|
||||
bluetooth_path = config.root / "homeassistant/generated/bluetooth.py"
|
||||
with open(str(bluetooth_path), "w") as fp:
|
||||
fp.write(f"{config.cache['bluetooth']}")
|
||||
bluetooth_path.write_text(f"{config.cache['bluetooth']}")
|
||||
|
||||
Reference in New Issue
Block a user