mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 04:11:28 +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:
@@ -1,5 +1,4 @@
|
||||
from typing import ClassVar, Iterable, NoReturn, Optional
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
class Quitter:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Dict, NoReturn, Optional, Sequence, Tuple, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
CREATE_NEW_CONSOLE: int
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import sys
|
||||
import typing as _typing
|
||||
from typing import Any, Iterator, Optional, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _ast import * # type: ignore
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from abc import ABCMeta
|
||||
from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle
|
||||
from asyncio.futures import Future
|
||||
@@ -8,11 +9,8 @@ from asyncio.tasks import Task
|
||||
from asyncio.transports import BaseTransport
|
||||
from socket import _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from contextvars import Context
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import contextvars
|
||||
from typing import Callable, List, Sequence, Tuple
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import futures
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import FrameType
|
||||
from typing import List, Optional
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
from . import tasks
|
||||
|
||||
def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from asyncio.futures import Future
|
||||
from asyncio.protocols import BaseProtocol
|
||||
@@ -9,8 +10,6 @@ from asyncio.unix_events import AbstractChildWatcher
|
||||
from socket import _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from contextvars import Context
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from socket import socket
|
||||
from typing import Any, Mapping, Optional
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Deque, Dict, List, Optional, Tuple
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import constants, events, futures, protocols, transports
|
||||
|
||||
@@ -17,7 +17,6 @@ from typing import (
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Optional, Pattern
|
||||
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Optional, Pattern
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
_SuccessType = bool
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from typing import (
|
||||
IO,
|
||||
AbstractSet,
|
||||
@@ -21,8 +22,6 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
from _typeshed import AnyPath, StrPath
|
||||
|
||||
# Internal type aliases
|
||||
_section = Mapping[str, str]
|
||||
_parser = MutableMapping[str, _section]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Optional, Type, Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import sys
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
def cancel_dump_traceback_later() -> None: ...
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from _typeshed import FileDescriptorLike
|
||||
from array import array
|
||||
from typing import Any, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
FASYNC: int
|
||||
FD_CLOEXEC: int
|
||||
DN_ACCESS: int
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import sys
|
||||
from typing import IO, Any, Container, Iterable, Optional, Sequence, Type, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import IO, Any, Container, Iterable, Optional, Sequence, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class NullTranslations:
|
||||
def __init__(self, fp: Optional[IO[str]] = ...) -> None: ...
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import _compression
|
||||
import sys
|
||||
import zlib
|
||||
from typing import IO, Optional, TextIO, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath, ReadableBuffer
|
||||
from typing import IO, Optional, TextIO, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_OpenBinaryMode = Literal["r", "rb", "a", "ab", "w", "wb", "x", "xb"]
|
||||
_OpenTextMode = Literal["rt", "at", "wt", "xt"]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# Stubs for hashlib
|
||||
|
||||
import sys
|
||||
from typing import AbstractSet, Optional, Union
|
||||
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import AbstractSet, Optional, Union
|
||||
|
||||
class _Hash(object):
|
||||
digest_size: int
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from enum import IntEnum
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
class HTTPStatus(IntEnum):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import StrPath
|
||||
from typing import IO, Any, List, Optional, Tuple, TypeVar, Union
|
||||
|
||||
from _imp import (
|
||||
@@ -14,7 +15,6 @@ from _imp import (
|
||||
lock_held as lock_held,
|
||||
release_lock as release_lock,
|
||||
)
|
||||
from _typeshed import StrPath
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import builtins
|
||||
import codecs
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, WriteableBuffer
|
||||
from mmap import mmap
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, TypeVar, Union
|
||||
|
||||
from _typeshed import ReadableBuffer, WriteableBuffer
|
||||
|
||||
DEFAULT_BUFFER_SIZE: int
|
||||
|
||||
SEEK_SET: int
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from _typeshed import SupportsRead
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder
|
||||
from .encoder import JSONEncoder as JSONEncoder
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import io
|
||||
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath, ReadableBuffer
|
||||
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"]
|
||||
_OpenTextWritingMode = Literal["wt", "xt", "at"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from ctypes import _CData
|
||||
from logging import Logger
|
||||
from multiprocessing import connection, pool, sharedctypes, spawn, synchronize, queues
|
||||
from multiprocessing import connection, pool, queues, sharedctypes, spawn, synchronize
|
||||
from multiprocessing.context import (
|
||||
AuthenticationError as AuthenticationError,
|
||||
BaseContext,
|
||||
@@ -16,7 +16,6 @@ from multiprocessing.managers import SyncManager
|
||||
from multiprocessing.process import active_children as active_children, current_process as current_process
|
||||
from multiprocessing.spawn import freeze_support as freeze_support
|
||||
from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
@@ -4,7 +4,6 @@ from logging import Logger
|
||||
from multiprocessing import queues, sharedctypes, synchronize
|
||||
from multiprocessing.process import BaseProcess
|
||||
from typing import Any, Callable, Iterable, List, Optional, Sequence, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
_LockLike = Union[synchronize.Lock, synchronize.RLock]
|
||||
|
||||
@@ -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, times_result
|
||||
@@ -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
|
||||
|
||||
@@ -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,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):
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptor, FileDescriptorLike
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, List, Mapping, NamedTuple, Optional, Tuple
|
||||
|
||||
from _typeshed import FileDescriptor, FileDescriptorLike
|
||||
|
||||
_EventMask = int
|
||||
|
||||
EVENT_READ: _EventMask
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
# We prefer to annotate inputs to methods (eg subprocess.check_call) with these
|
||||
# union types.
|
||||
# For outputs we use laborious literal based overloads to try to determine
|
||||
|
||||
@@ -2,7 +2,6 @@ import os
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
# global variables
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import SimpleNamespace
|
||||
from typing import Optional, Sequence
|
||||
|
||||
from _typeshed import AnyPath
|
||||
|
||||
class EnvBuilder:
|
||||
system_site_packages: bool
|
||||
clear: bool
|
||||
|
||||
@@ -3,14 +3,12 @@ import http.client
|
||||
import io
|
||||
import sys
|
||||
import time
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
from datetime import datetime
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Tuple, Type, Union, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
|
||||
class _SupportsTimeTuple(Protocol):
|
||||
def timetuple(self) -> time.struct_time: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user