Skip to content

Third-party stubs: import from collections.abc where possible #7637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/DateTimeRange/datetimerange/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime
from _typeshed import Self
from typing import Iterable
from collections.abc import Iterable

from dateutil.relativedelta import relativedelta

Expand Down
3 changes: 2 additions & 1 deletion stubs/Flask-Cors/flask_cors/core.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Iterable
from datetime import timedelta
from logging import Logger
from typing import Any, Iterable, Pattern, TypeVar, overload
from typing import Any, Pattern, TypeVar, overload
from typing_extensions import TypeAlias, TypedDict

_IterableT = TypeVar("_IterableT", bound=Iterable[Any])
Expand Down
3 changes: 2 additions & 1 deletion stubs/Flask-Cors/flask_cors/decorator.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Callable
from datetime import timedelta
from logging import Logger
from typing import Any, Callable
from typing import Any
from typing_extensions import ParamSpec

_P = ParamSpec("_P")
Expand Down
3 changes: 2 additions & 1 deletion stubs/Flask-Cors/flask_cors/extension.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Callable, Iterable
from datetime import timedelta
from logging import Logger
from typing import Any, Callable, Iterable
from typing import Any

_App = Any # flask is not part of typeshed

Expand Down
3 changes: 2 additions & 1 deletion stubs/JACK-Client/jack/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Self
from typing import Any, Callable, Generator, Iterable, Iterator, Sequence, overload
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from typing import Any, overload

_NDArray = Any # FIXME: no typings for numpy arrays

Expand Down
3 changes: 2 additions & 1 deletion stubs/Markdown/markdown/blockparser.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, TypeVar
from collections.abc import Iterable
from typing import Any, TypeVar
from xml.etree.ElementTree import Element, ElementTree

from . import Markdown
Expand Down
3 changes: 2 additions & 1 deletion stubs/Markdown/markdown/core.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Self
from typing import Any, BinaryIO, Callable, ClassVar, Mapping, Sequence, Text, TextIO
from collections.abc import Callable, Mapping, Sequence
from typing import Any, BinaryIO, ClassVar, Text, TextIO
from typing_extensions import Literal
from xml.etree.ElementTree import Element

Expand Down
3 changes: 2 additions & 1 deletion stubs/Markdown/markdown/extensions/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Mapping
from collections.abc import Mapping
from typing import Any

from markdown.core import Markdown

Expand Down
2 changes: 1 addition & 1 deletion stubs/Pillow/PIL/ExifTags.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Mapping
from collections.abc import Mapping

TAGS: Mapping[int, str]
GPSTAGS: Mapping[int, str]
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/Image.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Self, SupportsRead, SupportsWrite
from collections.abc import Iterable, Iterator, MutableMapping
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from pathlib import Path
from typing import Any, Callable, ClassVar, Protocol, Sequence, SupportsBytes, Union
from typing import Any, ClassVar, Protocol, SupportsBytes, Union
from typing_extensions import Literal, TypeAlias

from ._imaging import (
Expand Down
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/ImageDraw.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Container
from typing import Any, Sequence, overload
from collections.abc import Container, Sequence
from typing import Any, overload
from typing_extensions import Literal, TypeAlias

from .Image import Image
Expand Down
3 changes: 2 additions & 1 deletion stubs/Pillow/PIL/ImageFilter.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Self
from typing import Any, Callable, Iterable, Sequence
from collections.abc import Callable, Iterable, Sequence
from typing import Any
from typing_extensions import Literal, TypeAlias

from .Image import Image
Expand Down
3 changes: 2 additions & 1 deletion stubs/Pillow/PIL/ImageOps.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, Protocol, Union
from collections.abc import Iterable
from typing import Any, Protocol, Union
from typing_extensions import TypeAlias

from .Image import Image, _Resample, _Size
Expand Down
3 changes: 2 additions & 1 deletion stubs/PyMySQL/pymysql/connections.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Self
from collections.abc import Mapping
from socket import socket as _socket
from typing import Any, AnyStr, Generic, Mapping, TypeVar, overload
from typing import Any, AnyStr, Generic, TypeVar, overload

from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name
from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS
Expand Down
3 changes: 2 additions & 1 deletion stubs/PyMySQL/pymysql/cursors.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Self
from typing import Any, Iterable, Iterator, Text
from collections.abc import Iterable, Iterator
from typing import Any, Text

from .connections import Connection

Expand Down
3 changes: 2 additions & 1 deletion stubs/Pygments/pygments/formatters/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator
from collections.abc import Generator
from typing import Any

from ..formatter import Formatter
from .bbcode import BBCodeFormatter as BBCodeFormatter
Expand Down
3 changes: 2 additions & 1 deletion stubs/Pygments/pygments/plugin.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator, Iterable
from collections.abc import Generator, Iterable
from typing import Any

from pkg_resources import EntryPoint
from pygments.filter import Filter
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/engine/base.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Self
from abc import abstractmethod
from collections.abc import Mapping
from collections.abc import Callable, Mapping
from types import TracebackType
from typing import Any, Callable, TypeVar, overload
from typing import Any, TypeVar, overload
from typing_extensions import TypeAlias

from ..dbapi import DBAPIConnection
Expand Down
3 changes: 2 additions & 1 deletion stubs/aiofiles/aiofiles/base.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from _typeshed import Self
from collections.abc import Coroutine, Generator, Iterator
from types import CodeType, FrameType, TracebackType, coroutine
from typing import Any, Coroutine, Generator, Generic, Iterator, TypeVar
from typing import Any, Generic, TypeVar

_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
Expand Down
3 changes: 2 additions & 1 deletion stubs/aiofiles/aiofiles/os.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import sys
from _typeshed import StrOrBytesPath
from asyncio.events import AbstractEventLoop
from collections.abc import Sequence
from os import stat_result
from typing import Any, Sequence, overload
from typing import Any, overload
from typing_extensions import TypeAlias

from . import ospath as path
Expand Down
3 changes: 2 additions & 1 deletion stubs/aiofiles/aiofiles/threadpool/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ from _typeshed import (
StrOrBytesPath,
)
from asyncio import AbstractEventLoop
from typing import Any, Callable, overload
from collections.abc import Callable
from typing import Any, overload
from typing_extensions import Literal, TypeAlias

from ..base import AiofilesContextManager
Expand Down
2 changes: 1 addition & 1 deletion stubs/aiofiles/aiofiles/threadpool/binary.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer
from collections.abc import Iterable
from io import FileIO
from typing import Iterable

from ..base import AsyncBase

Expand Down
3 changes: 2 additions & 1 deletion stubs/aiofiles/aiofiles/threadpool/text.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import StrOrBytesPath
from typing import BinaryIO, Iterable
from collections.abc import Iterable
from typing import BinaryIO

from ..base import AsyncBase

Expand Down
3 changes: 2 additions & 1 deletion stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Iterable
from logging import Logger
from typing import Any, Iterable
from typing import Any

from aws_xray_sdk import global_sdk_config as global_sdk_config

Expand Down
3 changes: 2 additions & 1 deletion stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
from collections.abc import Callable, Iterable
from logging import Logger
from typing import Any, Callable, Iterable
from typing import Any

from aws_xray_sdk import global_sdk_config as global_sdk_config
from aws_xray_sdk.version import VERSION as VERSION
Expand Down
3 changes: 2 additions & 1 deletion stubs/beautifulsoup4/bs4/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Self, SupportsRead
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any

from .builder import TreeBuilder
from .element import (
Expand Down
4 changes: 2 additions & 2 deletions stubs/beautifulsoup4/bs4/element.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Self
from collections.abc import Iterator
from typing import Any, Callable, Generic, Iterable, Pattern, TypeVar, overload
from collections.abc import Callable, Iterable, Iterator
from typing import Any, Generic, Pattern, TypeVar, overload
from typing_extensions import TypeAlias

from . import BeautifulSoup
Expand Down
2 changes: 1 addition & 1 deletion stubs/beautifulsoup4/bs4/formatter.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable
from typing_extensions import TypeAlias

from .dammit import EntitySubstitution as EntitySubstitution
Expand Down
3 changes: 2 additions & 1 deletion stubs/boto/boto/kms/layer1.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Mapping
from collections.abc import Mapping
from typing import Any

from boto.connection import AWSQueryConnection

Expand Down
3 changes: 2 additions & 1 deletion stubs/boto/boto/s3/bucketlistresultset.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, Iterator
from collections.abc import Iterable, Iterator
from typing import Any

from .key import Key

Expand Down
3 changes: 2 additions & 1 deletion stubs/boto/boto/s3/key.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable, overload
from collections.abc import Callable
from typing import Any, overload

class Key:
DefaultContentType: str
Expand Down
3 changes: 2 additions & 1 deletion stubs/boto/boto/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import logging.handlers
import subprocess
import sys
import time
from collections.abc import Callable, Iterable, Mapping, Sequence
from contextlib import AbstractContextManager
from typing import IO, Any, Callable, Iterable, Mapping, Sequence, TypeVar
from typing import IO, Any, TypeVar
from typing_extensions import TypeAlias

import boto.connection
Expand Down
4 changes: 2 additions & 2 deletions stubs/cachetools/cachetools/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import IdentityFunction
from collections.abc import Iterator, Sequence
from collections.abc import Callable, Iterator, MutableMapping, Sequence
from contextlib import AbstractContextManager
from typing import Any, Callable, Generic, MutableMapping, TypeVar, overload
from typing import Any, Generic, TypeVar, overload

__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
__version__: str
Expand Down
3 changes: 2 additions & 1 deletion stubs/cachetools/cachetools/func.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import IdentityFunction
from typing import Callable, Sequence, TypeVar
from collections.abc import Callable, Sequence
from typing import TypeVar

__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "mru_cache", "rr_cache", "ttl_cache")
_T = TypeVar("_T")
Expand Down
2 changes: 1 addition & 1 deletion stubs/cachetools/cachetools/keys.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Hashable
from collections.abc import Hashable

__all__ = ("hashkey", "typedkey")

Expand Down
3 changes: 2 additions & 1 deletion stubs/chevron/chevron/renderer.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import StrPath, SupportsRead
from typing import Any, MutableSequence, Sequence
from collections.abc import MutableSequence, Sequence
from typing import Any

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

Expand Down
2 changes: 1 addition & 1 deletion stubs/chevron/chevron/tokenizer.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterator
from collections.abc import Iterator

class ChevronError(SyntaxError): ...

Expand Down
3 changes: 2 additions & 1 deletion stubs/contextvars/contextvars.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar
from collections.abc import Callable, Iterator, Mapping
from typing import Any, ClassVar, Generic, TypeVar
from typing_extensions import ParamSpec, final

if sys.version_info >= (3, 9):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Iterable
from enum import Enum
from typing import Any, Iterable
from typing import Any

from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
Expand Down
3 changes: 2 additions & 1 deletion stubs/cryptography/cryptography/x509/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import datetime
from _typeshed import Self
from abc import ABCMeta, abstractmethod
from collections.abc import Generator, Iterable, Sequence
from enum import Enum
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, TypeVar
from typing import Any, ClassVar, Generic, TypeVar

from cryptography.hazmat.backends.interfaces import X509Backend
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
Expand Down
3 changes: 2 additions & 1 deletion stubs/dataclasses/dataclasses.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar, overload
from collections.abc import Callable, Iterable, Mapping
from typing import Any, Generic, TypeVar, overload

if sys.version_info >= (3, 9):
from types import GenericAlias
Expand Down
3 changes: 2 additions & 1 deletion stubs/dateparser/dateparser/languages/loader.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import OrderedDict
from typing import Any, Iterator
from collections.abc import Iterator
from typing import Any

from .locale import Locale

Expand Down
3 changes: 2 additions & 1 deletion stubs/dateparser/dateparser/utils/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import OrderedDict
from typing import Any, Mapping
from collections.abc import Mapping
from typing import Any

def strip_braces(date_string: str) -> str: ...
def normalize_unicode(string: str, form: str = ...) -> str: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/decorator/decorator.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, TypeVar
from collections.abc import Callable, Iterator
from typing import Any, NamedTuple, Pattern, Text, TypeVar
from typing_extensions import ParamSpec

_C = TypeVar("_C", bound=Callable[..., Any])
Expand Down
3 changes: 2 additions & 1 deletion stubs/docutils/docutils/parsers/rst/roles.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias

import docutils.nodes
Expand Down
2 changes: 1 addition & 1 deletion stubs/editdistance/editdistance.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Hashable, Iterable
from collections.abc import Hashable, Iterable

def eval(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ...
def distance(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ...
3 changes: 2 additions & 1 deletion stubs/flake8-2020/flake8_2020.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Therefore typeshed is the best place.

import ast
from typing import Any, ClassVar, Generator
from collections.abc import Generator
from typing import Any, ClassVar

class Plugin:
name: ClassVar[str]
Expand Down
3 changes: 2 additions & 1 deletion stubs/flake8-bugbear/bugbear.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import ast
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any

class BugBearChecker:
name: str
Expand Down
Loading