adjust isort config (#4290)

Fixes #4288.

- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.

Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
This commit is contained in:
Jelle Zijlstra
2020-06-29 00:00:21 -07:00
committed by GitHub
parent cc8344b8c6
commit 0142a87da8
113 changed files with 112 additions and 234 deletions

View File

@@ -1,10 +1,9 @@
import os
import sys
from _typeshed import OpenBinaryMode, OpenTextMode
from types import TracebackType
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload
from _typeshed import OpenBinaryMode, OpenTextMode
_P = TypeVar("_P", bound=PurePath)
if sys.version_info >= (3, 6):

View File

@@ -1,7 +1,6 @@
import sys
from typing import IO, Any, AnyStr, Callable, ContextManager, Generic, Optional, Text, Type, Union
from _typeshed import AnyPath
from typing import IO, Any, AnyStr, Callable, ContextManager, Generic, Optional, Text, Type, Union
def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ...
def move_atomic(src: AnyStr, dst: AnyStr) -> None: ...

View File

@@ -1,7 +1,6 @@
import sys
from logging import Logger
from typing import Dict, Optional, Pattern
from typing_extensions import TypedDict
class _FinalResultType(TypedDict):

View File

@@ -1,5 +1,4 @@
from datetime import date
from typing_extensions import Literal
EASTER_JULIAN: Literal[1]

View File

@@ -6,7 +6,6 @@ from typing import IO, Any, Iterable, Mapping, Optional, Text, TypeVar, Union
from click import BaseCommand
from click.testing import CliRunner, Result
from werkzeug.test import Client
def make_test_environ_builder(

View File

@@ -1,8 +1,7 @@
from _typeshed import AnyPath
from typing import IO, Any, Callable, Iterable, Optional, Protocol, Text, TypeVar, Union
from typing_extensions import Literal
from _typeshed import AnyPath
from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode
missing: Any

View File

@@ -1,8 +1,7 @@
import datetime
import sys
from typing import IO, Any, List, Mapping, MutableMapping, Optional, Text, Type, Union
from _typeshed import StrPath, SupportsWrite
from typing import IO, Any, List, Mapping, MutableMapping, Optional, Text, Type, Union
if sys.version_info >= (3, 6):
_PathLike = StrPath

View File

@@ -1,6 +1,5 @@
from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text
from ..middleware.proxy_fix import ProxyFix as ProxyFix

View File

@@ -1,6 +1,5 @@
from typing import AnyStr, Generic, Tuple
from _typeshed import SupportsWrite
from typing import AnyStr, Generic, Tuple
from ..middleware.profiler import *

View File

@@ -1,4 +1,5 @@
import collections
from _typeshed import SupportsWrite
from typing import (
IO,
Any,
@@ -21,8 +22,6 @@ from typing import (
overload,
)
from _typeshed import SupportsWrite
_K = TypeVar("_K")
_V = TypeVar("_V")
_R = TypeVar("_R")

View File

@@ -1,7 +1,7 @@
import datetime
from _typeshed.wsgi import StartResponse, WSGIEnvironment
from typing import Any, Dict, Iterable, List, NoReturn, Optional, Protocol, Text, Tuple, Type, Union
from _typeshed.wsgi import StartResponse, WSGIEnvironment
from werkzeug.wrappers import Response
class _EnvironContainer(Protocol):

View File

@@ -1,3 +1,4 @@
from _typeshed.wsgi import WSGIEnvironment
from typing import (
IO,
Any,
@@ -15,8 +16,6 @@ from typing import (
Union,
)
from _typeshed.wsgi import WSGIEnvironment
from .datastructures import Headers
_Dict = Any

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed.wsgi import WSGIEnvironment
from datetime import datetime, timedelta
from typing import (
Any,
@@ -17,8 +18,6 @@ from typing import (
overload,
)
from _typeshed.wsgi import WSGIEnvironment
from .datastructures import (
Accept,
Authorization,

View File

@@ -1,6 +1,5 @@
from typing import Any, Iterable, Mapping, Optional, Text
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, Mapping, Optional, Text
class DispatcherMiddleware(object):
app: WSGIApplication

View File

@@ -1,6 +1,5 @@
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text
_Opts = Mapping[Text, Any]
_MutableOpts = MutableMapping[Text, Any]

View File

@@ -1,8 +1,7 @@
import sys
from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple
from _typeshed import SupportsWrite
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple
from ..datastructures import Headers

View File

@@ -1,6 +1,5 @@
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
class ProfilerMiddleware(object):
def __init__(

View File

@@ -1,6 +1,5 @@
from typing import Iterable, Optional
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import Iterable, Optional
class ProxyFix(object):
app: WSGIApplication

View File

@@ -1,7 +1,6 @@
import datetime
from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union
_V = Union[Tuple[Text, Text], Text]

View File

@@ -1,9 +1,7 @@
import sys
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal
if sys.version_info < (3,):
from urllib2 import Request as U2Request

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed.wsgi import InputStream, WSGIEnvironment
from datetime import datetime
from typing import (
Any,
@@ -16,11 +17,8 @@ from typing import (
Union,
overload,
)
from typing_extensions import Literal
from _typeshed.wsgi import InputStream, WSGIEnvironment
from .datastructures import (
Accept,
Authorization,

View File

@@ -1,7 +1,6 @@
from typing import Any, Iterable, Optional, Text
from _typeshed import SupportsRead
from _typeshed.wsgi import InputStream, WSGIEnvironment
from typing import Any, Iterable, Optional, Text
from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware
from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware

View File

@@ -1,6 +1,6 @@
from _typeshed import SupportsRead
from typing import IO, Any, Mapping, Optional, Sequence, Text, Union
from _typeshed import SupportsRead
from yaml.constructor import BaseConstructor, Constructor, SafeConstructor
from yaml.representer import BaseRepresenter, Representer, SafeRepresenter
from yaml.resolver import BaseResolver, Resolver

View File

@@ -2,7 +2,6 @@ import sys
from socket import SocketType
from threading import Lock
from typing import Callable, Mapping, Optional
from typing_extensions import Literal
from . import wasyncore as wasyncore