Update typing - collections.abc (3) (#63947)

This commit is contained in:
Marc Mueller 2022-01-12 08:04:17 +01:00 committed by GitHub
parent 12757a8cd2
commit d057850971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 42 additions and 33 deletions

View file

@ -2,8 +2,9 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from collections.abc import Iterable
import logging import logging
from typing import Any, Iterable from typing import Any
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,

View file

@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio import asyncio
import collections import collections
from collections import OrderedDict from collections import OrderedDict
from collections.abc import Awaitable, Collection
from contextlib import contextmanager from contextlib import contextmanager
from datetime import datetime, timedelta from datetime import datetime, timedelta
import functools as ft import functools as ft
@ -16,7 +17,7 @@ import threading
import time import time
from time import monotonic from time import monotonic
import types import types
from typing import Any, Awaitable, Collection from typing import Any
from unittest.mock import AsyncMock, Mock, patch from unittest.mock import AsyncMock, Mock, patch
from aiohttp.test_utils import unused_port as get_test_instance_port # noqa: F401 from aiohttp.test_utils import unused_port as get_test_instance_port # noqa: F401

View file

@ -1,7 +1,7 @@
"""Test the Amber Electric Sensors.""" """Test the Amber Electric Sensors."""
from __future__ import annotations from __future__ import annotations
from typing import AsyncGenerator from collections.abc import AsyncGenerator
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from amberelectric.model.channel import ChannelType from amberelectric.model.channel import ChannelType

View file

@ -1,6 +1,6 @@
"""Tests for the Amber config flow.""" """Tests for the Amber config flow."""
from typing import Generator from collections.abc import Generator
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from amberelectric import ApiException from amberelectric import ApiException

View file

@ -1,7 +1,7 @@
"""Tests for the Amber Electric Data Coordinator.""" """Tests for the Amber Electric Data Coordinator."""
from __future__ import annotations from __future__ import annotations
from typing import Generator from collections.abc import Generator
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from amberelectric import ApiException from amberelectric import ApiException

View file

@ -1,5 +1,5 @@
"""Test the Amber Electric Sensors.""" """Test the Amber Electric Sensors."""
from typing import AsyncGenerator from collections.abc import AsyncGenerator
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from amberelectric.model.current_interval import CurrentInterval from amberelectric.model.current_interval import CurrentInterval

View file

@ -2,8 +2,8 @@
from __future__ import annotations from __future__ import annotations
from asyncio import AbstractEventLoop from asyncio import AbstractEventLoop
from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import Callable
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest

View file

@ -1,7 +1,8 @@
"""Tests for the Crownstone integration.""" """Tests for the Crownstone integration."""
from __future__ import annotations from __future__ import annotations
from typing import Generator, Union from collections.abc import Generator
from typing import Union
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
from crownstone_cloud.cloud_models.spheres import Spheres from crownstone_cloud.cloud_models.spheres import Spheres

View file

@ -2,9 +2,9 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from collections.abc import Callable
from contextlib import contextmanager from contextlib import contextmanager
import datetime import datetime
from typing import Callable
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
from flux_led import DeviceType from flux_led import DeviceType

View file

@ -1,7 +1,7 @@
"""Fixtures for Forecast.Solar integration tests.""" """Fixtures for Forecast.Solar integration tests."""
from collections.abc import Generator
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Generator
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
from forecast_solar import models from forecast_solar import models

View file

@ -2,9 +2,10 @@
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable
import copy import copy
from http import HTTPStatus from http import HTTPStatus
from typing import Any, Callable from typing import Any
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
import httplib2 import httplib2

View file

@ -1,7 +1,7 @@
"""Configuration for HEOS tests.""" """Configuration for HEOS tests."""
from __future__ import annotations from __future__ import annotations
from typing import Sequence from collections.abc import Sequence
from unittest.mock import Mock, patch as patch from unittest.mock import Mock, patch as patch
from pyheos import ( from pyheos import (

View file

@ -3,8 +3,7 @@ from __future__ import annotations
import asyncio import asyncio
import base64 import base64
from collections.abc import Awaitable from collections.abc import Awaitable, Callable
from typing import Callable
from unittest.mock import AsyncMock, Mock, patch from unittest.mock import AsyncMock, Mock, patch
from aiohttp import web from aiohttp import web

View file

@ -1,7 +1,7 @@
"""Tests for the Modern Forms integration.""" """Tests for the Modern Forms integration."""
from collections.abc import Callable
import json import json
from typing import Callable
from aiomodernforms.const import COMMAND_QUERY_STATIC_DATA from aiomodernforms.const import COMMAND_QUERY_STATIC_DATA

View file

@ -1,9 +1,9 @@
"""Provide common mysensors fixtures.""" """Provide common mysensors fixtures."""
from __future__ import annotations from __future__ import annotations
from collections.abc import AsyncGenerator, Generator from collections.abc import AsyncGenerator, Callable, Generator
import json import json
from typing import Any, Callable from typing import Any
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
from mysensors.persistence import MySensorsJSONDecoder from mysensors.persistence import MySensorsJSONDecoder

View file

@ -1,7 +1,7 @@
"""Provide tests for mysensors sensor platform.""" """Provide tests for mysensors sensor platform."""
from __future__ import annotations from __future__ import annotations
from typing import Callable from collections.abc import Callable
from mysensors.sensor import Sensor from mysensors.sensor import Sensor
import pytest import pytest

View file

@ -1,7 +1,7 @@
"""Common libraries for test setup.""" """Common libraries for test setup."""
from collections.abc import Awaitable, Callable
import time import time
from typing import Awaitable, Callable
from unittest.mock import patch from unittest.mock import patch
from google_nest_sdm.device_manager import DeviceManager from google_nest_sdm.device_manager import DeviceManager

View file

@ -4,9 +4,9 @@ These tests simulate recent camera events received by the subscriber exposed
as media in the media source. as media in the media source.
""" """
from collections.abc import Generator
import datetime import datetime
from http import HTTPStatus from http import HTTPStatus
from typing import Generator
from unittest.mock import patch from unittest.mock import patch
import aiohttp import aiohttp

View file

@ -1,8 +1,8 @@
"""Common test tools.""" """Common test tools."""
from __future__ import annotations from __future__ import annotations
from collections.abc import AsyncGenerator from collections.abc import AsyncGenerator, Awaitable, Callable
from typing import Awaitable, Callable, cast from typing import cast
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest

View file

@ -3,7 +3,8 @@
from __future__ import annotations from __future__ import annotations
import base64 import base64
from typing import Any, AsyncGenerator, Awaitable, Callable from collections.abc import AsyncGenerator, Awaitable, Callable
from typing import Any
from unittest.mock import patch from unittest.mock import patch
import aiohttp import aiohttp

View file

@ -1,8 +1,8 @@
"""Test script blueprints.""" """Test script blueprints."""
import asyncio import asyncio
from collections.abc import Iterator
import contextlib import contextlib
import pathlib import pathlib
from typing import Iterator
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components import script from homeassistant.components import script

View file

@ -1,9 +1,10 @@
"""Test the Shark IQ vacuum entity.""" """Test the Shark IQ vacuum entity."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Iterable
from copy import deepcopy from copy import deepcopy
import enum import enum
from typing import Any, Iterable from typing import Any
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest

View file

@ -1,9 +1,10 @@
"""The test for the statistics sensor platform.""" """The test for the statistics sensor platform."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Sequence
from datetime import datetime, timedelta from datetime import datetime, timedelta
import statistics import statistics
from typing import Any, Sequence from typing import Any
from unittest.mock import patch from unittest.mock import patch
from homeassistant import config as hass_config from homeassistant import config as hass_config

View file

@ -2,11 +2,12 @@
# pylint: disable=protected-access # pylint: disable=protected-access
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from datetime import timedelta from datetime import timedelta
from ipaddress import IPv4Address from ipaddress import IPv4Address
import json import json
from typing import Any, Callable from typing import Any
from unittest.mock import AsyncMock, Mock, patch from unittest.mock import AsyncMock, Mock, patch
import pytest import pytest

View file

@ -1,7 +1,7 @@
"""Configuration for SSDP tests.""" """Configuration for SSDP tests."""
from __future__ import annotations from __future__ import annotations
from typing import Sequence from collections.abc import Sequence
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
from urllib.parse import urlparse from urllib.parse import urlparse

View file

@ -1,8 +1,9 @@
"""Common code for tests.""" """Common code for tests."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable
from enum import Enum from enum import Enum
from typing import Callable, NamedTuple from typing import NamedTuple
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pyvera as pv import pyvera as pv

View file

@ -1,7 +1,8 @@
"""Vera tests.""" """Vera tests."""
from __future__ import annotations from __future__ import annotations
from typing import Any, Callable from collections.abc import Callable
from typing import Any
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pyvera as pv import pyvera as pv

View file

@ -1,6 +1,6 @@
"""Fixtures for WLED integration tests.""" """Fixtures for WLED integration tests."""
from collections.abc import Generator
import json import json
from typing import Generator
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import pytest import pytest

View file

@ -1,7 +1,7 @@
"""Tests for the coordinator of the WLED integration.""" """Tests for the coordinator of the WLED integration."""
import asyncio import asyncio
from collections.abc import Callable
from copy import deepcopy from copy import deepcopy
from typing import Callable
from unittest.mock import MagicMock from unittest.mock import MagicMock
import pytest import pytest

View file

@ -1,6 +1,6 @@
"""Tests for the WLED integration.""" """Tests for the WLED integration."""
import asyncio import asyncio
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