Fix isort w.r.t. _ast/_collections_abc/_tracemalloc/_warnings (#6329)

This commit is contained in:
Alex Waygood
2021-11-17 16:29:44 +00:00
committed by GitHub
parent 25ba2bad06
commit fbb89f9fd5
8 changed files with 12 additions and 15 deletions

View File

@@ -13,12 +13,16 @@ extra_standard_library = [
"typing_extensions",
"_typeshed",
# Extra modules not recognized by isort
"_ast",
"_collections_abc",
"_compression",
"_csv",
"_curses",
"_markupbase",
"_random",
"_tkinter",
"_tracemalloc",
"_warnings",
"_weakrefset",
"genericpath",
"opcode",

View File

@@ -4,10 +4,9 @@
# from _ast below when loaded in an unorthodox way by the Dropbox
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator
from _ast import *
from _ast import AST, Module
from typing import Any, Iterator
def parse(source: str | unicode, filename: str | unicode = ..., mode: str | unicode = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...

View File

@@ -1,9 +1,8 @@
from _warnings import warn as warn, warn_explicit as warn_explicit
from types import ModuleType, TracebackType
from typing import List, TextIO, Type, overload
from typing_extensions import Literal
from _warnings import warn as warn, warn_explicit as warn_explicit
def showwarning(
message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...
) -> None: ...

View File

@@ -8,11 +8,10 @@
# sys.
import sys
import typing as _typing
from _ast import * # type: ignore
from typing import Any, Iterator, TypeVar, overload
from typing_extensions import Literal
from _ast import * # type: ignore
if sys.version_info >= (3, 8):
class Num(Constant):
value: complex

View File

@@ -1,5 +1,7 @@
import sys
import types
from _ast import AST
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import (
OpenBinaryMode,
OpenBinaryModeReading,
@@ -59,9 +61,6 @@ from typing import (
)
from typing_extensions import Literal, SupportsIndex, TypeGuard, final
from _ast import AST
from _collections_abc import dict_items, dict_keys, dict_values
if sys.version_info >= (3, 9):
from types import GenericAlias

View File

@@ -1,10 +1,9 @@
import sys
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import Self
from typing import Any, Dict, Generic, NoReturn, Tuple, Type, TypeVar, overload
from typing_extensions import final
from _collections_abc import dict_items, dict_keys, dict_values
if sys.version_info >= (3, 10):
from typing import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Reversible, Sequence
else:

View File

@@ -1,7 +1,6 @@
import sys
from typing import Optional, Sequence, Tuple, Union, overload
from _tracemalloc import *
from typing import Optional, Sequence, Tuple, Union, overload
def get_object_traceback(obj: object) -> Traceback | None: ...
def take_snapshot() -> Snapshot: ...

View File

@@ -1,9 +1,8 @@
from _warnings import warn as warn, warn_explicit as warn_explicit
from types import ModuleType, TracebackType
from typing import Any, Sequence, TextIO, Type, overload
from typing_extensions import Literal
from _warnings import warn as warn, warn_explicit as warn_explicit
_ActionKind = Literal["default", "error", "ignore", "always", "module", "once"]
filters: Sequence[tuple[str, str | None, Type[Warning], str | None, int]] # undocumented, do not mutate