mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +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:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from operator import attrgetter
|
||||
import pathlib
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from time import monotonic
|
||||
|
||||
@@ -63,9 +63,9 @@ ALL_PLUGIN_NAMES = [
|
||||
]
|
||||
|
||||
|
||||
def valid_integration_path(integration_path: pathlib.Path | str) -> pathlib.Path:
|
||||
def valid_integration_path(integration_path: Path | str) -> Path:
|
||||
"""Test if it's a valid integration."""
|
||||
path = pathlib.Path(integration_path)
|
||||
path = Path(integration_path)
|
||||
if not path.is_dir():
|
||||
raise argparse.ArgumentTypeError(f"{integration_path} is not a directory.")
|
||||
|
||||
@@ -109,8 +109,8 @@ def get_config() -> Config:
|
||||
)
|
||||
parser.add_argument(
|
||||
"--core-integrations-path",
|
||||
type=pathlib.Path,
|
||||
default=pathlib.Path("homeassistant/components"),
|
||||
type=Path,
|
||||
default=Path("homeassistant/components"),
|
||||
help="Path to core integrations",
|
||||
)
|
||||
parsed = parser.parse_args()
|
||||
@@ -123,14 +123,11 @@ def get_config() -> Config:
|
||||
"Generate is not allowed when limiting to specific integrations"
|
||||
)
|
||||
|
||||
if (
|
||||
not parsed.integration_path
|
||||
and not pathlib.Path("requirements_all.txt").is_file()
|
||||
):
|
||||
if not parsed.integration_path and not Path("requirements_all.txt").is_file():
|
||||
raise RuntimeError("Run from Home Assistant root")
|
||||
|
||||
return Config(
|
||||
root=pathlib.Path(".").absolute(),
|
||||
root=Path().absolute(),
|
||||
specific_integrations=parsed.integration_path,
|
||||
action=parsed.action,
|
||||
requirements=parsed.requirements,
|
||||
|
||||
Reference in New Issue
Block a user