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:
Ville Skyttä 2018-09-11 12:21:48 +03:00 committed by Paulus Schoutsen
parent a059cc860a
commit ee696643cd
26 changed files with 10 additions and 35 deletions

View file

@ -7,7 +7,6 @@ import platform
import subprocess
import sys
import threading
from typing import List, Dict, Any # noqa pylint: disable=unused-import

View file

@ -5,7 +5,6 @@ import os
import sys
from time import time
from collections import OrderedDict
from typing import Any, Optional, Dict
import voluptuous as vol

View file

@ -6,7 +6,6 @@ https://home-assistant.io/components/apple_tv/
"""
import asyncio
import logging
from typing import Sequence, TypeVar, Union
import voluptuous as vol

View file

@ -8,7 +8,6 @@ import logging
import random
from datetime import timedelta
from math import pi, cos, sin, radians
from typing import Optional
from homeassistant.components.geo_location import GeoLocationEvent

View file

@ -6,6 +6,7 @@ https://home-assistant.io/components/google_assistant/
"""
import asyncio
import logging
from typing import Dict, Any
import aiohttp
import async_timeout
@ -14,7 +15,6 @@ import voluptuous as vol
# Typing imports
from homeassistant.core import HomeAssistant
from typing import Dict, Any
from homeassistant.const import CONF_NAME
from homeassistant.helpers import config_validation as cv

View file

@ -1,11 +1,11 @@
"""Google Assistant OAuth View."""
import logging
from typing import Dict, Any
# Typing imports
# if False:
from aiohttp.web import Request, Response
from typing import Dict, Any
from homeassistant.core import HomeAssistant
from homeassistant.components.http import HomeAssistantView

View file

@ -7,7 +7,6 @@ https://home-assistant.io/components/media_player.cast/
import asyncio
import logging
import threading
from typing import Optional, Tuple
import attr

View file

@ -8,9 +8,7 @@ import asyncio
from datetime import timedelta
import logging
from urllib.parse import urlparse
# pylint: disable=unused-import
from typing import Dict # noqa: F401
from typing import Dict # noqa: F401 pylint: disable=unused-import
import voluptuous as vol

View file

@ -6,10 +6,10 @@ https://home-assistant.io/components/rachio/
"""
import asyncio
import logging
from typing import Optional
from aiohttp import web
import voluptuous as vol
from typing import Optional
from homeassistant.auth.util import generate_secret
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_API_KEY, EVENT_HOMEASSISTANT_STOP, URL_API

View file

@ -15,7 +15,6 @@ import logging
import queue
import threading
import time
from typing import Any, Dict, Optional # noqa: F401
import voluptuous as vol

View file

@ -6,8 +6,7 @@ import logging
import os
import re
import shutil
# pylint: disable=unused-import
from typing import ( # noqa: F401
from typing import ( # noqa: F401 pylint: disable=unused-import
Any, Tuple, Optional, Dict, List, Union, Callable, Sequence, Set)
from types import ModuleType
import voluptuous as vol

View file

@ -18,8 +18,7 @@ from time import monotonic
import uuid
from types import MappingProxyType
# pylint: disable=unused-import
from typing import ( # NOQA
from typing import ( # noqa: F401 pylint: disable=unused-import
Optional, Any, Callable, List, TypeVar, Dict, Coroutine, Set,
TYPE_CHECKING, Awaitable, Iterator)

View file

@ -1,8 +1,8 @@
"""Classes to help gather user submissions."""
import logging
from typing import Dict, Any, Callable, Hashable, List, Optional # noqa pylint: disable=unused-import
import uuid
import voluptuous as vol
from typing import Dict, Any, Callable, Hashable, List, Optional # noqa pylint: disable=unused-import
from .core import callback, HomeAssistant
from .exceptions import HomeAssistantError

View file

@ -1,6 +1,5 @@
"""Helper methods for components within Home Assistant."""
import re
from typing import Any, Iterable, Tuple, Sequence, Dict
from homeassistant.const import CONF_PLATFORM

View file

@ -7,7 +7,6 @@ from urllib.parse import urlparse
from socket import _GLOBAL_DEFAULT_TIMEOUT
import logging
import inspect
from typing import Any, Union, TypeVar, Callable, Sequence, Dict
import voluptuous as vol

View file

@ -4,7 +4,6 @@ from datetime import timedelta
import logging
import functools as ft
from timeit import default_timer as timer
from typing import Optional, List, Iterable
from homeassistant.const import (

View file

@ -2,7 +2,6 @@
from datetime import datetime
import json
import logging
from typing import Any
_LOGGER = logging.getLogger(__name__)

View file

@ -15,9 +15,7 @@ import importlib
import logging
import sys
from types import ModuleType
# pylint: disable=unused-import
from typing import Optional, Set, TYPE_CHECKING, Callable, Any, TypeVar # NOQA
from typing import Optional, Set, TYPE_CHECKING, Callable, Any, TypeVar # noqa pylint: disable=unused-import
from homeassistant.const import PLATFORM_FORMAT
from homeassistant.util import OrderedSet

View file

@ -5,7 +5,6 @@ import importlib
import logging
import os
import sys
from typing import List
from homeassistant.bootstrap import async_mount_local_lib_path

View file

@ -6,10 +6,10 @@ import os
from collections import OrderedDict, namedtuple
from glob import glob
from platform import system
from typing import Dict, List, Sequence
from unittest.mock import patch
import attr
from typing import Dict, List, Sequence
import voluptuous as vol
from homeassistant import bootstrap, core, loader

View file

@ -3,7 +3,6 @@ import argparse
import json
import os
import sys
from typing import List
import homeassistant.config as config_util

View file

@ -2,7 +2,6 @@
import argparse
import sys
from typing import List

View file

@ -11,7 +11,6 @@ import string
from functools import wraps
from types import MappingProxyType
from unicodedata import normalize
from typing import (Any, Optional, TypeVar, Callable, KeysView, Union, # noqa
Iterable, List, Dict, Iterator, Coroutine, MutableSet)

View file

@ -1,9 +1,7 @@
"""Helper methods to handle the time in Home Assistant."""
import datetime as dt
import re
# pylint: disable=unused-import
from typing import Any, Dict, Union, Optional, Tuple # NOQA
from typing import Any, Dict, Union, Optional, Tuple # noqa pylint: disable=unused-import
import pytz
import pytz.exceptions as pytzexceptions

View file

@ -4,7 +4,6 @@ import logging
import os
from subprocess import PIPE, Popen
import sys
from typing import Optional
_LOGGER = logging.getLogger(__name__)

View file

@ -32,6 +32,4 @@ indent = " "
not_skip = __init__.py
# will group `import x` and `from x import` of the same module.
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