From 4e4ebf9236ce420e15ccdd224dc2fd836b8375a3 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 9 Jul 2020 18:56:11 +0200 Subject: [PATCH 1/6] Upgrade to isort 5 This now also reformats imports not at the top of files. --- .travis.yml | 2 +- pyproject.toml | 33 +++++++++++++++++-- requirements-tests-py3.txt | 2 +- stdlib/2and3/_dummy_threading.pyi | 2 +- stdlib/2and3/logging/handlers.pyi | 2 +- stdlib/2and3/pyexpat/__init__.pyi | 3 +- stdlib/2and3/threading.pyi | 2 +- stdlib/2and3/wsgiref/simple_server.pyi | 2 +- stdlib/2and3/xml/__init__.pyi | 2 +- stdlib/2and3/xml/parsers/__init__.pyi | 2 +- stdlib/3/asyncio/__init__.pyi | 19 +++-------- stdlib/3/asyncio/futures.pyi | 3 +- stdlib/3/collections/__init__.pyi | 5 +-- stdlib/3/collections/abc.pyi | 6 +--- stdlib/3/encodings/__init__.pyi | 3 -- stdlib/3/importlib/resources.pyi | 3 +- stdlib/3/multiprocessing/managers.pyi | 2 +- stdlib/3/re.pyi | 4 +-- third_party/2/six/moves/urllib/__init__.pyi | 6 +--- third_party/2and3/decorator.pyi | 3 +- third_party/2and3/jinja2/environment.pyi | 2 +- .../requests/packages/urllib3/connection.pyi | 6 ++-- third_party/2and3/typing_extensions.pyi | 12 ++++--- third_party/2and3/werkzeug/serving.pyi | 4 +-- third_party/2and3/werkzeug/test.pyi | 3 +- third_party/3/six/moves/urllib/__init__.pyi | 6 +--- 26 files changed, 69 insertions(+), 70 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02794ae56e69..f49c35724eb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,4 +34,4 @@ jobs: script: black --check --diff stdlib third_party - name: "isort" install: pip install $(grep isort requirements-tests-py3.txt) - script: isort --check-only --diff --recursive stdlib third_party + script: isort --check-only --diff stdlib third_party diff --git a/pyproject.toml b/pyproject.toml index c9b6b9b0d557..814a2008bea2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,5 +9,34 @@ force_grid_wrap = 0 use_parentheses = true combine_as_imports = true line_length = 130 -default_section = "THIRDPARTY" -known_standard_library = ["typing_extensions", "_typeshed", "_compression", "_markupbase", "opcode"] +extra_standard_library = [ + "typing_extensions", + "_typeshed", + # Extra modules not recognized by isort + "_compression", + "_csv", + "_curses", + "_markupbase", + "_random", + "_weakrefset", + "genericpath", + "opcode", + "pyexpat", + # Python 2 modules + "__builtin__", + "cStringIO", + "httplib", + "mimetools", + "rfc822", + "thread", + "urllib2", + "urlparse", + "BaseHTTPServer", + "Queue", + "SimpleHTTPServer", + "SocketServer", + "StringIO", + "UserDict", + "UserList", + "UserString", +] diff --git a/requirements-tests-py3.txt b/requirements-tests-py3.txt index f8568f8330d9..38189cd97e8b 100644 --- a/requirements-tests-py3.txt +++ b/requirements-tests-py3.txt @@ -4,5 +4,5 @@ black==19.10b0 flake8==3.8.2 flake8-bugbear==20.1.4 flake8-pyi==20.5.0 -isort[pyproject]==4.3.21 +isort[pyproject]==5.0.6 pytype>=2020.06.26 diff --git a/stdlib/2and3/_dummy_threading.pyi b/stdlib/2and3/_dummy_threading.pyi index 0ac579592ca7..c20067545d43 100644 --- a/stdlib/2and3/_dummy_threading.pyi +++ b/stdlib/2and3/_dummy_threading.pyi @@ -155,7 +155,7 @@ class Event: def wait(self, timeout: Optional[float] = ...) -> bool: ... if sys.version_info >= (3, 8): - from _thread import _ExceptHookArgs as ExceptHookArgs, ExceptHookArgs as _ExceptHookArgs # don't ask + from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask excepthook: Callable[[_ExceptHookArgs], Any] diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index bade71cf1138..8c0ca610f6ed 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -7,7 +7,7 @@ from socket import SocketType from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload if sys.version_info >= (3, 7): - from queue import SimpleQueue, Queue + from queue import Queue, SimpleQueue elif sys.version_info >= (3,): from queue import Queue else: diff --git a/stdlib/2and3/pyexpat/__init__.pyi b/stdlib/2and3/pyexpat/__init__.pyi index c8305567e92e..6934231c5b71 100644 --- a/stdlib/2and3/pyexpat/__init__.pyi +++ b/stdlib/2and3/pyexpat/__init__.pyi @@ -1,6 +1,5 @@ -import pyexpat.errors as errors -import pyexpat.model as model from _typeshed import SupportsRead +from pyexpat import errors as errors, model as model from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union EXPAT_VERSION: str # undocumented diff --git a/stdlib/2and3/threading.pyi b/stdlib/2and3/threading.pyi index 0ac579592ca7..c20067545d43 100644 --- a/stdlib/2and3/threading.pyi +++ b/stdlib/2and3/threading.pyi @@ -155,7 +155,7 @@ class Event: def wait(self, timeout: Optional[float] = ...) -> bool: ... if sys.version_info >= (3, 8): - from _thread import _ExceptHookArgs as ExceptHookArgs, ExceptHookArgs as _ExceptHookArgs # don't ask + from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask excepthook: Callable[[_ExceptHookArgs], Any] diff --git a/stdlib/2and3/wsgiref/simple_server.pyi b/stdlib/2and3/wsgiref/simple_server.pyi index 0421098c39d4..66cd94fa7f7f 100644 --- a/stdlib/2and3/wsgiref/simple_server.pyi +++ b/stdlib/2and3/wsgiref/simple_server.pyi @@ -7,7 +7,7 @@ from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment if sys.version_info < (3,): from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer else: - from http.server import HTTPServer, BaseHTTPRequestHandler + from http.server import BaseHTTPRequestHandler, HTTPServer server_version: str # undocumented sys_version: str # undocumented diff --git a/stdlib/2and3/xml/__init__.pyi b/stdlib/2and3/xml/__init__.pyi index c524ac2b1cfc..a487d2467f41 100644 --- a/stdlib/2and3/xml/__init__.pyi +++ b/stdlib/2and3/xml/__init__.pyi @@ -1 +1 @@ -import xml.parsers as parsers +from xml import parsers as parsers diff --git a/stdlib/2and3/xml/parsers/__init__.pyi b/stdlib/2and3/xml/parsers/__init__.pyi index cac086235cba..cebdb6a30014 100644 --- a/stdlib/2and3/xml/parsers/__init__.pyi +++ b/stdlib/2and3/xml/parsers/__init__.pyi @@ -1 +1 @@ -import xml.parsers.expat as expat +from xml.parsers import expat as expat diff --git a/stdlib/3/asyncio/__init__.pyi b/stdlib/3/asyncio/__init__.pyi index d4f9157c99a4..24d59c938776 100644 --- a/stdlib/3/asyncio/__init__.pyi +++ b/stdlib/3/asyncio/__init__.pyi @@ -89,13 +89,10 @@ else: from asyncio.events import SendfileNotAvailableError as SendfileNotAvailableError from asyncio.futures import ( CancelledError as CancelledError, - TimeoutError as TimeoutError, InvalidStateError as InvalidStateError, + TimeoutError as TimeoutError, ) - from asyncio.streams import ( - IncompleteReadError as IncompleteReadError, - LimitOverrunError as LimitOverrunError, - ) + from asyncio.streams import IncompleteReadError as IncompleteReadError, LimitOverrunError as LimitOverrunError if sys.version_info >= (3, 7): from asyncio.protocols import BufferedProtocol as BufferedProtocol @@ -104,11 +101,7 @@ if sys.version_info >= (3, 7): from asyncio.runners import run as run if sys.version_info >= (3, 7): - from asyncio.tasks import ( - all_tasks as all_tasks, - create_task as create_task, - current_task as current_task, - ) + from asyncio.tasks import all_tasks as all_tasks, create_task as create_task, current_task as current_task if sys.version_info >= (3, 9): from asyncio.threads import to_thread as to_thread @@ -117,10 +110,8 @@ if sys.platform == "win32": from asyncio.windows_events import * if sys.platform != "win32": - from asyncio.streams import ( - open_unix_connection as open_unix_connection, - start_unix_server as start_unix_server, - ) + from asyncio.streams import open_unix_connection as open_unix_connection, start_unix_server as start_unix_server + from .unix_events import ( AbstractChildWatcher as AbstractChildWatcher, FastChildWatcher as FastChildWatcher, diff --git a/stdlib/3/asyncio/futures.pyi b/stdlib/3/asyncio/futures.pyi index a92fb90cd522..1b4bfb2b476f 100644 --- a/stdlib/3/asyncio/futures.pyi +++ b/stdlib/3/asyncio/futures.pyi @@ -5,8 +5,7 @@ from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional from .events import AbstractEventLoop if sys.version_info < (3, 8): - from concurrent.futures import CancelledError as CancelledError - from concurrent.futures import TimeoutError as TimeoutError + from concurrent.futures import CancelledError as CancelledError, TimeoutError as TimeoutError class InvalidStateError(Error): ... if sys.version_info >= (3, 7): diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 945c78867e8b..7790113c8710 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -41,10 +41,7 @@ from typing import ( from . import abc if sys.version_info >= (3, 6): - from typing import ( - Collection as Collection, - AsyncGenerator as AsyncGenerator, - ) + from typing import AsyncGenerator as AsyncGenerator, Collection as Collection _S = TypeVar("_S") _T = TypeVar("_T") diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index 24a10b9d42aa..2873cd3d14bb 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -29,8 +29,4 @@ from . import ( ) if sys.version_info >= (3, 6): - from . import ( - Collection as Collection, - Reversible as Reversible, - AsyncGenerator as AsyncGenerator, - ) + from . import AsyncGenerator as AsyncGenerator, Collection as Collection, Reversible as Reversible diff --git a/stdlib/3/encodings/__init__.pyi b/stdlib/3/encodings/__init__.pyi index 489e10623d09..d6f4389bc820 100644 --- a/stdlib/3/encodings/__init__.pyi +++ b/stdlib/3/encodings/__init__.pyi @@ -1,6 +1,3 @@ -# This comment serves as a workaround for timothycrosley/isort#1027 and can -# be removed when a release with a fix was released. - import codecs from typing import Any diff --git a/stdlib/3/importlib/resources.pyi b/stdlib/3/importlib/resources.pyi index 6f103fb0946e..be8d49ec3193 100644 --- a/stdlib/3/importlib/resources.pyi +++ b/stdlib/3/importlib/resources.pyi @@ -3,10 +3,9 @@ import sys # This is a >=3.7 module, so we conditionally include its source. if sys.version_info >= (3, 7): import os - from pathlib import Path from types import ModuleType - from typing import ContextManager, Iterator, Union, BinaryIO, TextIO + from typing import BinaryIO, ContextManager, Iterator, TextIO, Union Package = Union[str, ModuleType] Resource = Union[str, os.PathLike] diff --git a/stdlib/3/multiprocessing/managers.pyi b/stdlib/3/multiprocessing/managers.pyi index 13a41f526c9a..1ddfcdcad7b9 100644 --- a/stdlib/3/multiprocessing/managers.pyi +++ b/stdlib/3/multiprocessing/managers.pyi @@ -25,7 +25,7 @@ from typing import ( from .context import BaseContext if sys.version_info >= (3, 8): - from .shared_memory import ShareableList, SharedMemory, _SLT + from .shared_memory import _SLT, ShareableList, SharedMemory _T = TypeVar("_T") _KT = TypeVar("_KT") diff --git a/stdlib/3/re.pyi b/stdlib/3/re.pyi index 8058636655d4..0fa68c4b9c01 100644 --- a/stdlib/3/re.pyi +++ b/stdlib/3/re.pyi @@ -10,9 +10,9 @@ from typing import Any, AnyStr, Callable, Iterator, List, Optional, Tuple, Union # ----- re variables and constants ----- if sys.version_info >= (3, 7): - from typing import Pattern as Pattern, Match as Match + from typing import Match as Match, Pattern as Pattern else: - from typing import Pattern, Match + from typing import Match, Pattern if sys.version_info >= (3, 6): import enum diff --git a/third_party/2/six/moves/urllib/__init__.pyi b/third_party/2/six/moves/urllib/__init__.pyi index d08209c51cc1..fa6dc977937d 100644 --- a/third_party/2/six/moves/urllib/__init__.pyi +++ b/third_party/2/six/moves/urllib/__init__.pyi @@ -1,5 +1 @@ -import six.moves.urllib.error as error -import six.moves.urllib.parse as parse -import six.moves.urllib.request as request -import six.moves.urllib.response as response -import six.moves.urllib.robotparser as robotparser +from six.moves.urllib import error as error, parse as parse, request as request, response as response, robotparser as robotparser diff --git a/third_party/2and3/decorator.pyi b/third_party/2and3/decorator.pyi index 618083d1c540..0d6238e7574f 100644 --- a/third_party/2and3/decorator.pyi +++ b/third_party/2and3/decorator.pyi @@ -8,8 +8,7 @@ _T = TypeVar("_T") def get_init(cls): ... if sys.version_info >= (3,): - from inspect import iscoroutinefunction as iscoroutinefunction - from inspect import getfullargspec as getfullargspec + from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction else: class FullArgSpec(NamedTuple): args: List[str] diff --git a/third_party/2and3/jinja2/environment.pyi b/third_party/2and3/jinja2/environment.pyi index 673735ede5d6..58a3d317ba7a 100644 --- a/third_party/2and3/jinja2/environment.pyi +++ b/third_party/2and3/jinja2/environment.pyi @@ -6,7 +6,7 @@ from .loaders import BaseLoader from .runtime import Context, Undefined if sys.version_info >= (3, 6): - from typing import Awaitable, AsyncIterator + from typing import AsyncIterator, Awaitable def get_spontaneous_environment(*args): ... def create_cache(size): ... diff --git a/third_party/2and3/requests/packages/urllib3/connection.pyi b/third_party/2and3/requests/packages/urllib3/connection.pyi index 511164769428..0a7e25317e70 100644 --- a/third_party/2and3/requests/packages/urllib3/connection.pyi +++ b/third_party/2and3/requests/packages/urllib3/connection.pyi @@ -9,14 +9,12 @@ from .packages import ssl_match_hostname from .util import ssl_ if sys.version_info < (3, 0): - from httplib import HTTPConnection as _HTTPConnection - from httplib import HTTPException as HTTPException + from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException class ConnectionError(Exception): ... else: - from http.client import HTTPConnection as _HTTPConnection - from http.client import HTTPException as HTTPException from builtins import ConnectionError as ConnectionError + from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException class DummyConnection: ... diff --git a/third_party/2and3/typing_extensions.pyi b/third_party/2and3/typing_extensions.pyi index 9afdd5a236aa..3342c06af526 100644 --- a/third_party/2and3/typing_extensions.pyi +++ b/third_party/2and3/typing_extensions.pyi @@ -70,11 +70,13 @@ if sys.version_info >= (3, 3): from typing import ChainMap as ChainMap if sys.version_info >= (3, 5): - from typing import AsyncIterable as AsyncIterable - from typing import AsyncIterator as AsyncIterator - from typing import AsyncContextManager as AsyncContextManager - from typing import Awaitable as Awaitable - from typing import Coroutine as Coroutine + from typing import ( + AsyncContextManager as AsyncContextManager, + AsyncIterable as AsyncIterable, + AsyncIterator as AsyncIterator, + Awaitable as Awaitable, + Coroutine as Coroutine, + ) if sys.version_info >= (3, 6): from typing import AsyncGenerator as AsyncGenerator diff --git a/third_party/2and3/werkzeug/serving.pyi b/third_party/2and3/werkzeug/serving.pyi index 2bd4590eefc6..d75a3956731a 100644 --- a/third_party/2and3/werkzeug/serving.pyi +++ b/third_party/2and3/werkzeug/serving.pyi @@ -2,11 +2,11 @@ import sys from typing import Any, Optional if sys.version_info < (3,): + from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from SocketServer import ThreadingMixIn - from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler else: + from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn - from http.server import HTTPServer, BaseHTTPRequestHandler if sys.platform == "win32": class ForkingMixIn(object): ... diff --git a/third_party/2and3/werkzeug/test.pyi b/third_party/2and3/werkzeug/test.pyi index c8425b8ceacc..65a49908c546 100644 --- a/third_party/2and3/werkzeug/test.pyi +++ b/third_party/2and3/werkzeug/test.pyi @@ -5,10 +5,11 @@ from typing_extensions import Literal if sys.version_info < (3,): from urllib2 import Request as U2Request + from cookielib import CookieJar else: - from urllib.request import Request as U2Request from http.cookiejar import CookieJar + from urllib.request import Request as U2Request def stream_encode_multipart( values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., charset: Text = ... diff --git a/third_party/3/six/moves/urllib/__init__.pyi b/third_party/3/six/moves/urllib/__init__.pyi index d08209c51cc1..fa6dc977937d 100644 --- a/third_party/3/six/moves/urllib/__init__.pyi +++ b/third_party/3/six/moves/urllib/__init__.pyi @@ -1,5 +1 @@ -import six.moves.urllib.error as error -import six.moves.urllib.parse as parse -import six.moves.urllib.request as request -import six.moves.urllib.response as response -import six.moves.urllib.robotparser as robotparser +from six.moves.urllib import error as error, parse as parse, request as request, response as response, robotparser as robotparser From 6f4892e5666b2e530fd3758f88801df1c9f1736c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 9 Jul 2020 19:03:55 +0200 Subject: [PATCH 2/6] Add another option per isort documentation Just using "profile = black" doesn't work in the configuration file for unknown reasons. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 814a2008bea2..3a8f78e10d82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ multi_line_output = 3 include_trailing_comma = true force_grid_wrap = 0 use_parentheses = true +ensure_newline_before_comments = true combine_as_imports = true line_length = 130 extra_standard_library = [ From 99fad81985003b0f82fda99e87e9d812657dd66e Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 9 Jul 2020 19:08:56 +0200 Subject: [PATCH 3/6] Add missing Python 2 lib --- pyproject.toml | 1 + third_party/2and3/werkzeug/test.pyi | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3a8f78e10d82..4cf76d7a2658 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ extra_standard_library = [ "pyexpat", # Python 2 modules "__builtin__", + "cookielib", "cStringIO", "httplib", "mimetools", diff --git a/third_party/2and3/werkzeug/test.pyi b/third_party/2and3/werkzeug/test.pyi index 65a49908c546..40d074fece37 100644 --- a/third_party/2and3/werkzeug/test.pyi +++ b/third_party/2and3/werkzeug/test.pyi @@ -4,9 +4,8 @@ from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload from typing_extensions import Literal if sys.version_info < (3,): - from urllib2 import Request as U2Request - from cookielib import CookieJar + from urllib2 import Request as U2Request else: from http.cookiejar import CookieJar from urllib.request import Request as U2Request From ac14cad24532a928bdb0c6e58eeede8d0141b60b Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 16 Jul 2020 10:48:35 +0200 Subject: [PATCH 4/6] Upgrade isort --- requirements-tests-py3.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-tests-py3.txt b/requirements-tests-py3.txt index 38189cd97e8b..739266b41a67 100644 --- a/requirements-tests-py3.txt +++ b/requirements-tests-py3.txt @@ -4,5 +4,5 @@ black==19.10b0 flake8==3.8.2 flake8-bugbear==20.1.4 flake8-pyi==20.5.0 -isort[pyproject]==5.0.6 +isort[pyproject]==5.1.1 pytype>=2020.06.26 From dea532affcc64fadc910739afba13c901b1ee620 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 16 Jul 2020 10:49:14 +0200 Subject: [PATCH 5/6] Also upgrade flake8 --- requirements-tests-py3.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-tests-py3.txt b/requirements-tests-py3.txt index 739266b41a67..72c5cf0b51ab 100644 --- a/requirements-tests-py3.txt +++ b/requirements-tests-py3.txt @@ -1,7 +1,7 @@ git+https://github.com/python/mypy.git@master typed-ast>=1.0.4 black==19.10b0 -flake8==3.8.2 +flake8==3.8.3 flake8-bugbear==20.1.4 flake8-pyi==20.5.0 isort[pyproject]==5.1.1 From 4467a0e0e59fdb85d86adaab4a07de7cfdbf128c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 16 Jul 2020 10:59:59 +0200 Subject: [PATCH 6/6] Revert some isort reformats --- stdlib/2and3/pyexpat/__init__.pyi | 3 ++- stdlib/2and3/xml/__init__.pyi | 2 +- stdlib/2and3/xml/parsers/__init__.pyi | 2 +- stdlib/3/encodings/__init__.pyi | 3 +++ third_party/2/six/moves/urllib/__init__.pyi | 6 +++++- third_party/3/six/moves/urllib/__init__.pyi | 6 +++++- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/stdlib/2and3/pyexpat/__init__.pyi b/stdlib/2and3/pyexpat/__init__.pyi index 6934231c5b71..c8305567e92e 100644 --- a/stdlib/2and3/pyexpat/__init__.pyi +++ b/stdlib/2and3/pyexpat/__init__.pyi @@ -1,5 +1,6 @@ +import pyexpat.errors as errors +import pyexpat.model as model from _typeshed import SupportsRead -from pyexpat import errors as errors, model as model from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union EXPAT_VERSION: str # undocumented diff --git a/stdlib/2and3/xml/__init__.pyi b/stdlib/2and3/xml/__init__.pyi index a487d2467f41..c524ac2b1cfc 100644 --- a/stdlib/2and3/xml/__init__.pyi +++ b/stdlib/2and3/xml/__init__.pyi @@ -1 +1 @@ -from xml import parsers as parsers +import xml.parsers as parsers diff --git a/stdlib/2and3/xml/parsers/__init__.pyi b/stdlib/2and3/xml/parsers/__init__.pyi index cebdb6a30014..cac086235cba 100644 --- a/stdlib/2and3/xml/parsers/__init__.pyi +++ b/stdlib/2and3/xml/parsers/__init__.pyi @@ -1 +1 @@ -from xml.parsers import expat as expat +import xml.parsers.expat as expat diff --git a/stdlib/3/encodings/__init__.pyi b/stdlib/3/encodings/__init__.pyi index d6f4389bc820..489e10623d09 100644 --- a/stdlib/3/encodings/__init__.pyi +++ b/stdlib/3/encodings/__init__.pyi @@ -1,3 +1,6 @@ +# This comment serves as a workaround for timothycrosley/isort#1027 and can +# be removed when a release with a fix was released. + import codecs from typing import Any diff --git a/third_party/2/six/moves/urllib/__init__.pyi b/third_party/2/six/moves/urllib/__init__.pyi index fa6dc977937d..d08209c51cc1 100644 --- a/third_party/2/six/moves/urllib/__init__.pyi +++ b/third_party/2/six/moves/urllib/__init__.pyi @@ -1 +1,5 @@ -from six.moves.urllib import error as error, parse as parse, request as request, response as response, robotparser as robotparser +import six.moves.urllib.error as error +import six.moves.urllib.parse as parse +import six.moves.urllib.request as request +import six.moves.urllib.response as response +import six.moves.urllib.robotparser as robotparser diff --git a/third_party/3/six/moves/urllib/__init__.pyi b/third_party/3/six/moves/urllib/__init__.pyi index fa6dc977937d..d08209c51cc1 100644 --- a/third_party/3/six/moves/urllib/__init__.pyi +++ b/third_party/3/six/moves/urllib/__init__.pyi @@ -1 +1,5 @@ -from six.moves.urllib import error as error, parse as parse, request as request, response as response, robotparser as robotparser +import six.moves.urllib.error as error +import six.moves.urllib.parse as parse +import six.moves.urllib.request as request +import six.moves.urllib.response as response +import six.moves.urllib.robotparser as robotparser