Use lowercase type everywhere (#6853)

This commit is contained in:
Alex Waygood
2022-01-08 15:09:29 +00:00
committed by GitHub
parent f8501d33c7
commit a40d79a4e6
172 changed files with 728 additions and 761 deletions

View File

@@ -1,5 +1,4 @@
import sys
from typing import Type
from .base_events import BaseEventLoop as BaseEventLoop
from .coroutines import iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction
@@ -108,7 +107,7 @@ if sys.version_info >= (3, 7):
current_task as current_task,
)
DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy]
DefaultEventLoopPolicy: type[AbstractEventLoopPolicy]
if sys.platform == "win32":
from .windows_events import *

View File

@@ -1,7 +1,7 @@
import sys
from collections import deque
from types import TracebackType
from typing import Any, Awaitable, Callable, Generator, Type, TypeVar
from typing import Any, Awaitable, Callable, Generator, TypeVar
from .events import AbstractEventLoop
from .futures import Future
@@ -13,7 +13,7 @@ if sys.version_info >= (3, 9):
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
else:
@@ -30,7 +30,7 @@ else:
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
class Lock(_ContextManagerMixin):

View File

@@ -1,6 +1,6 @@
import sys
from socket import socket
from typing import Any, Mapping, Protocol, Type
from typing import Any, Mapping, Protocol
from typing_extensions import Literal
from . import base_events, constants, events, futures, streams, transports
@@ -8,7 +8,7 @@ from . import base_events, constants, events, futures, streams, transports
if sys.version_info >= (3, 8):
class _WarnCallbackProtocol(Protocol):
def __call__(
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> None: ...
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):

View File

@@ -1,7 +1,8 @@
import socket
import sys
from builtins import type as Type # alias to avoid name clashes with property named "type"
from types import TracebackType
from typing import Any, BinaryIO, Iterable, NoReturn, Type, Union, overload
from typing import Any, BinaryIO, Iterable, NoReturn, Union, overload
if sys.version_info >= (3, 8):
# These are based in socket, maybe move them out into _typeshed.pyi or such

View File

@@ -2,7 +2,7 @@ import sys
import types
from _typeshed import Self
from socket import socket
from typing import Any, Callable, Type
from typing import Any, Callable
from .base_events import Server
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
@@ -17,7 +17,7 @@ class AbstractChildWatcher:
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
def close(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
if sys.version_info >= (3, 8):
def is_active(self) -> bool: ...
@@ -51,7 +51,7 @@ if sys.platform != "win32":
from typing import Protocol
class _Warn(Protocol):
def __call__(
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> None: ...
class MultiLoopChildWatcher(AbstractChildWatcher):
def __enter__(self: Self) -> Self: ...

View File

@@ -1,7 +1,7 @@
import socket
import sys
from _typeshed import WriteableBuffer
from typing import IO, Any, Callable, ClassVar, NoReturn, Type
from typing import IO, Any, Callable, ClassVar, NoReturn
from typing_extensions import Literal
from . import events, futures, proactor_events, selector_events, streams, windows_utils
@@ -61,17 +61,17 @@ if sys.platform == "win32":
if sys.version_info >= (3, 7):
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[Type[SelectorEventLoop]]
_loop_factory: ClassVar[type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[Type[ProactorEventLoop]]
_loop_factory: ClassVar[type[ProactorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
else:
class _WindowsDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[Type[SelectorEventLoop]]
_loop_factory: ClassVar[type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
DefaultEventLoopPolicy = _WindowsDefaultEventLoopPolicy

View File

@@ -2,13 +2,13 @@ import subprocess
import sys
from _typeshed import Self
from types import TracebackType
from typing import Callable, Protocol, Type
from typing import Callable, Protocol
from typing_extensions import Literal
if sys.platform == "win32":
class _WarnFunction(Protocol):
def __call__(
self, message: str, category: Type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...
self, message: str, category: type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...
) -> None: ...
BUFSIZE: Literal[8192]
PIPE = subprocess.PIPE