diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58a805704..78d664af4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.1 + rev: v0.11.10 hooks: - id: ruff args: diff --git a/supervisor/coresys.py b/supervisor/coresys.py index d523bab9d..41bdfdc26 100644 --- a/supervisor/coresys.py +++ b/supervisor/coresys.py @@ -167,7 +167,7 @@ class CoreSys: @property def dev(self) -> bool: """Return True if we run dev mode.""" - return bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)) + return bool(os.environ.get(ENV_SUPERVISOR_DEV) == "1") @property def timezone(self) -> str: diff --git a/supervisor/docker/manager.py b/supervisor/docker/manager.py index cea569508..6d40e7c25 100644 --- a/supervisor/docker/manager.py +++ b/supervisor/docker/manager.py @@ -83,7 +83,7 @@ class DockerInfo: """Return true, if CONFIG_RT_GROUP_SCHED is loaded.""" if not Path("/sys/fs/cgroup/cpu/cpu.rt_runtime_us").exists(): return False - return bool(os.environ.get(ENV_SUPERVISOR_CPU_RT, 0)) + return bool(os.environ.get(ENV_SUPERVISOR_CPU_RT) == "1") class DockerConfig(FileConfiguration): @@ -202,7 +202,7 @@ class DockerAPI: if "labels" not in kwargs: kwargs["labels"] = {} elif isinstance(kwargs["labels"], list): - kwargs["labels"] = {label: "" for label in kwargs["labels"]} + kwargs["labels"] = dict.fromkeys(kwargs["labels"], "") kwargs["labels"][LABEL_MANAGED] = "" diff --git a/tests/misc/test_filter_data.py b/tests/misc/test_filter_data.py index c51438524..f668419c8 100644 --- a/tests/misc/test_filter_data.py +++ b/tests/misc/test_filter_data.py @@ -103,7 +103,7 @@ def test_not_supported(coresys): def test_is_dev(coresys): """Test if dev.""" coresys.config.diagnostics = True - with patch("os.environ", return_value=[("ENV_SUPERVISOR_DEV", "1")]): + with patch.dict(os.environ, {"SUPERVISOR_DEV": "1"}): assert filter_data(coresys, SAMPLE_EVENT, {}) is None