mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Import from collections.abc wherever possible (#7635)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Awaitable, Callable
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
from .case import TestCase
|
||||
|
||||
@@ -3,25 +3,10 @@ import logging
|
||||
import sys
|
||||
import unittest.result
|
||||
from _typeshed import Self
|
||||
from collections.abc import Set as AbstractSet
|
||||
from collections.abc import Callable, Container, Iterable, Mapping, Sequence, Set as AbstractSet
|
||||
from contextlib import AbstractContextManager
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
ClassVar,
|
||||
Container,
|
||||
Generic,
|
||||
Iterable,
|
||||
Mapping,
|
||||
NamedTuple,
|
||||
NoReturn,
|
||||
Pattern,
|
||||
Sequence,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
from typing import Any, AnyStr, ClassVar, Generic, NamedTuple, NoReturn, Pattern, TypeVar, overload
|
||||
from typing_extensions import ParamSpec
|
||||
from warnings import WarningMessage
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@ import sys
|
||||
import unittest.case
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from collections.abc import Callable, Sequence
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Pattern, Sequence
|
||||
from typing import Any, Pattern
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_SortComparisonMethod: TypeAlias = Callable[[str, str], int]
|
||||
|
||||
@@ -3,8 +3,9 @@ import unittest.case
|
||||
import unittest.loader
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from collections.abc import Iterable
|
||||
from types import ModuleType
|
||||
from typing import Any, Iterable, Protocol
|
||||
from typing import Any, Protocol
|
||||
|
||||
MAIN_EXAMPLES: str
|
||||
MODULE_EXAMPLES: str
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from collections.abc import Awaitable, Callable, Iterable, Mapping, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from types import TracebackType
|
||||
from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, overload
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import unittest.case
|
||||
from collections.abc import Callable
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, TextIO, TypeVar, Union
|
||||
from typing import Any, TextIO, TypeVar, Union
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_SysExcInfoType: TypeAlias = Union[tuple[type[BaseException], BaseException, TracebackType], tuple[None, None, None]]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import unittest.case
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from typing import Callable, Iterable, TextIO
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import TextIO
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_ResultClassType: TypeAlias = Callable[[TextIO, bool, int], unittest.result.TestResult]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import unittest.result
|
||||
from typing import Callable, TypeVar, overload
|
||||
from collections.abc import Callable
|
||||
from typing import TypeVar, overload
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import unittest.case
|
||||
import unittest.result
|
||||
from typing import Iterable, Iterator
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_TestType: TypeAlias = unittest.case.TestCase | TestSuite
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Any, Sequence, TypeVar
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
Reference in New Issue
Block a user