Skip to content

Commit

Permalink
added flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrErohin committed Nov 19, 2024
1 parent 348cb54 commit 9e582ca
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]

max-line-length = 120
exclude = .git,.github,docs,venv
13 changes: 13 additions & 0 deletions .github/workflows/codechecker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Python Package
on:
pull_request:
push:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run flake8
uses: py-actions/flake8@v2
4 changes: 1 addition & 3 deletions custom_components/tplink_router/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
from tplinkrouterc6u import TPLinkMRClient
from .coordinator import TPLinkRouterCoordinator
from homeassistant.helpers import device_registry
from .sensor import SENSOR_TYPES
from .button import BUTTON_TYPES
from .switch import SWITCH_TYPES

PLATFORMS: list[Platform] = [
Platform.DEVICE_TRACKER,
Expand Down Expand Up @@ -74,6 +71,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_reload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
await hass.config_entries.async_reload(config_entry.entry_id)


def register_services(hass: HomeAssistant, coord: TPLinkRouterCoordinator) -> None:

if not issubclass(coord.router.__class__, TPLinkMRClient):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tplink_router/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
hw_version=firmware.hardware_version,
)

self.scan_stopped_at: datetime|None = None
self.scan_stopped_at: datetime | None = None

super().__init__(
hass,
Expand Down
4 changes: 2 additions & 2 deletions custom_components/tplink_router/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, TypeAlias
from typing import TypeAlias
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.components.device_tracker.const import SourceType
from homeassistant.config_entries import ConfigEntry
Expand All @@ -14,7 +14,7 @@
EVENT_ONLINE,
EVENT_OFFLINE,
)
from tplinkrouterc6u import Device, Connection
from tplinkrouterc6u import Device

MAC_ADDR: TypeAlias = str

Expand Down
3 changes: 1 addition & 2 deletions custom_components/tplink_router/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
from collections.abc import Callable
from typing import Any
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorStateClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import PERCENTAGE, UnitOfInformation
from homeassistant.const import PERCENTAGE
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from .const import DOMAIN
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tplink_router/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .const import DOMAIN
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .coordinator import TPLinkRouterCoordinator
from tplinkrouterc6u import Connection, Status
from tplinkrouterc6u import Connection


@dataclass
Expand Down

0 comments on commit 9e582ca

Please sign in to comment.