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

chore: spellcheck #49

Merged
merged 1 commit into from
Jan 10, 2025
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
3 changes: 2 additions & 1 deletion .github/pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ repos:
stages: [manual]
args:
- --quiet-level=2
- --ignore-words-list=hass,ba,fo
- --ignore-words-list=hass
- --skip=pre-commit-config.yaml

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/get_new_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script to calculate the next beta version."""

import os
import sys

Expand Down
1 change: 1 addition & 0 deletions .github/scripts/pr_extract_labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script to extract the labels for a PR."""

import os
import re
import sys
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bump_version_and_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
last_tag=$(git describe --tags --abbrev=0 origin/main)
echo Last tag: $last_tag
changelog=$(echo -e "## Commits\n";git log --pretty=format:%s $last_tag..refs/heads/dev-current|while read i; do echo "- $i";done)
echo "Calculated next verion: $next_version"
echo "Calculated next version: $next_version"
echo "Changelog: $changelog"
echo "NEW_VERSION=$next_version" >> "$GITHUB_OUTPUT"
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
Expand Down
31 changes: 29 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ minimum_pre_commit_version: 2.11.0
default_stages: [pre-commit, pre-push, manual]
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
Expand All @@ -17,7 +17,7 @@ repos:
- id: isort
args: [--filter-files]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.0
rev: v1.14.1
hooks:
- id: mypy
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -28,11 +28,38 @@ repos:
- id: check-ast
- id: check-docstring-first
- id: check-json
- id: check-toml
- id: debug-statements
- id: check-yaml
- id: detect-private-key
- id: file-contents-sorter
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
- id: pretty-format-json
args: [--autofix]
exclude: 'manifest\.json'
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.4
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
files: ^((custom_components|test)/.+)?[^/]+\.(py|pyi)$
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args:
- --ignore-words-list=hass,commitish,THIRDPARTY,periode
- --skip="./.*,*.csv,*.ambr"
- --quiet-level=2
exclude_types: [csv, json, html]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
files: ^((custom_components|test)/.+)?[^/]+\.(py|pyi)$
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Please note that this project is released with a [Contributor Code of Conduct][c

1. [Fork][fork] and clone the repository
1. Configure and install the dependencies: `yarn install`
1. Make sure the tests pass on your machine: `yarn test`, note: these tests also apply the linter, so no need to lint seperately
1. Make sure the tests pass on your machine: `yarn test`, note: these tests also apply the linter, so no need to lint separately
1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change, add tests, build with `yarn prettier && yarn lint --fix && yarn build` and make sure the tests still pass
1. Push to your fork and [submit a pull request][pr]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ When adding a hub of the integration, it might take 1 minute to complete the add

### Manual

1. Copy the `custom_components/yoin` directory of this repository as `config/custom_components/yoin` in your Home Assistant instalation.
1. Copy the `custom_components/yoin` directory of this repository as `config/custom_components/yoin` in your Home Assistant installation.
2. Restart Home Assistant
3. Add the 'Yoin' integration via HA Settings > 'Devices and Services' > 'Integrations'
4. Provide your Yoin username and password
Expand Down
20 changes: 10 additions & 10 deletions custom_components/yoin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
storage_dir.mkdir(exist_ok=True)
store: Store = Store(hass, 1, f"{DOMAIN}/{entry.entry_id}")
dev_reg = dr.async_get(hass)
hass.data[DOMAIN][entry.entry_id][
"coordinator"
] = coordinator = YoinDataUpdateCoordinator(
hass,
config_entry_id=entry.entry_id,
dev_reg=dev_reg,
client=client,
store=store,
scan_interval=entry.data[CONF_SCAN_INTERVAL],
entry=entry,
hass.data[DOMAIN][entry.entry_id]["coordinator"] = coordinator = (
YoinDataUpdateCoordinator(
hass,
config_entry_id=entry.entry_id,
dev_reg=dev_reg,
client=client,
store=store,
scan_interval=entry.data[CONF_SCAN_INTERVAL],
entry=entry,
)
)

await coordinator.async_config_entry_first_refresh()
Expand Down
1 change: 1 addition & 0 deletions custom_components/yoin/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Binary sensor platform for Yoin."""

from __future__ import annotations

from collections.abc import Callable
Expand Down
7 changes: 4 additions & 3 deletions custom_components/yoin/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Yoin API Client."""

from __future__ import annotations

from calendar import monthrange
Expand Down Expand Up @@ -370,9 +371,9 @@ def fetch_data(self):
)
if period_percentage_completed is not None:
for _, item in data.items():
item.extra_attributes[
"period_percentage_completed"
] = period_percentage_completed
item.extra_attributes["period_percentage_completed"] = (
period_percentage_completed
)
return data

def personal_info(self, customer_id):
Expand Down
13 changes: 3 additions & 10 deletions custom_components/yoin/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from typing import Any

from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.const import (
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
CONF_USERNAME,
)
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowHandler, FlowResult
from homeassistant.helpers.selector import (
Expand All @@ -24,11 +20,7 @@
import voluptuous as vol

from .client import YoinClient
from .const import (
COORDINATOR_MIN_UPDATE_INTERVAL,
DOMAIN,
NAME,
)
from .const import COORDINATOR_MIN_UPDATE_INTERVAL, DOMAIN, NAME
from .exceptions import BadCredentialsException, YoinServiceException
from .models import YoinConfigEntryData

Expand All @@ -40,6 +32,7 @@
scan_interval=COORDINATOR_MIN_UPDATE_INTERVAL,
)


class YoinCommonFlow(ABC, FlowHandler):
"""Base class for Yoin flows."""

Expand Down
1 change: 1 addition & 0 deletions custom_components/yoin/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants used by Yoin."""

import json
from pathlib import Path
from typing import Final
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yoin/entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Yoin entity."""

from __future__ import annotations

from datetime import datetime
Expand Down Expand Up @@ -83,4 +84,3 @@ def available(self) -> bool:
async def async_update(self) -> None:
"""Update the entity. Only used by the generic entity update service."""
return

8 changes: 6 additions & 2 deletions custom_components/yoin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"domain": "yoin",
"name": "Yoin",
"codeowners": ["@geertmeersman"],
"codeowners": [
"@geertmeersman"
],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/geertmeersman/yoin",
"integration_type": "hub",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/geertmeersman/yoin/issues",
"requirements": ["httpx"],
"requirements": [
"httpx"
],
"version": "v0.1.4"
}
1 change: 1 addition & 0 deletions custom_components/yoin/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models used by Yoin."""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
4 changes: 1 addition & 3 deletions custom_components/yoin/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ async def async_setup_entry(
if item.native_unit_of_measurement is not None:
native_unit_of_measurement = item.native_unit_of_measurement
else:
native_unit_of_measurement = (
description.native_unit_of_measurement
)
native_unit_of_measurement = description.native_unit_of_measurement
sensor_description = YoinSensorDescription(
key=str(item.key),
name=item.name,
Expand Down
1 change: 1 addition & 0 deletions custom_components/yoin/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Yoin utils."""

from __future__ import annotations

import re
Expand Down
8 changes: 5 additions & 3 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"country": [
"BE"
],
"filename": "yoin.zip",
"name": "Yoin",
"render_readme": true,
"country": ["BE"],
"zip_release": true,
"filename": "yoin.zip"
"zip_release": true
}
Loading