Add pylint checks

This commit is contained in:
Andre Basche 2023-07-12 19:36:32 +02:00
parent 2788a3ac91
commit b0e3b15ff0
16 changed files with 47 additions and 39 deletions

View file

@ -21,7 +21,7 @@ class HonDevice:
return self._os_version
@property
def os(self) -> str:
def os_type(self) -> str:
return self._os
@property
@ -36,7 +36,7 @@ class HonDevice:
result: Dict[str, str | int] = {
"appVersion": self.app_version,
"mobileId": self.mobile_id,
"os": self.os,
"os": self.os_type,
"osVersion": self.os_version,
"deviceModel": self.device_model,
}

View file

@ -1,8 +1,8 @@
import logging
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from contextlib import asynccontextmanager, _AsyncGeneratorContextManager
from types import TracebackType
from typing import Optional, Dict, Type, Any, Protocol
from typing import Optional, Dict, Type, Any, Callable, Coroutine, AsyncGenerator
import aiohttp
from typing_extensions import Self
@ -47,10 +47,11 @@ class ConnectionHandler:
return self
@asynccontextmanager
def _intercept(
async def _intercept(
self, method: Callback, url: str | URL, *args: Any, **kwargs: Dict[str, Any]
) -> AsyncIterator[aiohttp.ClientResponse]:
raise NotImplementedError
async with method(url, *args, **kwargs) as response:
yield response
@asynccontextmanager
async def get(

View file

@ -95,11 +95,11 @@ class HonConnectionHandler(ConnectionHandler):
try:
await response.json()
yield response
except json.JSONDecodeError:
except json.JSONDecodeError as exc:
_LOGGER.warning(
"%s - JsonDecodeError %s - %s",
response.request_info.url,
response.status,
await response.text(),
)
raise HonAuthenticationError("Decode Error")
raise HonAuthenticationError("Decode Error") from exc