diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..89529c2 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +image: "python:3.8" + +before_script: + - python --version + - pip3 install flake8 + +stages: + - Static Analysis + +flake8: + stage: Static Analysis + script: + - flake8 --max-line-length=120 neohubapi/*.py + - flake8 --max-line-length=120 scripts/*.py diff --git a/neohubapi/__init__.py b/neohubapi/__init__.py index d7b499b..b671f6d 100644 --- a/neohubapi/__init__.py +++ b/neohubapi/__init__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2020 Andrius Štikonas # SPDX-License-Identifier: LGPL-3.0-or-later -from . import neohub +from . import neohub # noqa: F401 # flake8 should ignore this. diff --git a/neohubapi/neohub.py b/neohubapi/neohub.py index d1abbea..7d79a99 100644 --- a/neohubapi/neohub.py +++ b/neohubapi/neohub.py @@ -6,7 +6,7 @@ import asyncio import datetime import json import logging -from async_property import async_property, async_cached_property +from async_property import async_cached_property from types import SimpleNamespace from neohubapi.enums import ScheduleFormat @@ -196,8 +196,10 @@ class NeoHub: message = {"GET_HOLIDAY": 0} result = await self._send(message) - result.start = datetime.datetime.strptime(result.start.strip(), "%a %b %d %H:%M:%S %Y") if result.start else None - result.end = datetime.datetime.strptime(result.end.strip(), "%a %b %d %H:%M:%S %Y") if result.end else None + result.start = datetime.datetime.strptime( + result.start.strip(), "%a %b %d %H:%M:%S %Y") if result.start else None + result.end = datetime.datetime.strptime( + result.end.strip(), "%a %b %d %H:%M:%S %Y") if result.end else None return result async def cancel_holiday(self): @@ -388,7 +390,7 @@ class NeoHub: message = {"PERMIT_JOIN": [timeout_s, name]} reply = {"result": "network allows joining"} - result = await self._send(message) + result = await self._send(message, reply) return result async def set_lock(self, pin: int, devices: [NeoStat]): diff --git a/neohubapi/neostat.py b/neohubapi/neostat.py index 52062fd..8a12ff4 100644 --- a/neohubapi/neostat.py +++ b/neohubapi/neostat.py @@ -71,7 +71,7 @@ class NeoStat(SimpleNamespace): for a in self._simple_attrs: data_attr = a.upper() if not hasattr(self._data_, data_attr): - self._logger.debug(f"Thermostat object has no attribute {data_attr}") + self._logger.debug(f"Thermostat object has no attribute {data_attr}") self.__dict__[a] = getattr(self._data_, data_attr, None) # Renamed attrs