Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent 6ce3c81 commit e9c1b75
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create a new release tag with CalVer format."""

import datetime
import operator
import os
Expand Down
26 changes: 17 additions & 9 deletions home_assistant_streamdeck_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,18 @@ class Button(BaseModel, extra="forbid"): # type: ignore[call-arg]
" If while counting the button is pressed again, the timer is cancelled."
" Should be a float or template string that evaluates to a float.",
)
special_type: Literal[
"next-page",
"previous-page",
"empty",
"go-to-page",
"turn-off",
"light-control",
"reload",
] | None = Field(
special_type: (
Literal[
"next-page",
"previous-page",
"empty",
"go-to-page",
"turn-off",
"light-control",
"reload",
]
| None
) = Field(
default=None,
allow_template=False,
description="Special type of button."
Expand Down Expand Up @@ -706,6 +709,7 @@ class AsyncDelayedCallback:
The delay in seconds after which the callback will be called.
callback
The function or coroutine to be called after the delay.
"""

def __init__(
Expand Down Expand Up @@ -904,6 +908,7 @@ def _generate_uniform_hex_colors(n_colors: int) -> tuple[str, ...]:
--------
>>> _generate_uniform_hex_colors(3)
['#0000ff', '#00ff00', '#ff0000']
"""

def generate_hues(n_hues: int) -> list[float]:
Expand Down Expand Up @@ -1640,6 +1645,7 @@ def _url_to_filename(url: str, hash_len: int = 8) -> Path:
-------
Path
The filename with the hash included, if specified.
"""
domain, path = re.findall(r"(?<=://)([a-zA-Z\.]+).*?(/.*)", url)[0]
h = hashlib.sha256(f"{domain}{path}".encode()).hexdigest()[:hash_len]
Expand All @@ -1663,6 +1669,7 @@ def _scale_hex_color(hex_color: str, scale: float) -> str:
Returns
-------
A scaled HEX color in the format "#RRGGBB".
"""
scale = max(0, min(1, scale))
# Convert HEX color to RGB values
Expand Down Expand Up @@ -1715,6 +1722,7 @@ def _convert_svg_to_png(
The name of the file to save the PNG content to.
size
The size of the resulting PNG image.
"""
import cairosvg # importing here because it requires a non Python dep

Expand Down
1 change: 1 addition & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Home Assistant Stream Deck YAML."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions tests/test_yaml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the yaml loading."""

from io import StringIO
from pathlib import Path

Expand Down

0 comments on commit e9c1b75

Please sign in to comment.