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,6 +1,5 @@
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
from _typeshed import SupportsReadline
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
DEFAULTSECT: str
MAX_INTERPOLATION_DEPTH: int

View File

@@ -2,6 +2,16 @@
# Python 3, and stub files conform to Python 3 syntax.
import sys
from _typeshed import (
AnyPath,
OpenBinaryMode,
OpenBinaryModeReading,
OpenBinaryModeUpdating,
OpenBinaryModeWriting,
OpenTextMode,
ReadableBuffer,
SupportsWrite,
)
from abc import ABCMeta
from ast import AST, mod
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
@@ -46,20 +56,8 @@ from typing import (
ValuesView,
overload,
)
from typing_extensions import Literal
from _typeshed import (
AnyPath,
OpenBinaryMode,
OpenBinaryModeReading,
OpenBinaryModeUpdating,
OpenBinaryModeWriting,
OpenTextMode,
ReadableBuffer,
SupportsWrite,
)
if sys.version_info >= (3,):
from typing import SupportsBytes, SupportsRound

View File

@@ -1,6 +1,5 @@
from typing import Any, Optional, Pattern
from _typeshed import AnyPath
from typing import Any, Optional, Pattern
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(

View File

@@ -1,6 +1,5 @@
from typing import Any, Union
from _typeshed import FileDescriptorLike
from typing import Any, Union
FASYNC: int
FD_CLOEXEC: int

View File

@@ -1,6 +1,5 @@
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
from _typeshed import SupportsRead
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
class JSONDecodeError(ValueError):
def dumps(self, obj: Any) -> str: ...

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import AnyPath
from builtins import OSError as error
from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
@@ -25,8 +26,6 @@ from typing import (
overload,
)
from _typeshed import AnyPath
from . import path as path
# We need to use something from path, or flake8 and pytype get unhappy

View File

@@ -1,11 +1,10 @@
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from genericpath import exists as exists
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
from _typeshed import AnyPath, BytesPath, StrPath
_T = TypeVar("_T")
if sys.version_info >= (3, 6):

View File

@@ -1,11 +1,10 @@
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from genericpath import exists as exists
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
from _typeshed import AnyPath, BytesPath, StrPath
_T = TypeVar("_T")
if sys.version_info >= (3, 6):