mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 20:12:08 +08:00
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:
@@ -16,7 +16,6 @@ import array
|
||||
import mmap
|
||||
import sys
|
||||
from typing import Protocol, Text, TypeVar, Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, List, NamedTuple, Optional, Text, Tuple, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
_IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from socket import SocketType
|
||||
from typing import Any, Dict, Optional, Tuple, Union, overload
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
# cyclic dependence with asynchat
|
||||
_maptype = Dict[int, Any]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import io
|
||||
import sys
|
||||
from typing import IO, Any, Optional, TextIO, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import IO, Any, Optional, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
def reset() -> str: ... # undocumented
|
||||
|
||||
@@ -20,7 +20,6 @@ from typing import (
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: this only satisfies the most common interface, where
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def input(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import SupportsRead, SupportsReadline
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from types import TracebackType
|
||||
@@ -20,8 +21,6 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from _typeshed import SupportsRead, SupportsReadline
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_IntOrStr = Union[int, Text]
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# Stubs for hmac
|
||||
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from types import ModuleType
|
||||
from typing import Any, AnyStr, Callable, Optional, Union, overload
|
||||
|
||||
from _typeshed import ReadableBuffer
|
||||
|
||||
_B = Union[bytes, bytearray]
|
||||
|
||||
# TODO more precise type for object of hashlib
|
||||
|
||||
@@ -4,7 +4,6 @@ import time
|
||||
from socket import socket as _socket
|
||||
from ssl import SSLContext, SSLSocket
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Pattern, Text, Tuple, Type, Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: Commands should use their actual return types, not this type alias.
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from _typeshed import StrPath
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
from lib2to3.pytree import _NL, _Convert
|
||||
from logging import Logger
|
||||
from typing import IO, Any, Iterable, Optional, Text
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
class Driver:
|
||||
grammar: Grammar
|
||||
logger: Logger
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Dict, List, Optional, Text, Tuple, TypeVar
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import Dict, List, Optional, Text, Tuple, TypeVar
|
||||
|
||||
_P = TypeVar("_P")
|
||||
_Label = Tuple[int, Optional[Text]]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from _typeshed import StrPath
|
||||
from lib2to3.pgen2 import grammar
|
||||
from lib2to3.pgen2.tokenize import _TokenInfo
|
||||
from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Optional, Text, Tuple
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
class PgenGrammar(grammar.Grammar): ...
|
||||
|
||||
class ParserGenerator:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import threading
|
||||
from _typeshed import StrPath
|
||||
from string import Template
|
||||
from time import struct_time
|
||||
from types import FrameType, TracebackType
|
||||
@@ -20,8 +21,6 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
_SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]]
|
||||
if sys.version_info >= (3, 5):
|
||||
_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from threading import Thread
|
||||
from typing import IO, Any, Callable, Dict, Optional, Union
|
||||
|
||||
from _typeshed import AnyPath, StrPath
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from configparser import RawConfigParser
|
||||
else:
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import datetime
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from logging import FileHandler, Handler, LogRecord
|
||||
from socket import SocketType
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from queue import SimpleQueue, Queue
|
||||
elif sys.version_info >= (3,):
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import email
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -21,11 +22,8 @@ from typing import (
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_MessageType = TypeVar("_MessageType", bound=Message)
|
||||
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload
|
||||
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload
|
||||
|
||||
ACCESS_DEFAULT: int
|
||||
ACCESS_READ: int
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Any, Container, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import CodeType
|
||||
from typing import Any, List, Sequence, Text, Tuple
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
def expr(source: Text) -> STType: ...
|
||||
def suite(source: Text) -> STType: ...
|
||||
def sequence2st(sequence: Sequence[Any]) -> STType: ...
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from _typeshed import AnyPath
|
||||
from cProfile import Profile as _cProfile
|
||||
from profile import Profile
|
||||
from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
_Selector = Union[str, float, int]
|
||||
_T = TypeVar("_T", bound=Stats)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from types import FunctionType, MethodType, ModuleType, TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -18,8 +19,6 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from _typeshed import SupportsWrite
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from reprlib import Repr
|
||||
else:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import pyexpat.errors as errors
|
||||
import pyexpat.model as model
|
||||
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
|
||||
|
||||
from _typeshed import SupportsRead
|
||||
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
|
||||
|
||||
EXPAT_VERSION: str # undocumented
|
||||
version_info: Tuple[int, int, int] # undocumented
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from types import TracebackType
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
if sys.platform != "win32":
|
||||
PIPE_BUF: int
|
||||
POLLERR: int
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import StrPath, SupportsRead, SupportsWrite
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
@@ -18,8 +19,6 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
from _typeshed import StrPath, SupportsRead, SupportsWrite
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_AnyStr = str
|
||||
_AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import NamedTuple, Optional, Tuple, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import NamedTuple, Optional, Tuple, Union
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
class SndHeaders(NamedTuple):
|
||||
|
||||
@@ -16,7 +16,6 @@ CPython C source: https://github.com/python/cpython/blob/master/Modules/socketmo
|
||||
# adapted for Python 2.7 by Michal Pokorny
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
# ----- Constants -----
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import enum
|
||||
import socket
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Type, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PCTRTT = Tuple[Tuple[str, str], ...]
|
||||
_PCTRTTT = Tuple[_PCTRTT, ...]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
verbose: int
|
||||
filename_only: int
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
# tar constants
|
||||
NUL: bytes
|
||||
BLOCKSIZE: int
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import List, Union
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
from typing import List, Union
|
||||
|
||||
_Attr = List[Union[int, List[bytes]]]
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import types
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar, Union
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar, Union
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping, Optional, Tuple, Type
|
||||
|
||||
from _typeshed import SupportsWrite
|
||||
|
||||
_PT = Tuple[str, int, str, Optional[str]]
|
||||
|
||||
def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from types import ModuleType, TracebackType
|
||||
from typing import Any, List, NamedTuple, Optional, TextIO, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _warnings import warn as warn, warn_explicit as warn_explicit
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from typing import Optional, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional
|
||||
|
||||
from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication
|
||||
from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional
|
||||
|
||||
class WSGIWarning(Warning): ...
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, FileDescriptor, SupportsWrite
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
@@ -19,11 +20,8 @@ from typing import (
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath, FileDescriptor, SupportsWrite
|
||||
|
||||
VERSION: str
|
||||
|
||||
class ParseError(SyntaxError):
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from codecs import StreamReaderWriter, StreamWriter
|
||||
from io import RawIOBase, TextIOBase
|
||||
from typing import Mapping, Optional, Text, TextIO, Union
|
||||
from xml.sax import handler, xmlreader
|
||||
|
||||
from _typeshed import SupportsWrite
|
||||
|
||||
def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
def unescape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import io
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -19,8 +20,6 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
_SZI = Union[Text, ZipInfo]
|
||||
_DT = Tuple[int, int, int, int, int, int]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user