Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 89d3a55

Browse files
authored
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.
1 parent 53431ca commit 89d3a55

12 files changed

Lines changed: 14 additions & 45 deletions

File tree

stdlib/2and3/contextlib.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# Stubs for contextlib
2-
1+
# ContextManager aliased here for backwards compatibility; TODO eventually remove this
32
from typing import (
43
Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type,
54
Generic, TypeVar, overload
65
)
76
from types import TracebackType
87
import sys
9-
# Aliased here for backwards compatibility; TODO eventually remove this
108
from typing import ContextManager as ContextManager
119

1210
if sys.version_info >= (3, 5):

stdlib/2and3/shutil.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import os
22
import sys
33

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

stdlib/2and3/sysconfig.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# Stubs for sysconfig
2-
31
from typing import overload, Any, Dict, IO, List, Optional, Tuple, Union
42

3+
def get_config_var(name: str) -> Optional[str]: ...
54
@overload
65
def get_config_vars() -> Dict[str, Any]: ...
76
@overload
87
def get_config_vars(arg: str, *args: str) -> List[Any]: ...
9-
def get_config_var(name: str) -> Optional[str]: ...
108
def get_scheme_names() -> Tuple[str, ...]: ...
119
def get_path_names() -> Tuple[str, ...]: ...
1210
def get_path(name: str, scheme: str = ..., vars: Optional[Dict[str, Any]] = ..., expand: bool = ...) -> Optional[str]: ...

stdlib/3/ast.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import sys
21
# Rename typing to _typing, as not to conflict with typing imported
32
# from _ast below when loaded in an unorthodox way by the Dropbox
43
# internal Bazel integration.
5-
import typing as _typing
6-
from typing import Any, Iterator, Optional, TypeVar, Union, overload
7-
from typing_extensions import Literal
84

95
# The same unorthodox Bazel integration causes issues with sys, which
106
# is imported in both modules. unfortunately we can't just rename sys,
117
# since mypy only supports version checks with a sys that is named
128
# sys.
9+
import sys
10+
import typing as _typing
11+
from typing import Any, Iterator, Optional, TypeVar, Union, overload
12+
from typing_extensions import Literal
13+
1314
from _ast import * # type: ignore
1415

1516
if sys.version_info >= (3, 8):

stdlib/3/asyncio/events.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ from asyncio.protocols import BaseProtocol
88
from asyncio.tasks import Task
99
from asyncio.transports import BaseTransport
1010
from asyncio.unix_events import AbstractChildWatcher
11+
from _typeshed import FileDescriptorLike
12+
1113
if sys.version_info >= (3, 7):
1214
from contextvars import Context
1315

14-
from _typeshed import FileDescriptorLike
15-
1616
_T = TypeVar('_T')
1717
_Context = Dict[str, Any]
1818
_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any]

stdlib/3/os/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ from typing import (
77
)
88
from _typeshed import AnyPath
99

10-
# Re-exported names from other modules.
1110
from builtins import OSError as error
1211
from . import path as path
1312

third_party/2/six/__init__.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Stubs for six (Python 2.7)
2-
31
from __future__ import print_function
42

53
import types
@@ -10,7 +8,6 @@ from typing import (
108
import typing
119
import unittest
1210

13-
# Exports
1411
from __builtin__ import unichr as unichr
1512
from StringIO import StringIO as StringIO, StringIO as BytesIO
1613
from functools import wraps as wraps

third_party/2and3/bleach/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any, Container, Iterable, Optional, Text
22

3-
from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker
3+
from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback
44
from bleach.sanitizer import (
55
ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES,
66
ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS,
@@ -9,7 +9,6 @@ from bleach.sanitizer import (
99
Cleaner as Cleaner,
1010
)
1111

12-
from .linkifier import _Callback
1312

1413
__releasedate__: Text
1514
__version__: Text

third_party/2and3/bleach/utils.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from collections import OrderedDict
22
from typing import overload, Mapping, Any, Text
33

4+
def force_unicode(text: Text) -> Text: ...
45
@overload
56
def alphabetize_attributes(attrs: None) -> None: ...
67
@overload
78
def alphabetize_attributes(attrs: Mapping[Any, Text]) -> OrderedDict[Any, Text]: ...
8-
def force_unicode(text: Text) -> Text: ...

third_party/2and3/boto/compat.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import sys
22

33
from typing import Any
4+
5+
from six.moves import http_client
6+
47
if sys.version_info >= (3,):
58
from base64 import encodebytes as encodebytes
69
else:
710
from base64 import encodestring as encodebytes
811

9-
from six.moves import http_client
10-
1112
expanduser: Any
1213

1314
if sys.version_info >= (3, 0):

0 commit comments

Comments
 (0)