mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Isort preparations (#16555)
* Don't treat typing as an "in-between" module for import order That was a < 3.5 era thing. * Tighten scope of some pylint unused-import disables To avoid isort moving a top level one around, undesirably broadening its scope.
This commit is contained in:
parent
a059cc860a
commit
ee696643cd
@ -7,7 +7,6 @@ import platform
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from typing import List, Dict, Any # noqa pylint: disable=unused-import
|
from typing import List, Dict, Any # noqa pylint: disable=unused-import
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from time import time
|
from time import time
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from typing import Any, Optional, Dict
|
from typing import Any, Optional, Dict
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -6,7 +6,6 @@ https://home-assistant.io/components/apple_tv/
|
|||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from typing import Sequence, TypeVar, Union
|
from typing import Sequence, TypeVar, Union
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -8,7 +8,6 @@ import logging
|
|||||||
import random
|
import random
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from math import pi, cos, sin, radians
|
from math import pi, cos, sin, radians
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from homeassistant.components.geo_location import GeoLocationEvent
|
from homeassistant.components.geo_location import GeoLocationEvent
|
||||||
|
@ -6,6 +6,7 @@ https://home-assistant.io/components/google_assistant/
|
|||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Dict, Any
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
@ -14,7 +15,6 @@ import voluptuous as vol
|
|||||||
|
|
||||||
# Typing imports
|
# Typing imports
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from typing import Dict, Any
|
|
||||||
|
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"""Google Assistant OAuth View."""
|
"""Google Assistant OAuth View."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Dict, Any
|
||||||
|
|
||||||
# Typing imports
|
# Typing imports
|
||||||
# if False:
|
# if False:
|
||||||
from aiohttp.web import Request, Response
|
from aiohttp.web import Request, Response
|
||||||
from typing import Dict, Any
|
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
|
@ -7,7 +7,6 @@ https://home-assistant.io/components/media_player.cast/
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
@ -8,9 +8,7 @@ import asyncio
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from typing import Dict # noqa: F401 pylint: disable=unused-import
|
||||||
# pylint: disable=unused-import
|
|
||||||
from typing import Dict # noqa: F401
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ https://home-assistant.io/components/rachio/
|
|||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from typing import Optional
|
|
||||||
from homeassistant.auth.util import generate_secret
|
from homeassistant.auth.util import generate_secret
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
from homeassistant.const import CONF_API_KEY, EVENT_HOMEASSISTANT_STOP, URL_API
|
from homeassistant.const import CONF_API_KEY, EVENT_HOMEASSISTANT_STOP, URL_API
|
||||||
|
@ -15,7 +15,6 @@ import logging
|
|||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from typing import Any, Dict, Optional # noqa: F401
|
from typing import Any, Dict, Optional # noqa: F401
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -6,8 +6,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
# pylint: disable=unused-import
|
from typing import ( # noqa: F401 pylint: disable=unused-import
|
||||||
from typing import ( # noqa: F401
|
|
||||||
Any, Tuple, Optional, Dict, List, Union, Callable, Sequence, Set)
|
Any, Tuple, Optional, Dict, List, Union, Callable, Sequence, Set)
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -18,8 +18,7 @@ from time import monotonic
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
# pylint: disable=unused-import
|
from typing import ( # noqa: F401 pylint: disable=unused-import
|
||||||
from typing import ( # NOQA
|
|
||||||
Optional, Any, Callable, List, TypeVar, Dict, Coroutine, Set,
|
Optional, Any, Callable, List, TypeVar, Dict, Coroutine, Set,
|
||||||
TYPE_CHECKING, Awaitable, Iterator)
|
TYPE_CHECKING, Awaitable, Iterator)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"""Classes to help gather user submissions."""
|
"""Classes to help gather user submissions."""
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Dict, Any, Callable, Hashable, List, Optional # noqa pylint: disable=unused-import
|
||||||
import uuid
|
import uuid
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from typing import Dict, Any, Callable, Hashable, List, Optional # noqa pylint: disable=unused-import
|
|
||||||
from .core import callback, HomeAssistant
|
from .core import callback, HomeAssistant
|
||||||
from .exceptions import HomeAssistantError
|
from .exceptions import HomeAssistantError
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Helper methods for components within Home Assistant."""
|
"""Helper methods for components within Home Assistant."""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from typing import Any, Iterable, Tuple, Sequence, Dict
|
from typing import Any, Iterable, Tuple, Sequence, Dict
|
||||||
|
|
||||||
from homeassistant.const import CONF_PLATFORM
|
from homeassistant.const import CONF_PLATFORM
|
||||||
|
@ -7,7 +7,6 @@ from urllib.parse import urlparse
|
|||||||
from socket import _GLOBAL_DEFAULT_TIMEOUT
|
from socket import _GLOBAL_DEFAULT_TIMEOUT
|
||||||
import logging
|
import logging
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
from typing import Any, Union, TypeVar, Callable, Sequence, Dict
|
from typing import Any, Union, TypeVar, Callable, Sequence, Dict
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -4,7 +4,6 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
import functools as ft
|
import functools as ft
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
|
|
||||||
from typing import Optional, List, Iterable
|
from typing import Optional, List, Iterable
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -15,9 +15,7 @@ import importlib
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
|
from typing import Optional, Set, TYPE_CHECKING, Callable, Any, TypeVar # noqa pylint: disable=unused-import
|
||||||
# pylint: disable=unused-import
|
|
||||||
from typing import Optional, Set, TYPE_CHECKING, Callable, Any, TypeVar # NOQA
|
|
||||||
|
|
||||||
from homeassistant.const import PLATFORM_FORMAT
|
from homeassistant.const import PLATFORM_FORMAT
|
||||||
from homeassistant.util import OrderedSet
|
from homeassistant.util import OrderedSet
|
||||||
|
@ -5,7 +5,6 @@ import importlib
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from homeassistant.bootstrap import async_mount_local_lib_path
|
from homeassistant.bootstrap import async_mount_local_lib_path
|
||||||
|
@ -6,10 +6,10 @@ import os
|
|||||||
from collections import OrderedDict, namedtuple
|
from collections import OrderedDict, namedtuple
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from platform import system
|
from platform import system
|
||||||
|
from typing import Dict, List, Sequence
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
from typing import Dict, List, Sequence
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import bootstrap, core, loader
|
from homeassistant import bootstrap, core, loader
|
||||||
|
@ -3,7 +3,6 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import homeassistant.config as config_util
|
import homeassistant.config as config_util
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import string
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
from unicodedata import normalize
|
from unicodedata import normalize
|
||||||
|
|
||||||
from typing import (Any, Optional, TypeVar, Callable, KeysView, Union, # noqa
|
from typing import (Any, Optional, TypeVar, Callable, KeysView, Union, # noqa
|
||||||
Iterable, List, Dict, Iterator, Coroutine, MutableSet)
|
Iterable, List, Dict, Iterator, Coroutine, MutableSet)
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
"""Helper methods to handle the time in Home Assistant."""
|
"""Helper methods to handle the time in Home Assistant."""
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import re
|
import re
|
||||||
|
from typing import Any, Dict, Union, Optional, Tuple # noqa pylint: disable=unused-import
|
||||||
# pylint: disable=unused-import
|
|
||||||
from typing import Any, Dict, Union, Optional, Tuple # NOQA
|
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
import pytz.exceptions as pytzexceptions
|
import pytz.exceptions as pytzexceptions
|
||||||
|
@ -4,7 +4,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -32,6 +32,4 @@ indent = " "
|
|||||||
not_skip = __init__.py
|
not_skip = __init__.py
|
||||||
# will group `import x` and `from x import` of the same module.
|
# will group `import x` and `from x import` of the same module.
|
||||||
force_sort_within_sections = true
|
force_sort_within_sections = true
|
||||||
# typing is stdlib on py35 but 3rd party on py34, let it hang in between
|
|
||||||
known_inbetweens = typing
|
|
||||||
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user