Skip to content

Commit 653f2c6

Browse files
authored
Third-party stubs: import from collections.abc where possible (#7637)
1 parent ee09d9e commit 653f2c6

File tree

146 files changed

+268
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+268
-156
lines changed

stubs/DateTimeRange/datetimerange/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
from _typeshed import Self
3-
from typing import Iterable
3+
from collections.abc import Iterable
44

55
from dateutil.relativedelta import relativedelta
66

stubs/Flask-Cors/flask_cors/core.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from collections.abc import Iterable
12
from datetime import timedelta
23
from logging import Logger
3-
from typing import Any, Iterable, Pattern, TypeVar, overload
4+
from typing import Any, Pattern, TypeVar, overload
45
from typing_extensions import TypeAlias, TypedDict
56

67
_IterableT = TypeVar("_IterableT", bound=Iterable[Any])

stubs/Flask-Cors/flask_cors/decorator.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from collections.abc import Callable
12
from datetime import timedelta
23
from logging import Logger
3-
from typing import Any, Callable
4+
from typing import Any
45
from typing_extensions import ParamSpec
56

67
_P = ParamSpec("_P")

stubs/Flask-Cors/flask_cors/extension.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from collections.abc import Callable, Iterable
12
from datetime import timedelta
23
from logging import Logger
3-
from typing import Any, Callable, Iterable
4+
from typing import Any
45

56
_App = Any # flask is not part of typeshed
67

stubs/JACK-Client/jack/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Self
2-
from typing import Any, Callable, Generator, Iterable, Iterator, Sequence, overload
2+
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
3+
from typing import Any, overload
34

45
_NDArray = Any # FIXME: no typings for numpy arrays
56

stubs/Markdown/markdown/blockparser.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Iterable, TypeVar
1+
from collections.abc import Iterable
2+
from typing import Any, TypeVar
23
from xml.etree.ElementTree import Element, ElementTree
34

45
from . import Markdown

stubs/Markdown/markdown/core.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Self
2-
from typing import Any, BinaryIO, Callable, ClassVar, Mapping, Sequence, Text, TextIO
2+
from collections.abc import Callable, Mapping, Sequence
3+
from typing import Any, BinaryIO, ClassVar, Text, TextIO
34
from typing_extensions import Literal
45
from xml.etree.ElementTree import Element
56

stubs/Markdown/markdown/extensions/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Mapping
1+
from collections.abc import Mapping
2+
from typing import Any
23

34
from markdown.core import Markdown
45

stubs/Pillow/PIL/ExifTags.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Mapping
1+
from collections.abc import Mapping
22

33
TAGS: Mapping[int, str]
44
GPSTAGS: Mapping[int, str]

stubs/Pillow/PIL/Image.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Self, SupportsRead, SupportsWrite
2-
from collections.abc import Iterable, Iterator, MutableMapping
2+
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
33
from pathlib import Path
4-
from typing import Any, Callable, ClassVar, Protocol, Sequence, SupportsBytes, Union
4+
from typing import Any, ClassVar, Protocol, SupportsBytes, Union
55
from typing_extensions import Literal, TypeAlias
66

77
from ._imaging import (

stubs/Pillow/PIL/ImageDraw.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from collections.abc import Container
2-
from typing import Any, Sequence, overload
1+
from collections.abc import Container, Sequence
2+
from typing import Any, overload
33
from typing_extensions import Literal, TypeAlias
44

55
from .Image import Image

stubs/Pillow/PIL/ImageFilter.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Self
2-
from typing import Any, Callable, Iterable, Sequence
2+
from collections.abc import Callable, Iterable, Sequence
3+
from typing import Any
34
from typing_extensions import Literal, TypeAlias
45

56
from .Image import Image

stubs/Pillow/PIL/ImageOps.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Iterable, Protocol, Union
1+
from collections.abc import Iterable
2+
from typing import Any, Protocol, Union
23
from typing_extensions import TypeAlias
34

45
from .Image import Image, _Resample, _Size

stubs/PyMySQL/pymysql/connections.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from _typeshed import Self
2+
from collections.abc import Mapping
23
from socket import socket as _socket
3-
from typing import Any, AnyStr, Generic, Mapping, TypeVar, overload
4+
from typing import Any, AnyStr, Generic, TypeVar, overload
45

56
from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name
67
from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS

stubs/PyMySQL/pymysql/cursors.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Self
2-
from typing import Any, Iterable, Iterator, Text
2+
from collections.abc import Iterable, Iterator
3+
from typing import Any, Text
34

45
from .connections import Connection
56

stubs/Pygments/pygments/formatters/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Generator
1+
from collections.abc import Generator
2+
from typing import Any
23

34
from ..formatter import Formatter
45
from .bbcode import BBCodeFormatter as BBCodeFormatter

stubs/Pygments/pygments/plugin.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Generator, Iterable
1+
from collections.abc import Generator, Iterable
2+
from typing import Any
23

34
from pkg_resources import EntryPoint
45
from pygments.filter import Filter

stubs/SQLAlchemy/sqlalchemy/engine/base.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from _typeshed import Self
22
from abc import abstractmethod
3-
from collections.abc import Mapping
3+
from collections.abc import Callable, Mapping
44
from types import TracebackType
5-
from typing import Any, Callable, TypeVar, overload
5+
from typing import Any, TypeVar, overload
66
from typing_extensions import TypeAlias
77

88
from ..dbapi import DBAPIConnection

stubs/aiofiles/aiofiles/base.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from _typeshed import Self
2+
from collections.abc import Coroutine, Generator, Iterator
23
from types import CodeType, FrameType, TracebackType, coroutine
3-
from typing import Any, Coroutine, Generator, Generic, Iterator, TypeVar
4+
from typing import Any, Generic, TypeVar
45

56
_T = TypeVar("_T")
67
_T_co = TypeVar("_T_co", covariant=True)

stubs/aiofiles/aiofiles/os.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import sys
22
from _typeshed import StrOrBytesPath
33
from asyncio.events import AbstractEventLoop
4+
from collections.abc import Sequence
45
from os import stat_result
5-
from typing import Any, Sequence, overload
6+
from typing import Any, overload
67
from typing_extensions import TypeAlias
78

89
from . import ospath as path

stubs/aiofiles/aiofiles/threadpool/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ from _typeshed import (
77
StrOrBytesPath,
88
)
99
from asyncio import AbstractEventLoop
10-
from typing import Any, Callable, overload
10+
from collections.abc import Callable
11+
from typing import Any, overload
1112
from typing_extensions import Literal, TypeAlias
1213

1314
from ..base import AiofilesContextManager

stubs/aiofiles/aiofiles/threadpool/binary.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer
2+
from collections.abc import Iterable
23
from io import FileIO
3-
from typing import Iterable
44

55
from ..base import AsyncBase
66

stubs/aiofiles/aiofiles/threadpool/text.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import StrOrBytesPath
2-
from typing import BinaryIO, Iterable
2+
from collections.abc import Iterable
3+
from typing import BinaryIO
34

45
from ..base import AsyncBase
56

stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from collections.abc import Iterable
12
from logging import Logger
2-
from typing import Any, Iterable
3+
from typing import Any
34

45
from aws_xray_sdk import global_sdk_config as global_sdk_config
56

stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
2+
from collections.abc import Callable, Iterable
23
from logging import Logger
3-
from typing import Any, Callable, Iterable
4+
from typing import Any
45

56
from aws_xray_sdk import global_sdk_config as global_sdk_config
67
from aws_xray_sdk.version import VERSION as VERSION

stubs/beautifulsoup4/bs4/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Self, SupportsRead
2-
from typing import Any, Sequence
2+
from collections.abc import Sequence
3+
from typing import Any
34

45
from .builder import TreeBuilder
56
from .element import (

stubs/beautifulsoup4/bs4/element.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import Self
2-
from collections.abc import Iterator
3-
from typing import Any, Callable, Generic, Iterable, Pattern, TypeVar, overload
2+
from collections.abc import Callable, Iterable, Iterator
3+
from typing import Any, Generic, Pattern, TypeVar, overload
44
from typing_extensions import TypeAlias
55

66
from . import BeautifulSoup

stubs/beautifulsoup4/bs4/formatter.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable
1+
from collections.abc import Callable
22
from typing_extensions import TypeAlias
33

44
from .dammit import EntitySubstitution as EntitySubstitution

stubs/boto/boto/kms/layer1.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Mapping
1+
from collections.abc import Mapping
2+
from typing import Any
23

34
from boto.connection import AWSQueryConnection
45

stubs/boto/boto/s3/bucketlistresultset.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Iterable, Iterator
1+
from collections.abc import Iterable, Iterator
2+
from typing import Any
23

34
from .key import Key
45

stubs/boto/boto/s3/key.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Callable, overload
1+
from collections.abc import Callable
2+
from typing import Any, overload
23

34
class Key:
45
DefaultContentType: str

stubs/boto/boto/utils.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import logging.handlers
33
import subprocess
44
import sys
55
import time
6+
from collections.abc import Callable, Iterable, Mapping, Sequence
67
from contextlib import AbstractContextManager
7-
from typing import IO, Any, Callable, Iterable, Mapping, Sequence, TypeVar
8+
from typing import IO, Any, TypeVar
89
from typing_extensions import TypeAlias
910

1011
import boto.connection

stubs/cachetools/cachetools/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import IdentityFunction
2-
from collections.abc import Iterator, Sequence
2+
from collections.abc import Callable, Iterator, MutableMapping, Sequence
33
from contextlib import AbstractContextManager
4-
from typing import Any, Callable, Generic, MutableMapping, TypeVar, overload
4+
from typing import Any, Generic, TypeVar, overload
55

66
__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
77
__version__: str

stubs/cachetools/cachetools/func.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import IdentityFunction
2-
from typing import Callable, Sequence, TypeVar
2+
from collections.abc import Callable, Sequence
3+
from typing import TypeVar
34

45
__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "mru_cache", "rr_cache", "ttl_cache")
56
_T = TypeVar("_T")

stubs/cachetools/cachetools/keys.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Hashable
1+
from collections.abc import Hashable
22

33
__all__ = ("hashkey", "typedkey")
44

stubs/chevron/chevron/renderer.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import StrPath, SupportsRead
2-
from typing import Any, MutableSequence, Sequence
2+
from collections.abc import MutableSequence, Sequence
3+
from typing import Any
34

45
g_token_cache: dict[str, list[tuple[str, str]]] # undocumented
56

stubs/chevron/chevron/tokenizer.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterator
1+
from collections.abc import Iterator
22

33
class ChevronError(SyntaxError): ...
44

stubs/contextvars/contextvars.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
2-
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar
2+
from collections.abc import Callable, Iterator, Mapping
3+
from typing import Any, ClassVar, Generic, TypeVar
34
from typing_extensions import ParamSpec, final
45

56
if sys.version_info >= (3, 9):

stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from collections.abc import Iterable
12
from enum import Enum
2-
from typing import Any, Iterable
3+
from typing import Any
34

45
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey
56
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey

stubs/cryptography/cryptography/x509/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import datetime
22
from _typeshed import Self
33
from abc import ABCMeta, abstractmethod
4+
from collections.abc import Generator, Iterable, Sequence
45
from enum import Enum
56
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
6-
from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, TypeVar
7+
from typing import Any, ClassVar, Generic, TypeVar
78

89
from cryptography.hazmat.backends.interfaces import X509Backend
910
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey

stubs/dataclasses/dataclasses.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
2-
from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar, overload
2+
from collections.abc import Callable, Iterable, Mapping
3+
from typing import Any, Generic, TypeVar, overload
34

45
if sys.version_info >= (3, 9):
56
from types import GenericAlias

stubs/dateparser/dateparser/languages/loader.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections import OrderedDict
2-
from typing import Any, Iterator
2+
from collections.abc import Iterator
3+
from typing import Any
34

45
from .locale import Locale
56

stubs/dateparser/dateparser/utils/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections import OrderedDict
2-
from typing import Any, Mapping
2+
from collections.abc import Mapping
3+
from typing import Any
34

45
def strip_braces(date_string: str) -> str: ...
56
def normalize_unicode(string: str, form: str = ...) -> str: ...

stubs/decorator/decorator.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
2-
from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, TypeVar
2+
from collections.abc import Callable, Iterator
3+
from typing import Any, NamedTuple, Pattern, Text, TypeVar
34
from typing_extensions import ParamSpec
45

56
_C = TypeVar("_C", bound=Callable[..., Any])

stubs/docutils/docutils/parsers/rst/roles.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Callable
1+
from collections.abc import Callable
2+
from typing import Any
23
from typing_extensions import TypeAlias
34

45
import docutils.nodes

stubs/editdistance/editdistance.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Hashable, Iterable
1+
from collections.abc import Hashable, Iterable
22

33
def eval(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ...
44
def distance(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ...

stubs/flake8-2020/flake8_2020.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# Therefore typeshed is the best place.
44

55
import ast
6-
from typing import Any, ClassVar, Generator
6+
from collections.abc import Generator
7+
from typing import Any, ClassVar
78

89
class Plugin:
910
name: ClassVar[str]

stubs/flake8-bugbear/bugbear.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import ast
3-
from typing import Any, Sequence
3+
from collections.abc import Sequence
4+
from typing import Any
45

56
class BugBearChecker:
67
name: str

0 commit comments

Comments
 (0)