Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Dec 11, 2023
1 parent 957cadc commit eb6fb84
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 43 deletions.
13 changes: 4 additions & 9 deletions custom_components/gasbuddy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
from __future__ import annotations

import asyncio
from datetime import timedelta
import logging
from datetime import timedelta

from gasbuddy import GasBuddy # pylint: disable=import-self
# pylint: disable-next=import-error,no-name-in-module
from gasbuddy.exceptions import APIError, LibraryError
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from gasbuddy import GasBuddy # pylint: disable=import-self

# pylint: disable-next=import-error,no-name-in-module
from gasbuddy.exceptions import (
APIError,
LibraryError,
)

from .const import (
CONF_INTERVAL,
CONF_STATION_ID,
Expand Down
5 changes: 2 additions & 3 deletions custom_components/gasbuddy/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
import logging
from typing import Any

import gasbuddy
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.util import slugify

import gasbuddy

from .const import (
CONF_NAME,
CONF_INTERVAL,
CONF_NAME,
CONF_POSTAL,
CONF_STATION_ID,
DEFAULT_NAME,
Expand Down
4 changes: 1 addition & 3 deletions custom_components/gasbuddy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

from typing import Final

from homeassistant.components.sensor import (
SensorEntityDescription,
)
from homeassistant.components.sensor import SensorEntityDescription

# config flow
CONF_STATION_ID = "station_id"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/gasbuddy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import Any, Optional

from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import (
Expand Down
22 changes: 10 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[mypy]
python_version = 3.11
show_error_codes = true
ignore_errors = true
follow_imports = silent
ignore_missing_imports = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true

[flake8]
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build
doctests = True
Expand All @@ -16,20 +26,8 @@ ignore =
W504

[isort]
# https://github.com/timothycrosley/isort
# https://github.com/timothycrosley/isort/wiki/isort-Settings
# splits long import on multiple lines indented by 4 spaces
multi_line_output = 3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
indent = " "
# by default isort don't check module indexes
not_skip = __init__.py
# will group `import x` and `from x import` of the same module.
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
known_first_party = custom_components.gasbuddy
combine_as_imports = true
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Global fixtures for gasbuddy integration."""

import pytest
from unittest.mock import patch

import pytest

from tests.const import COORDINATOR_DATA


Expand Down
13 changes: 6 additions & 7 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Test config flow."""

from tests.const import CONFIG_DATA
from unittest.mock import patch

from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.const import CONF_NAME
from homeassistant.data_entry_flow import FlowResult, FlowResultType
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry

from custom_components.gasbuddy.const import (
CONF_INTERVAL,
Expand All @@ -12,12 +16,7 @@
DEFAULT_NAME,
DOMAIN,
)
from tests.const import STATION_LIST

from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.const import CONF_NAME
from pytest_homeassistant_custom_component.common import MockConfigEntry
from homeassistant.data_entry_flow import FlowResult, FlowResultType
from tests.const import CONFIG_DATA, STATION_LIST

pytestmark = pytest.mark.asyncio

Expand Down
6 changes: 2 additions & 4 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Test gasbuddy setup process."""

import pytest

from custom_components.gasbuddy.const import DOMAIN

from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry

from custom_components.gasbuddy.const import DOMAIN
from tests.const import CONFIG_DATA

pytestmark = pytest.mark.asyncio
Expand Down
5 changes: 2 additions & 3 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""Test gasbuddy sensors."""


from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry

from custom_components.gasbuddy.const import DOMAIN

from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from pytest_homeassistant_custom_component.common import MockConfigEntry

from .const import CONFIG_DATA

pytestmark = pytest.mark.asyncio
Expand Down

0 comments on commit eb6fb84

Please sign in to comment.