Skip to content

Commit d909d9f

Browse files
committed
updated various pre-commit tools
1 parent 812591c commit d909d9f

File tree

8 files changed

+27
-31
lines changed

8 files changed

+27
-31
lines changed

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ repos:
55
- id: pyupgrade
66
args: [--py37-plus]
77
- repo: https://github.com/psf/black
8-
rev: 19.10b0
8+
rev: 22.1.0
99
hooks:
1010
- id: black
1111
args:
1212
- --safe
1313
- --quiet
1414
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
1515
- repo: https://github.com/codespell-project/codespell
16-
rev: v1.16.0
16+
rev: v2.1.0
1717
hooks:
1818
- id: codespell
1919
args:
@@ -22,15 +22,15 @@ repos:
2222
- --quiet-level=2
2323
exclude_types: [csv, json]
2424
- repo: https://gitlab.com/pycqa/flake8
25-
rev: 3.8.1
25+
rev: 3.9.0
2626
hooks:
2727
- id: flake8
2828
additional_dependencies:
2929
- flake8-docstrings==1.5.0
3030
- pydocstyle==5.0.2
3131
files: ^(homeassistant|script|tests)/.+\.py$
3232
- repo: https://github.com/PyCQA/bandit
33-
rev: 1.6.2
33+
rev: 1.7.2
3434
hooks:
3535
- id: bandit
3636
args:
@@ -39,7 +39,7 @@ repos:
3939
- --configfile=tests/bandit.yaml
4040
files: ^(homeassistant|script|tests)/.+\.py$
4141
- repo: https://github.com/pre-commit/mirrors-isort
42-
rev: v4.3.21
42+
rev: v5.8.0
4343
hooks:
4444
- id: isort
4545
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -49,7 +49,7 @@ repos:
4949
stages: [manual]
5050
- id: check-json
5151
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: v0.770
52+
rev: v0.931
5353
hooks:
5454
- id: mypy
5555
args:

custom_components/watts_vision/binary_sensor.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
from homeassistant.components.binary_sensor import BinarySensorEntity
66
from homeassistant.config_entries import ConfigEntry
7-
from homeassistant.helpers.typing import (
8-
HomeAssistantType,
9-
)
7+
from homeassistant.helpers.typing import HomeAssistantType
108

119
from .const import DOMAIN
1210
from .watts_api import WattsApi

custom_components/watts_vision/climate.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
)
1818
from homeassistant.config_entries import ConfigEntry
1919
from homeassistant.const import TEMP_FAHRENHEIT
20-
from homeassistant.helpers.typing import (
21-
HomeAssistantType,
22-
)
20+
from homeassistant.helpers.typing import HomeAssistantType
2321

2422
from .const import DOMAIN, PRESET_DEFROST, PRESET_OFF, PRESET_PROGRAM
2523
from .watts_api import WattsApi

custom_components/watts_vision/config_flow.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import logging
22
from typing import Any
3-
import voluptuous as vol
43

5-
from homeassistant.config_entries import ConfigFlow, CONN_CLASS_CLOUD_POLL
4+
from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow
65
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
76
from homeassistant.core import HomeAssistant
87
from homeassistant.exceptions import HomeAssistantError
8+
import voluptuous as vol
99

1010
from .const import DOMAIN
1111
from .watts_api import WattsApi

custom_components/watts_vision/sensor.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
from homeassistant.components.sensor import SensorEntity
77
from homeassistant.config_entries import ConfigEntry
8-
from homeassistant.helpers.typing import (
9-
HomeAssistantType,
10-
)
8+
from homeassistant.helpers.typing import HomeAssistantType
119
from numpy import NaN
1210

1311
from .const import DOMAIN
@@ -295,7 +293,7 @@ def device_info(self):
295293
async def async_update(self):
296294
data = await self.hass.async_add_executor_job(self.client.getLastCommunication, self.smartHome)
297295

298-
self._state = "{0} days, {1} hours, {2} minutes and {3} seconds.".format(
296+
self._state = "{} days, {} hours, {} minutes and {} seconds.".format(
299297
data["diffObj"]["days"],
300298
data["diffObj"]["hours"],
301299
data["diffObj"]["minutes"],

custom_components/watts_vision/watts_api.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def getLoginToken(self):
5353
return token
5454
else:
5555
_LOGGER.error(
56-
"Something went wrong fetching token: {0}".format(
56+
"Something went wrong fetching token: {}".format(
5757
request_token_result.status_code
5858
)
5959
)
@@ -74,7 +74,7 @@ def loadData(self):
7474

7575
def loadSmartHomes(self, firstTry: bool = True):
7676
"""Load the user data"""
77-
headers = {"Authorization": "Bearer {}".format(self._token)}
77+
headers = {"Authorization": f"Bearer {self._token}"}
7878
payload = {"token": "true", "email": self._username, "lang": "nl_NL"}
7979

8080
user_data_result = requests.post(
@@ -97,7 +97,7 @@ def loadSmartHomes(self, firstTry: bool = True):
9797
return self.loadSmartHomes(firstTry=False)
9898
else:
9999
_LOGGER.error(
100-
"Something went wrong fetching user data. Code: {0}, Key: {1}, Value: {2}, Data: {3}".format(
100+
"Something went wrong fetching user data. Code: {}, Key: {}, Value: {}, Data: {}".format(
101101
user_data_result.json()["code"]["code"],
102102
user_data_result.json()["code"]["key"],
103103
user_data_result.json()["code"]["value"],
@@ -107,7 +107,7 @@ def loadSmartHomes(self, firstTry: bool = True):
107107
return None
108108
else:
109109
_LOGGER.error(
110-
"Something went wrong fetching user data: {0}".format(
110+
"Something went wrong fetching user data: {}".format(
111111
user_data_result.status_code
112112
)
113113
)
@@ -116,7 +116,7 @@ def loadSmartHomes(self, firstTry: bool = True):
116116
def loadDevices(self, smarthome: str, firstTry: bool = True):
117117
"""Load devices for smart home"""
118118

119-
headers = {"Authorization": "Bearer {}".format(self._token)}
119+
headers = {"Authorization": f"Bearer {self._token}"}
120120
payload = {"token": "true", "smarthome_id": smarthome, "lang": "nl_NL"}
121121

122122
devices_result = requests.post(
@@ -139,7 +139,7 @@ def loadDevices(self, smarthome: str, firstTry: bool = True):
139139
return self.loadDevices(smarthome, firstTry=False)
140140
else:
141141
_LOGGER.error(
142-
"Something went wrong fetching user data. Code: {0}, Key: {1}, Value: {2}, Data: {3}".format(
142+
"Something went wrong fetching user data. Code: {}, Key: {}, Value: {}, Data: {}".format(
143143
devices_result.json()["code"]["code"],
144144
devices_result.json()["code"]["key"],
145145
devices_result.json()["code"]["value"],
@@ -149,7 +149,7 @@ def loadDevices(self, smarthome: str, firstTry: bool = True):
149149
return None
150150
else:
151151
_LOGGER.error(
152-
"Something went wrong fetching devices: {0}".format(
152+
"Something went wrong fetching devices: {}".format(
153153
devices_result.status_code
154154
)
155155
)
@@ -186,7 +186,7 @@ def pushTemperature(
186186
gvMode: str,
187187
firstTry: bool = True,
188188
):
189-
headers = {"Authorization": "Bearer {}".format(self._token)}
189+
headers = {"Authorization": f"Bearer {self._token}"}
190190
payload = {}
191191
if gvMode == "0":
192192
payload = {
@@ -292,7 +292,7 @@ def pushTemperature(
292292
)
293293
else:
294294
_LOGGER.error(
295-
"Something went wrong updating the device. Code: {0}, Key: {1}, Value: {2}, Data: {3}".format(
295+
"Something went wrong updating the device. Code: {}, Key: {}, Value: {}, Data: {}".format(
296296
push_result.json()["code"]["code"],
297297
push_result.json()["code"]["key"],
298298
push_result.json()["code"]["value"],
@@ -302,14 +302,14 @@ def pushTemperature(
302302
return False
303303
else:
304304
_LOGGER.error(
305-
"Something went wrong updating the device: {0}".format(
305+
"Something went wrong updating the device: {}".format(
306306
push_result.status_code
307307
)
308308
)
309309
return False
310310

311311
def getLastCommunication(self, smarthome: str, firstTry: bool = True):
312-
headers = {"Authorization": "Bearer {}".format(self._token)}
312+
headers = {"Authorization": f"Bearer {self._token}"}
313313
payload = {
314314
"token": "true",
315315
"smarthome_id": smarthome,
@@ -336,7 +336,7 @@ def getLastCommunication(self, smarthome: str, firstTry: bool = True):
336336
return self.getLastCommunication(smarthome, firstTry=False)
337337
else:
338338
_LOGGER.error(
339-
"Something went wrong fetching user data. Code: {0}, Key: {1}, Value: {2}, Data: {3}".format(
339+
"Something went wrong fetching user data. Code: {}, Key: {}, Value: {}, Data: {}".format(
340340
last_connection_result.json()["code"]["code"],
341341
last_connection_result.json()["code"]["key"],
342342
last_connection_result.json()["code"]["value"],
@@ -346,7 +346,7 @@ def getLastCommunication(self, smarthome: str, firstTry: bool = True):
346346
return None
347347
else:
348348
_LOGGER.error(
349-
"Something went wrong fetching devices: {0}".format(
349+
"Something went wrong fetching devices: {}".format(
350350
last_connection_result.status_code
351351
)
352352
)

requirements.test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pytest
22
pytest-cov==2.9.0
33
pytest-homeassistant-custom-component
4+
pre-commit

tests/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Testing for Watts Vision Component."""

0 commit comments

Comments
 (0)