Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Mar 8, 2021
1 parent 7335597 commit 6d42f30
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ README content if this was a published component:

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
[![License][license-shield]](LICENSE.md)
[![License][license-shield]][license]

[![hacs][hacs-shield]][hacs]
[![Project Maintenance][maintenance-shield]][user_profile]
Expand Down
17 changes: 10 additions & 7 deletions bin/update_requirements
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
"""Helper script to update requirements."""
import json
import os
import sys

import requests

ROOT = os.path.dirname(os.path.abspath(f"{__file__}/.."))

PKG_PATH = PACKAGE = None
for current_path, dirs, _ in os.walk(f"{ROOT}/custom_components"):
if current_path.find("__pycache__") != -1:
continue
for dname in dirs:
if dname != "__pycache__":
PACKAGE = dname
PKG_PATH = f"{ROOT}/custom_components/{PACKAGE}"
for fname in os.listdir(f"{ROOT}/custom_components"):
if fname != "__pycache__" and os.path.isdir(f"{ROOT}/custom_components/{fname}"):
PACKAGE = fname
PKG_PATH = f"{ROOT}/custom_components/{PACKAGE}"
break

if not PACKAGE:
print("Package not found.")
sys.exit(1)


def get_package(requre: str) -> str:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/integration_blueprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import timedelta

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand All @@ -22,7 +22,7 @@
_LOGGER: logging.Logger = logging.getLogger(__package__)


async def async_setup(hass: HomeAssistant, config: Config):
async def async_setup(hass: HomeAssistant, config):
"""Set up this integration using YAML."""
return True

Expand Down
4 changes: 2 additions & 2 deletions custom_components/integration_blueprint/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from .entity import IntegrationBlueprintEntity


async def async_setup_entry(hass, entry, async_add_devices):
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up binary_sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintBinarySensor(coordinator, entry)])
async_add_entities([IntegrationBlueprintBinarySensor(coordinator, entry)])


class IntegrationBlueprintBinarySensor(IntegrationBlueprintEntity, BinarySensorEntity):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/integration_blueprint/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from .entity import IntegrationBlueprintEntity


async def async_setup_entry(hass, entry, async_add_devices):
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintSensor(coordinator, entry)])
async_add_entities([IntegrationBlueprintSensor(coordinator, entry)])


class IntegrationBlueprintSensor(IntegrationBlueprintEntity):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/integration_blueprint/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from .entity import IntegrationBlueprintEntity


async def async_setup_entry(hass, entry, async_add_devices):
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintBinarySwitch(coordinator, entry)])
async_add_entities([IntegrationBlueprintBinarySwitch(coordinator, entry)])


class IntegrationBlueprintBinarySwitch(IntegrationBlueprintEntity, SwitchEntity):
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=protected-access,redefined-outer-name
"""Global fixtures for integration."""
# Fixtures allow you to replace functions with a Mock object. You can perform
# many options via the Mock to reflect a particular behavior from the original
Expand Down
2 changes: 2 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pylint: disable=protected-access,redefined-outer-name
"""Tests for integration_blueprint api."""

import asyncio

import aiohttp
Expand Down
2 changes: 2 additions & 0 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pylint: disable=protected-access,redefined-outer-name
"""Test integration_blueprint config flow."""

from unittest.mock import patch

import pytest
Expand Down
2 changes: 2 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pylint: disable=protected-access,redefined-outer-name
"""Test integration_blueprint setup process."""

import pytest
from homeassistant.exceptions import ConfigEntryNotReady
from pytest_homeassistant_custom_component.common import MockConfigEntry
Expand Down
2 changes: 2 additions & 0 deletions tests/test_switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pylint: disable=protected-access,redefined-outer-name
"""Test integration_blueprint switch."""

from unittest.mock import call, patch

from homeassistant.components.switch import SERVICE_TURN_OFF, SERVICE_TURN_ON
Expand Down

0 comments on commit 6d42f30

Please sign in to comment.