Import Callable from collections.abc (1) (#56775)

This commit is contained in:
Marc Mueller 2021-09-29 16:32:11 +02:00 committed by GitHub
parent d51487f82a
commit 77ee72cbb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 73 additions and 58 deletions

View File

@ -1,8 +1,9 @@
"""Permissions for Home Assistant."""
from __future__ import annotations
from collections.abc import Callable
import logging
from typing import Any, Callable
from typing import Any
import voluptuous as vol

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from collections import OrderedDict
from typing import Callable
from collections.abc import Callable
import voluptuous as vol

View File

@ -2,14 +2,14 @@
from __future__ import annotations
from collections import OrderedDict
from collections.abc import Sequence
from collections.abc import Callable, Sequence
import logging
import os
from pathlib import Path
import re
import shutil
from types import ModuleType
from typing import Any, Callable
from typing import Any
from urllib.parse import urlparse
from awesomeversion import AwesomeVersion

View File

@ -2,12 +2,12 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable
from collections.abc import Awaitable, Callable
from contextlib import suppress
from ssl import SSLContext
import sys
from types import MappingProxyType
from typing import Any, Callable, cast
from typing import Any, cast
import aiohttp
from aiohttp import web

View File

@ -9,11 +9,11 @@ from __future__ import annotations
from abc import ABC, ABCMeta, abstractmethod
import asyncio
from collections.abc import Awaitable
from collections.abc import Awaitable, Callable
import logging
import secrets
import time
from typing import Any, Callable, Dict, cast
from typing import Any, Dict, cast
from aiohttp import client, web
import async_timeout

View File

@ -1,7 +1,7 @@
"""Helpers for config validation using voluptuous."""
from __future__ import annotations
from collections.abc import Hashable
from collections.abc import Callable, Hashable
from datetime import (
date as date_sys,
datetime as datetime_sys,
@ -15,7 +15,7 @@ from numbers import Number
import os
import re
from socket import _GLOBAL_DEFAULT_TIMEOUT # type: ignore # private, not in typeshed
from typing import Any, Callable, Dict, TypeVar, cast
from typing import Any, Dict, TypeVar, cast
from urllib.parse import urlparse
from uuid import UUID

View File

@ -2,9 +2,9 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable
from collections.abc import Awaitable, Callable
from logging import Logger
from typing import Any, Callable
from typing import Any
from homeassistant.core import HassJob, HomeAssistant, callback

View File

@ -1,10 +1,11 @@
"""Deprecation helpers for Home Assistant."""
from __future__ import annotations
from collections.abc import Callable
import functools
import inspect
import logging
from typing import Any, Callable
from typing import Any
from ..helpers.frame import MissingIntegrationFrame, get_integration_frame

View File

@ -7,7 +7,8 @@ There are two different types of discoveries that can be fired/listened for.
"""
from __future__ import annotations
from typing import Any, Callable, TypedDict
from collections.abc import Callable
from typing import Any, TypedDict
from homeassistant import core, setup
from homeassistant.core import CALLBACK_TYPE

View File

@ -1,6 +1,9 @@
"""Helpers for Home Assistant dispatcher & internal component/platform."""
from __future__ import annotations
from collections.abc import Callable
import logging
from typing import Any, Callable
from typing import Any
from homeassistant.core import HassJob, HomeAssistant, callback
from homeassistant.loader import bind_hass

View File

@ -2,12 +2,12 @@
from __future__ import annotations
import asyncio
from collections.abc import Iterable
from collections.abc import Callable, Iterable
from datetime import timedelta
from itertools import chain
import logging
from types import ModuleType
from typing import Any, Callable
from typing import Any
import voluptuous as vol

View File

@ -2,13 +2,13 @@
from __future__ import annotations
import asyncio
from collections.abc import Coroutine, Iterable
from collections.abc import Callable, Coroutine, Iterable
from contextvars import ContextVar
from datetime import datetime, timedelta
import logging
from logging import Logger
from types import ModuleType
from typing import TYPE_CHECKING, Any, Callable, Protocol
from typing import TYPE_CHECKING, Any, Protocol
import voluptuous as vol

View File

@ -10,9 +10,9 @@ timer.
from __future__ import annotations
from collections import OrderedDict
from collections.abc import Iterable, Mapping
from collections.abc import Callable, Iterable, Mapping
import logging
from typing import TYPE_CHECKING, Any, Callable, cast
from typing import TYPE_CHECKING, Any, cast
import attr

View File

@ -1,9 +1,9 @@
"""Helper class to implement include/exclude of entities and domains."""
from __future__ import annotations
from collections.abc import Callable
import fnmatch
import re
from typing import Callable
import voluptuous as vol

View File

@ -2,10 +2,11 @@
from __future__ import annotations
import asyncio
from collections.abc import Callable
import functools
import logging
from traceback import FrameSummary, extract_stack
from typing import Any, Callable, TypeVar, cast
from typing import Any, TypeVar, cast
from homeassistant.exceptions import HomeAssistantError

View File

@ -1,8 +1,9 @@
"""Helper for httpx."""
from __future__ import annotations
from collections.abc import Callable
import sys
from typing import Any, Callable
from typing import Any
import httpx

View File

@ -2,9 +2,9 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable
from collections.abc import Awaitable, Callable
import logging
from typing import Any, Callable
from typing import Any
from homeassistant.core import Event, HomeAssistant
from homeassistant.loader import async_get_integration, bind_hass

View File

@ -1,10 +1,10 @@
"""Module to coordinate user intentions."""
from __future__ import annotations
from collections.abc import Iterable
from collections.abc import Callable, Iterable
import logging
import re
from typing import Any, Callable, Dict
from typing import Any, Dict
import voluptuous as vol

View File

@ -2,10 +2,10 @@
from __future__ import annotations
import asyncio
from collections.abc import Hashable
from collections.abc import Callable, Hashable
from datetime import datetime, timedelta
import logging
from typing import Any, Callable
from typing import Any
from homeassistant.core import HomeAssistant, callback
import homeassistant.util.dt as dt_util

View File

@ -2,14 +2,14 @@
from __future__ import annotations
import asyncio
from collections.abc import Sequence
from collections.abc import Callable, Sequence
from contextlib import asynccontextmanager, suppress
from datetime import datetime, timedelta
from functools import partial
import itertools
import logging
from types import MappingProxyType
from typing import Any, Callable, Dict, TypedDict, Union, cast
from typing import Any, Dict, TypedDict, Union, cast
import async_timeout
import voluptuous as vol

View File

@ -1,7 +1,8 @@
"""Selectors for Home Assistant."""
from __future__ import annotations
from typing import Any, Callable, cast
from collections.abc import Callable
from typing import Any, cast
import voluptuous as vol

View File

@ -2,11 +2,11 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable, Iterable
from collections.abc import Awaitable, Callable, Iterable
import dataclasses
from functools import partial, wraps
import logging
from typing import TYPE_CHECKING, Any, Callable, TypedDict
from typing import TYPE_CHECKING, Any, TypedDict
import voluptuous as vol

View File

@ -1,6 +1,7 @@
"""Helpers to help during startup."""
from collections.abc import Awaitable
from typing import Callable
from __future__ import annotations
from collections.abc import Awaitable, Callable
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.core import Event, HomeAssistant, callback

View File

@ -2,11 +2,12 @@
from __future__ import annotations
import asyncio
from collections.abc import Callable
from contextlib import suppress
from json import JSONEncoder
import logging
import os
from typing import Any, Callable
from typing import Any
from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE
from homeassistant.core import CALLBACK_TYPE, CoreState, Event, HomeAssistant, callback

View File

@ -5,7 +5,7 @@ from ast import literal_eval
import asyncio
import base64
import collections.abc
from collections.abc import Generator, Iterable
from collections.abc import Callable, Generator, Iterable
from contextlib import suppress
from contextvars import ContextVar
from datetime import datetime, timedelta
@ -17,7 +17,7 @@ from operator import attrgetter
import random
import re
import sys
from typing import Any, Callable, cast
from typing import Any, cast
from urllib.parse import urlencode as urllib_urlencode
import weakref

View File

@ -2,11 +2,11 @@
from __future__ import annotations
from collections import deque
from collections.abc import Generator
from collections.abc import Callable, Generator
from contextlib import contextmanager
from contextvars import ContextVar
from functools import wraps
from typing import Any, Callable, cast
from typing import Any, cast
from homeassistant.helpers.typing import TemplateVarsType
import homeassistant.util.dt as dt_util

View File

@ -2,8 +2,9 @@
from __future__ import annotations
import asyncio
from collections.abc import Callable
import logging
from typing import Any, Callable
from typing import Any
import voluptuous as vol

View File

@ -2,11 +2,11 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable
from collections.abc import Awaitable, Callable
from datetime import datetime, timedelta
import logging
from time import monotonic
from typing import Callable, Generic, TypeVar
from typing import Generic, TypeVar
import urllib.error
import aiohttp

View File

@ -4,12 +4,13 @@ from __future__ import annotations
import argparse
import asyncio
import collections
from collections.abc import Callable
from contextlib import suppress
from datetime import datetime
import json
import logging
from timeit import default_timer as timer
from typing import Callable, TypeVar
from typing import TypeVar
from homeassistant import core
from homeassistant.components.websocket_api.const import JSON_DUMP

View File

@ -4,11 +4,11 @@ from __future__ import annotations
import argparse
import asyncio
from collections import OrderedDict
from collections.abc import Mapping, Sequence
from collections.abc import Callable, Mapping, Sequence
from glob import glob
import logging
import os
from typing import Any, Callable
from typing import Any
from unittest.mock import patch
from homeassistant import core

View File

@ -2,12 +2,11 @@
from __future__ import annotations
import asyncio
from collections.abc import Awaitable, Generator, Iterable
from collections.abc import Awaitable, Callable, Generator, Iterable
import contextlib
import logging.handlers
from timeit import default_timer as timer
from types import ModuleType
from typing import Callable
from homeassistant import config as conf_util, core, loader, requirements
from homeassistant.config import async_notify_setup_error

View File

@ -2,7 +2,7 @@
from __future__ import annotations
import asyncio
from collections.abc import Coroutine, Iterable, KeysView
from collections.abc import Callable, Coroutine, Iterable, KeysView
from datetime import datetime, timedelta
import enum
from functools import lru_cache, wraps
@ -12,7 +12,7 @@ import socket
import string
import threading
from types import MappingProxyType
from typing import Any, Callable, TypeVar
from typing import Any, TypeVar
import slugify as unicode_slug

View File

@ -3,13 +3,13 @@ from __future__ import annotations
from asyncio import Semaphore, coroutines, ensure_future, gather, get_running_loop
from asyncio.events import AbstractEventLoop
from collections.abc import Awaitable, Coroutine
from collections.abc import Awaitable, Callable, Coroutine
import concurrent.futures
import functools
import logging
import threading
from traceback import extract_stack
from typing import Any, Callable, TypeVar
from typing import Any, TypeVar
_LOGGER = logging.getLogger(__name__)

View File

@ -1,6 +1,8 @@
"""Decorator utility functions."""
from collections.abc import Hashable
from typing import Callable, TypeVar
from __future__ import annotations
from collections.abc import Callable, Hashable
from typing import TypeVar
CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name

View File

@ -1,8 +1,8 @@
"""Distance util functions."""
from __future__ import annotations
from collections.abc import Callable
from numbers import Number
from typing import Callable
from homeassistant.const import (
LENGTH,

View File

@ -2,11 +2,12 @@
from __future__ import annotations
from collections import deque
from collections.abc import Callable
import json
import logging
import os
import tempfile
from typing import Any, Callable
from typing import Any
from homeassistant.core import Event, State
from homeassistant.exceptions import HomeAssistantError