Update python version used for pylint [Py310] (#86414)
* Update python version used for pylint linting [Py310] * Import Callable from collections.abc [Py310] * Use builtin anext [Py310]
This commit is contained in:
parent
45b4b0e990
commit
d7dda6bee5
11 changed files with 18 additions and 20 deletions
|
@ -2,11 +2,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from collections.abc import Callable
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any, NamedTuple, Optional
|
||||||
# Issue with Python 3.9.0 and 3.9.1 with collections.abc.Callable
|
|
||||||
# https://bugs.python.org/issue42965
|
|
||||||
from typing import Any, Callable, NamedTuple, Optional
|
|
||||||
|
|
||||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class KNXCommonFlow(ABC, FlowHandler):
|
||||||
# keep a reference to the generator to scan in background until user selects a connection type
|
# keep a reference to the generator to scan in background until user selects a connection type
|
||||||
self._async_scan_gen = self._gatewayscanner.async_scan()
|
self._async_scan_gen = self._gatewayscanner.async_scan()
|
||||||
try:
|
try:
|
||||||
await self._async_scan_gen.__anext__()
|
await anext(self._async_scan_gen)
|
||||||
except StopAsyncIteration:
|
except StopAsyncIteration:
|
||||||
pass # scan finished, no interfaces discovered
|
pass # scan finished, no interfaces discovered
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
"""Support for MQTT message handling."""
|
"""Support for MQTT message handling."""
|
||||||
# pylint: disable=deprecated-typing-alias
|
|
||||||
# In Python 3.9.0 and 3.9.1 collections.abc.Callable
|
|
||||||
# can't be used inside typing.Union or typing.Optional
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Coroutine, Iterable
|
from collections.abc import Callable, Coroutine, Iterable
|
||||||
from functools import lru_cache, partial, wraps
|
from functools import lru_cache, partial, wraps
|
||||||
import inspect
|
import inspect
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
|
@ -13,7 +10,7 @@ import logging
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Union, cast
|
from typing import TYPE_CHECKING, Any, Union, cast
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
|
@ -92,7 +92,7 @@ forced_separate = [
|
||||||
combine_as_imports = true
|
combine_as_imports = true
|
||||||
|
|
||||||
[tool.pylint.MAIN]
|
[tool.pylint.MAIN]
|
||||||
py-version = "3.9"
|
py-version = "3.10"
|
||||||
ignore = [
|
ignore = [
|
||||||
"tests",
|
"tests",
|
||||||
]
|
]
|
||||||
|
@ -164,6 +164,9 @@ good-names = [
|
||||||
# Enable once current issues are fixed:
|
# Enable once current issues are fixed:
|
||||||
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
|
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
|
||||||
# consider-using-assignment-expr (Pylint CodeStyle extension)
|
# consider-using-assignment-expr (Pylint CodeStyle extension)
|
||||||
|
# ---
|
||||||
|
# Temporary for the Python 3.10 update
|
||||||
|
# consider-alternative-union-syntax
|
||||||
disable = [
|
disable = [
|
||||||
"format",
|
"format",
|
||||||
"abstract-method",
|
"abstract-method",
|
||||||
|
@ -188,6 +191,7 @@ disable = [
|
||||||
"consider-using-f-string",
|
"consider-using-f-string",
|
||||||
"consider-using-namedtuple-or-dataclass",
|
"consider-using-namedtuple-or-dataclass",
|
||||||
"consider-using-assignment-expr",
|
"consider-using-assignment-expr",
|
||||||
|
"consider-alternative-union-syntax",
|
||||||
]
|
]
|
||||||
enable = [
|
enable = [
|
||||||
#"useless-suppression", # temporarily every now and then to clean them up
|
#"useless-suppression", # temporarily every now and then to clean them up
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Fixtures for anthemav integration tests."""
|
"""Fixtures for anthemav integration tests."""
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Test the Anthem A/V Receivers config flow."""
|
"""Test the Anthem A/V Receivers config flow."""
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
from unittest.mock import ANY, AsyncMock, patch
|
from unittest.mock import ANY, AsyncMock, patch
|
||||||
|
|
||||||
from anthemav.device_error import DeviceError
|
from anthemav.device_error import DeviceError
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Test the Anthem A/V Receivers config flow."""
|
"""Test the Anthem A/V Receivers config flow."""
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
import collections
|
||||||
|
from collections.abc import Callable
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
from typing import Callable
|
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""Test pushbullet integration."""
|
"""Test pushbullet integration."""
|
||||||
from collections.abc import Awaitable
|
from collections.abc import Awaitable, Callable
|
||||||
from typing import Callable
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Sequence
|
from collections.abc import Callable, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Callable
|
from typing import Any
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
from pyunifiprotect import ProtectApiClient
|
from pyunifiprotect import ProtectApiClient
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""Tests for the WiZ Platform integration."""
|
"""Tests for the WiZ Platform integration."""
|
||||||
|
|
||||||
|
from collections.abc import Callable
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import json
|
import json
|
||||||
from typing import Callable
|
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
from pywizlight import SCENES, BulbType, PilotParser, wizlight
|
from pywizlight import SCENES, BulbType, PilotParser, wizlight
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue