First tox fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
"""The LocalTuya integration. """
|
"""The LocalTuya integration."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
@@ -10,6 +10,7 @@ import requests
|
|||||||
|
|
||||||
# Signature algorithm.
|
# Signature algorithm.
|
||||||
def calc_sign(msg, key):
|
def calc_sign(msg, key):
|
||||||
|
"""Calculate signature for request."""
|
||||||
sign = (
|
sign = (
|
||||||
hmac.new(
|
hmac.new(
|
||||||
msg=bytes(msg, "latin-1"),
|
msg=bytes(msg, "latin-1"),
|
||||||
@@ -36,6 +37,7 @@ class TuyaCloudApi:
|
|||||||
self._device_list = {}
|
self._device_list = {}
|
||||||
|
|
||||||
def generate_payload(self, method, t, url, headers, body=None):
|
def generate_payload(self, method, t, url, headers, body=None):
|
||||||
|
"""Generate signed payload for requests."""
|
||||||
payload = self._client_id + self._access_token + t
|
payload = self._client_id + self._access_token + t
|
||||||
|
|
||||||
payload += method + "\n"
|
payload += method + "\n"
|
||||||
|
@@ -218,6 +218,7 @@ class TuyaDevice(pytuya.TuyaListener, pytuya.ContextualLogger):
|
|||||||
self._connect_task = None
|
self._connect_task = None
|
||||||
|
|
||||||
async def update_local_key(self):
|
async def update_local_key(self):
|
||||||
|
"""Retrieve updated local_key from Cloud API and update the config_entry."""
|
||||||
dev_id = self._dev_config_entry[CONF_DEVICE_ID]
|
dev_id = self._dev_config_entry[CONF_DEVICE_ID]
|
||||||
await self._hass.data[DOMAIN][DATA_CLOUD].async_get_devices_list()
|
await self._hass.data[DOMAIN][DATA_CLOUD].async_get_devices_list()
|
||||||
cloud_devs = self._hass.data[DOMAIN][DATA_CLOUD]._device_list
|
cloud_devs = self._hass.data[DOMAIN][DATA_CLOUD]._device_list
|
||||||
|
@@ -593,6 +593,7 @@ class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
return self.async_show_form(step_id="pick_entity_type", data_schema=schema)
|
return self.async_show_form(step_id="pick_entity_type", data_schema=schema)
|
||||||
|
|
||||||
def available_dps_strings(self):
|
def available_dps_strings(self):
|
||||||
|
"""Return list of DPs use by the device's entities."""
|
||||||
available_dps = []
|
available_dps = []
|
||||||
used_dps = [str(entity[CONF_ID]) for entity in self.entities]
|
used_dps = [str(entity[CONF_ID]) for entity in self.entities]
|
||||||
for dp_string in self.dps_strings:
|
for dp_string in self.dps_strings:
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
black==21.4b0
|
black==22.3.0
|
||||||
codespell==2.0.0
|
codespell==2.0.0
|
||||||
flake8==3.9.2
|
flake8==3.9.2
|
||||||
mypy==0.901
|
mypy==0.901
|
||||||
@@ -7,4 +7,3 @@ cryptography==3.3.2
|
|||||||
pylint==2.8.2
|
pylint==2.8.2
|
||||||
pylint-strict-informational==0.1
|
pylint-strict-informational==0.1
|
||||||
homeassistant==2022.5.1
|
homeassistant==2022.5.1
|
||||||
tox==3.25.0
|
|
||||||
|
2
tox.ini
2
tox.ini
@@ -27,7 +27,7 @@ ignore_errors = True
|
|||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
commands =
|
commands =
|
||||||
codespell -q 4 -L {[tox]cs_exclude_words} --skip="*.pyc,*.pyi,*~" custom_components
|
codespell -q 4 -L {[tox]cs_exclude_words} --skip="*.pyc,*.pyi,*~,*.json" custom_components
|
||||||
flake8 custom_components
|
flake8 custom_components
|
||||||
black --fast --check .
|
black --fast --check .
|
||||||
pydocstyle -v custom_components
|
pydocstyle -v custom_components
|
||||||
|
Reference in New Issue
Block a user