Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use uv as package manager and ruff as linter and formatter #4

Merged
merged 4 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip3 install uv
- run: uv venv
- run: uv sync
- run: uv run ruff check
33 changes: 19 additions & 14 deletions custom_components/binary_sensor_predictor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
"""Binary sensor predictor integration module."""

from logging import getLogger

from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.core import Config, HomeAssistant

_LOGGER = getLogger(__name__)

# pylint: disable=unused-argument
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:

async def async_setup(hass: HomeAssistant, config: Config) -> bool: # noqa: ARG001
"""
Set up the binary sensor predictor integration.

Args:
hass: The Home Assistant instance.
config: The configuration.
hass:
The Home Assistant instance.
config:
The configuration.

Returns:
The value indicates whether the setup succeeded.
"""
return True


async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""
Initialize the predictor sensor based on the config entry.

Args:
hass: The Home Assistant instance.
config_entry: The config entry which contains information gathered by the config flow.
hass:
The Home Assistant instance.
config_entry:
The config entry which contains information gathered by the config flow.

Returns:
The value indicates whether the setup succeeded.
Expand All @@ -38,18 +43,18 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
return True


async def async_unload_entry(
hass: HomeAssistantType, config_entry: ConfigEntry
) -> bool:
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""
Executed when a config entry unloaded by Home Assistant.

Args:
hass: The Home Assistant instance.
config_entry: The config entry being unloaded.
hass:
The Home Assistant instance.
config_entry:
The config entry being unloaded.

Returns:
The value indicates whether the unloading succeeded.
The value indicates whether the unloading succeeded.
"""
await hass.config_entries.async_forward_entry_unload(config_entry, "binary_sensor")

Expand Down
Loading