mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-09 21:34:04 +02:00
[pre-commit.ci] pre-commit autoupdate (#1229)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.16.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.16.5) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 25.1.0 → 26.5.1](https://github.com/psf/black-pre-commit-mirror/compare/25.1.0...26.5.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci: preserve Ruff lint baseline --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bas Nijholt <bas@nijho.lt>
This commit is contained in:
parent
6b7dbc3a66
commit
4c1140c517
5 changed files with 14 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: trailing-whitespace
|
||||
|
|
@ -8,11 +8,11 @@ repos:
|
|||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.11.13
|
||||
rev: v0.16.5
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--fix"]
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 25.1.0
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 26.5.1
|
||||
hooks:
|
||||
- id: black
|
||||
|
|
|
|||
10
.ruff.toml
10
.ruff.toml
|
|
@ -1,6 +1,6 @@
|
|||
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
|
||||
|
||||
target-version = "py310"
|
||||
target-version = "py312"
|
||||
[lint]
|
||||
select = ["ALL"]
|
||||
|
||||
|
|
@ -8,19 +8,23 @@ select = ["ALL"]
|
|||
# by the codebase. The plan is to fix them all (when sensible) and then enable them.
|
||||
ignore = [
|
||||
"ANN",
|
||||
"ANN101", # Missing type annotation for {name} in method
|
||||
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
|
||||
"CPY001", # Missing copyright notice at top of file
|
||||
"D401", # First line of docstring should be in imperative mood
|
||||
"E501", # line too long
|
||||
"FBT001", # Boolean positional arg in function definition
|
||||
"FBT002", # Boolean default value in function definition
|
||||
"FIX004", # Line contains HACK, consider resolving the issue
|
||||
"PD901", # df is a bad variable name. Be kinder to your future self.
|
||||
"PERF203", # `try`-`except` within a loop incurs performance overhead
|
||||
"PLC0415", # `import` should be at the top-level of a file
|
||||
"PLR0913", # Too many arguments to function call (N > 5)
|
||||
"PLR0917", # Too many positional arguments
|
||||
"PLR2004", # Magic value used in comparison, consider replacing X with a constant variable
|
||||
"RUF059", # Unpacked variable is never used
|
||||
"S101", # Use of assert detected
|
||||
"SLF001", # Private member accessed
|
||||
"UP017", # Use datetime.UTC alias
|
||||
"UP042", # Replace str, Enum inheritance with StrEnum
|
||||
]
|
||||
|
||||
[lint.per-file-ignores]
|
||||
|
|
|
|||
|
|
@ -3028,7 +3028,7 @@ class AdaptiveLightingManager:
|
|||
|
||||
|
||||
class _AsyncSingleShotTimer:
|
||||
def __init__(self, delay: float, callback: Callable[[], None | Any]) -> None:
|
||||
def __init__(self, delay: float, callback: Callable[[], Any | None]) -> None:
|
||||
"""Initialize the timer."""
|
||||
self.delay = delay
|
||||
self.callback = callback
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def get_ha_core_versions() -> list[str]:
|
|||
# Paginate through all tags to ensure we get older versions too
|
||||
while True:
|
||||
url = f"https://api.github.com/repos/home-assistant/core/tags?per_page=100&page={page}"
|
||||
with urllib.request.urlopen(url) as response: # noqa: S310
|
||||
with urllib.request.urlopen(url) as response:
|
||||
tags = json.loads(response.read().decode())
|
||||
|
||||
if not tags:
|
||||
|
|
|
|||
|
|
@ -1697,7 +1697,7 @@ async def test_offset_too_large(hass):
|
|||
which makes the adaptive lighting algorithm fail with a ValueError.
|
||||
"""
|
||||
_, switch = await setup_switch(hass, {CONF_SUNRISE_OFFSET: 3600 * 12})
|
||||
with pytest.raises(ValueError, match="sun events.*not in the expected order"):
|
||||
with pytest.raises(ValueError, match=r"sun events.*not in the expected order"):
|
||||
await switch._update_attrs_and_maybe_adapt_lights(
|
||||
context=switch.create_context("test"),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue