First tox fixes

This commit is contained in:
rospogrigio
2022-05-23 15:31:08 +02:00
parent f85e579a68
commit 6c6b955048
6 changed files with 7 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
"""The LocalTuya integration. """
"""The LocalTuya integration."""
import asyncio
import logging
import time

View File

@@ -10,6 +10,7 @@ import requests
# Signature algorithm.
def calc_sign(msg, key):
"""Calculate signature for request."""
sign = (
hmac.new(
msg=bytes(msg, "latin-1"),
@@ -36,6 +37,7 @@ class TuyaCloudApi:
self._device_list = {}
def generate_payload(self, method, t, url, headers, body=None):
"""Generate signed payload for requests."""
payload = self._client_id + self._access_token + t
payload += method + "\n"

View File

@@ -218,6 +218,7 @@ class TuyaDevice(pytuya.TuyaListener, pytuya.ContextualLogger):
self._connect_task = None
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]
await self._hass.data[DOMAIN][DATA_CLOUD].async_get_devices_list()
cloud_devs = self._hass.data[DOMAIN][DATA_CLOUD]._device_list

View File

@@ -593,6 +593,7 @@ class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow):
return self.async_show_form(step_id="pick_entity_type", data_schema=schema)
def available_dps_strings(self):
"""Return list of DPs use by the device's entities."""
available_dps = []
used_dps = [str(entity[CONF_ID]) for entity in self.entities]
for dp_string in self.dps_strings:

View File

@@ -1,4 +1,4 @@
black==21.4b0
black==22.3.0
codespell==2.0.0
flake8==3.9.2
mypy==0.901
@@ -7,4 +7,3 @@ cryptography==3.3.2
pylint==2.8.2
pylint-strict-informational==0.1
homeassistant==2022.5.1
tox==3.25.0

View File

@@ -27,7 +27,7 @@ ignore_errors = True
deps =
{[testenv]deps}
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
black --fast --check .
pydocstyle -v custom_components