Import Match and Pattern from re, not typing (#8277)

This commit is contained in:
Alex Waygood
2022-07-12 14:32:48 +01:00
committed by GitHub
parent 27db37240a
commit 6348a58b8b
78 changed files with 142 additions and 90 deletions

View File

@@ -1,6 +1,7 @@
import sys
from collections.abc import Callable, Generator, Iterable, Sequence
from typing import IO, Any, Generic, NewType, NoReturn, Pattern, Protocol, TypeVar, overload
from re import Pattern
from typing import IO, Any, Generic, NewType, NoReturn, Protocol, TypeVar, overload
from typing_extensions import Literal, TypeAlias
__all__ = [

View File

@@ -1,7 +1,8 @@
import sys
from _typeshed import StrOrBytesPath, SupportsWrite
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence
from typing import Any, ClassVar, Pattern, TypeVar, overload
from re import Pattern
from typing import Any, ClassVar, TypeVar, overload
from typing_extensions import Literal, TypeAlias
__all__ = [

View File

@@ -1,5 +1,6 @@
from collections.abc import Sequence
from typing import Any, Pattern
from re import Pattern
from typing import Any
from ..ccompiler import CCompiler
from ..cmd import Command

View File

@@ -1,5 +1,6 @@
from collections.abc import Iterable
from typing import Pattern, overload
from re import Pattern
from typing import overload
from typing_extensions import Literal
# class is entirely undocumented

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from abc import abstractmethod
from typing import Pattern
from re import Pattern
class Version:
def __eq__(self, other: object) -> bool: ...

View File

@@ -3,7 +3,8 @@ from _typeshed import Self
from collections.abc import Iterable, Iterator
from email.errors import HeaderParseError, MessageDefect
from email.policy import Policy
from typing import Any, Pattern
from re import Pattern
from typing import Any
from typing_extensions import Final
WSP: Final[set[str]]

View File

@@ -1,5 +1,5 @@
from _markupbase import ParserBase
from typing import Pattern
from re import Pattern
__all__ = ["HTMLParser"]

View File

@@ -2,7 +2,8 @@ import sys
from _typeshed import StrPath
from collections.abc import Iterable, Iterator, Sequence
from http.client import HTTPResponse
from typing import ClassVar, Pattern, TypeVar, overload
from re import Pattern
from typing import ClassVar, TypeVar, overload
from urllib.request import Request
__all__ = [

View File

@@ -4,10 +4,11 @@ import time
from _typeshed import Self
from builtins import list as _list # conflicts with a method named "list"
from collections.abc import Callable
from re import Pattern
from socket import socket as _socket
from ssl import SSLContext, SSLSocket
from types import TracebackType
from typing import IO, Any, Pattern
from typing import IO, Any
from typing_extensions import Literal, TypeAlias
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"]

View File

@@ -7,7 +7,8 @@ from email.message import Message
from importlib.abc import MetaPathFinder
from os import PathLike
from pathlib import Path
from typing import Any, ClassVar, NamedTuple, Pattern, overload
from re import Pattern
from typing import Any, ClassVar, NamedTuple, overload
__all__ = [
"Distribution",

View File

@@ -1,5 +1,6 @@
from collections.abc import Callable, Iterator
from typing import Any, Pattern
from re import Pattern
from typing import Any
ESCAPE: Pattern[str]
ESCAPE_ASCII: Pattern[str]

View File

@@ -1,4 +1,4 @@
from typing import Match
from re import Match
simple_escapes: dict[str, str]

View File

@@ -3,10 +3,11 @@ import threading
from _typeshed import Self, StrPath, SupportsWrite
from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence
from io import TextIOWrapper
from re import Pattern
from string import Template
from time import struct_time
from types import FrameType, TracebackType
from typing import Any, ClassVar, Generic, Pattern, TextIO, TypeVar, Union, overload
from typing import Any, ClassVar, Generic, TextIO, TypeVar, Union, overload
from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 11):

View File

@@ -2,8 +2,9 @@ import sys
from _typeshed import StrOrBytesPath
from collections.abc import Callable, Sequence
from configparser import RawConfigParser
from re import Pattern
from threading import Thread
from typing import IO, Any, Pattern
from typing import IO, Any
from . import _Level

View File

@@ -6,8 +6,9 @@ from _typeshed import StrPath
from collections.abc import Callable
from logging import FileHandler, Handler, LogRecord
from queue import Queue, SimpleQueue
from re import Pattern
from socket import SocketKind, socket
from typing import Any, ClassVar, Pattern
from typing import Any, ClassVar
DEFAULT_TCP_LOGGING_PORT: int
DEFAULT_UDP_LOGGING_PORT: int

View File

@@ -1,7 +1,8 @@
import socket
import ssl
from builtins import list as _list # conflicts with a method named "list"
from typing import Any, BinaryIO, NoReturn, Pattern, overload
from re import Pattern
from typing import Any, BinaryIO, NoReturn, overload
from typing_extensions import Literal, TypeAlias
__all__ = ["POP3", "error_proto", "POP3_SSL"]

View File

@@ -2,10 +2,11 @@ import sys
from _typeshed import Self
from collections.abc import Sequence
from email.message import Message as _Message
from re import Pattern
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Pattern, Protocol, overload
from typing import Any, Protocol, overload
from typing_extensions import TypeAlias
__all__ = [

View File

@@ -1,7 +1,8 @@
from re import Pattern
from sre_constants import *
from sre_constants import _NamedIntConstant
from sre_parse import SubPattern
from typing import Any, Pattern
from typing import Any
MAXCODE: int

View File

@@ -1,8 +1,9 @@
import sys
from collections.abc import Iterable
from re import Match, Pattern as _Pattern
from sre_constants import *
from sre_constants import _NamedIntConstant as _NIC, error as _Error
from typing import Any, Match, Pattern as _Pattern, overload
from typing import Any, overload
from typing_extensions import TypeAlias
SPECIAL_CHARS: str

View File

@@ -1,13 +1,8 @@
import sys
from collections.abc import Iterable, Mapping, Sequence
from re import RegexFlag
from re import Pattern, RegexFlag
from typing import Any
if sys.version_info >= (3, 8):
from re import Pattern
else:
from typing import Pattern
__all__ = [
"ascii_letters",
"ascii_lowercase",

View File

@@ -1,8 +1,9 @@
import socket
from _typeshed import Self
from collections.abc import Callable, Sequence
from re import Match, Pattern
from types import TracebackType
from typing import Any, Match, Pattern
from typing import Any
__all__ = ["Telnet"]

View File

@@ -1,5 +1,5 @@
from collections.abc import Callable
from typing import Pattern
from re import Pattern
__all__ = ["TextWrapper", "wrap", "fill", "dedent", "indent", "shorten"]

View File

@@ -2,8 +2,9 @@ import sys
from _typeshed import StrOrBytesPath
from builtins import open as _builtin_open
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from token import *
from typing import Any, NamedTuple, Pattern, TextIO
from typing import Any, NamedTuple, TextIO
from typing_extensions import TypeAlias
__all__ = [

View File

@@ -4,6 +4,7 @@ import unittest.result
from _typeshed import Self, SupportsDunderGE, SupportsDunderGT, SupportsDunderLE, SupportsDunderLT, SupportsRSub, SupportsSub
from collections.abc import Callable, Container, Iterable, Mapping, Sequence, Set as AbstractSet
from contextlib import AbstractContextManager
from re import Pattern
from types import TracebackType
from typing import (
Any,
@@ -12,7 +13,6 @@ from typing import (
Generic,
NamedTuple,
NoReturn,
Pattern,
Protocol,
SupportsAbs,
SupportsRound,

View File

@@ -2,8 +2,9 @@ import unittest.case
import unittest.result
import unittest.suite
from collections.abc import Callable, Sequence
from re import Pattern
from types import ModuleType
from typing import Any, Pattern
from typing import Any
from typing_extensions import TypeAlias
_SortComparisonMethod: TypeAlias = Callable[[str, str], int]

View File

@@ -5,7 +5,8 @@ from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequenc
from email.message import Message
from http.client import HTTPMessage, HTTPResponse, _HTTPConnectionProtocol
from http.cookiejar import CookieJar
from typing import IO, Any, ClassVar, NoReturn, Pattern, TypeVar, overload
from re import Pattern
from typing import IO, Any, ClassVar, NoReturn, TypeVar, overload
from typing_extensions import TypeAlias
from urllib.error import HTTPError as HTTPError
from urllib.response import addclosehook, addinfourl

View File

@@ -1,4 +1,5 @@
from typing import Pattern, overload
from re import Pattern
from typing import overload
from typing_extensions import TypeAlias
_HeaderList: TypeAlias = list[tuple[str, str]]

View File

@@ -1,5 +1,6 @@
from collections.abc import Callable, Generator
from typing import Pattern, TypeVar
from re import Pattern
from typing import TypeVar
from typing_extensions import TypeAlias
from xml.etree.ElementTree import Element

View File

@@ -3,7 +3,8 @@ import pydoc
import socketserver
from collections.abc import Callable, Iterable, Mapping
from datetime import datetime
from typing import Any, ClassVar, Pattern, Protocol
from re import Pattern
from typing import Any, ClassVar, Protocol
from typing_extensions import TypeAlias
from xmlrpc.client import Fault