Preparations for the Big Reformat (#4228)

A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.

In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490.
This commit is contained in:
Sebastian Rittau
2020-06-14 16:58:26 +02:00
committed by GitHub
parent 53431cab1d
commit 89d3a55f1a
12 changed files with 14 additions and 45 deletions

View File

@@ -1,12 +1,10 @@
# Stubs for contextlib
# ContextManager aliased here for backwards compatibility; TODO eventually remove this
from typing import (
Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type,
Generic, TypeVar, overload
)
from types import TracebackType
import sys
# Aliased here for backwards compatibility; TODO eventually remove this
from typing import ContextManager as ContextManager
if sys.version_info >= (3, 5):

View File

@@ -1,10 +1,6 @@
import os
import sys
# 'bytes' paths are not properly supported: they don't work with all functions,
# sometimes they only work partially (broken exception messages), and the test
# cases don't use them.
from typing import (
List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple,
AnyStr, Optional, Union, Set, TypeVar, overload, Type, Protocol, Text

View File

@@ -1,12 +1,10 @@
# Stubs for sysconfig
from typing import overload, Any, Dict, IO, List, Optional, Tuple, Union
def get_config_var(name: str) -> Optional[str]: ...
@overload
def get_config_vars() -> Dict[str, Any]: ...
@overload
def get_config_vars(arg: str, *args: str) -> List[Any]: ...
def get_config_var(name: str) -> Optional[str]: ...
def get_scheme_names() -> Tuple[str, ...]: ...
def get_path_names() -> Tuple[str, ...]: ...
def get_path(name: str, scheme: str = ..., vars: Optional[Dict[str, Any]] = ..., expand: bool = ...) -> Optional[str]: ...

View File

@@ -1,15 +1,16 @@
import sys
# Rename typing to _typing, as not to conflict with typing imported
# from _ast below when loaded in an unorthodox way by the Dropbox
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator, Optional, TypeVar, Union, overload
from typing_extensions import Literal
# The same unorthodox Bazel integration causes issues with sys, which
# is imported in both modules. unfortunately we can't just rename sys,
# since mypy only supports version checks with a sys that is named
# sys.
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
if sys.version_info >= (3, 8):

View File

@@ -8,11 +8,11 @@ from asyncio.protocols import BaseProtocol
from asyncio.tasks import Task
from asyncio.transports import BaseTransport
from asyncio.unix_events import AbstractChildWatcher
from _typeshed import FileDescriptorLike
if sys.version_info >= (3, 7):
from contextvars import Context
from _typeshed import FileDescriptorLike
_T = TypeVar('_T')
_Context = Dict[str, Any]
_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any]

View File

@@ -7,7 +7,6 @@ from typing import (
)
from _typeshed import AnyPath
# Re-exported names from other modules.
from builtins import OSError as error
from . import path as path